Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/style/nsHTMLStyleSheet.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
/*
8
 * style sheet and style rule processor representing data from presentational
9
 * HTML attributes
10
 */
11
12
#ifndef nsHTMLStyleSheet_h_
13
#define nsHTMLStyleSheet_h_
14
15
#include "nsColor.h"
16
#include "nsCOMPtr.h"
17
#include "nsAtom.h"
18
#include "PLDHashTable.h"
19
#include "mozilla/Attributes.h"
20
#include "mozilla/MemoryReporting.h"
21
#include "nsString.h"
22
23
class nsIDocument;
24
class nsMappedAttributes;
25
struct RawServoDeclarationBlock;
26
27
class nsHTMLStyleSheet final
28
{
29
public:
30
  explicit nsHTMLStyleSheet(nsIDocument* aDocument);
31
32
  void SetOwningDocument(nsIDocument* aDocument);
33
34
  NS_INLINE_DECL_REFCOUNTING(nsHTMLStyleSheet)
35
36
  size_t DOMSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
37
38
  void Reset();
39
  nsresult SetLinkColor(nscolor aColor);
40
  nsresult SetActiveLinkColor(nscolor aColor);
41
  nsresult SetVisitedLinkColor(nscolor aColor);
42
43
0
  const RefPtr<RawServoDeclarationBlock>& GetServoUnvisitedLinkDecl() const {
44
0
    return mServoUnvisitedLinkDecl;
45
0
  }
46
0
  const RefPtr<RawServoDeclarationBlock>& GetServoVisitedLinkDecl() const {
47
0
    return mServoVisitedLinkDecl;
48
0
  }
49
0
  const RefPtr<RawServoDeclarationBlock>& GetServoActiveLinkDecl() const {
50
0
    return mServoActiveLinkDecl;
51
0
  }
52
53
  // Mapped Attribute management methods
54
  already_AddRefed<nsMappedAttributes>
55
    UniqueMappedAttributes(nsMappedAttributes* aMapped);
56
  void DropMappedAttributes(nsMappedAttributes* aMapped);
57
  // For each mapped presentation attribute in the cache, resolve
58
  // the attached DeclarationBlock by running the mapping
59
  // and converting the ruledata to Servo specified values.
60
  void CalculateMappedServoDeclarations();
61
62
private:
63
  nsHTMLStyleSheet(const nsHTMLStyleSheet& aCopy) = delete;
64
  nsHTMLStyleSheet& operator=(const nsHTMLStyleSheet& aCopy) = delete;
65
66
0
  ~nsHTMLStyleSheet() {}
67
68
69
  // Implementation of SetLink/VisitedLink/ActiveLinkColor
70
  nsresult ImplLinkColorSetter(
71
      RefPtr<RawServoDeclarationBlock>& aDecl,
72
      nscolor aColor);
73
74
public: // for mLangRuleTable structures only
75
76
77
private:
78
  nsIDocument*            mDocument;
79
  RefPtr<RawServoDeclarationBlock> mServoUnvisitedLinkDecl;
80
  RefPtr<RawServoDeclarationBlock> mServoVisitedLinkDecl;
81
  RefPtr<RawServoDeclarationBlock> mServoActiveLinkDecl;
82
83
  PLDHashTable            mMappedAttrTable;
84
  // Whether or not the mapped attributes table
85
  // has been changed since the last call to
86
  // CalculateMappedServoDeclarations()
87
  bool                    mMappedAttrsDirty;
88
};
89
90
#endif /* !defined(nsHTMLStyleSheet_h_) */