Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/style/nsDOMCSSAttrDeclaration.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
/* DOM object for element.style */
8
9
#ifndef nsDOMCSSAttributeDeclaration_h
10
#define nsDOMCSSAttributeDeclaration_h
11
12
#include "mozilla/Attributes.h"
13
#include "mozilla/dom/DocGroup.h"
14
#include "nsDOMCSSDeclaration.h"
15
16
17
class nsSMILValue;
18
struct RawServoUnlockedDeclarationBlock;
19
namespace mozilla {
20
namespace dom {
21
class DomGroup;
22
class Element;
23
} // namespace dom
24
} // namespace mozilla
25
26
class nsDOMCSSAttributeDeclaration final : public nsDOMCSSDeclaration
27
{
28
public:
29
  typedef mozilla::dom::Element Element;
30
  nsDOMCSSAttributeDeclaration(Element* aContent, bool aIsSMILOverride);
31
32
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
33
  NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDOMCSSAttributeDeclaration,
34
                                                                   nsICSSDeclaration)
35
36
  mozilla::DeclarationBlock* GetOrCreateCSSDeclaration(
37
    Operation aOperation, mozilla::DeclarationBlock** aCreated) final;
38
39
  nsDOMCSSDeclaration::ParsingEnvironment
40
    GetParsingEnvironment(nsIPrincipal* aSubjectPrincipal) const final;
41
42
  mozilla::css::Rule* GetParentRule() override
43
0
  {
44
0
    return nullptr;
45
0
  }
46
47
  nsINode* GetParentObject() override
48
0
  {
49
0
    return mElement;
50
0
  }
51
52
  nsresult SetSMILValue(const nsCSSPropertyID aPropID, const nsSMILValue&);
53
54
  nsresult SetPropertyValue(const nsCSSPropertyID aPropID,
55
                            const nsAString& aValue,
56
                            nsIPrincipal* aSubjectPrincipal) override;
57
58
  static void MutationClosureFunction(void* aData);
59
60
  void
61
  GetPropertyChangeClosure(DeclarationBlockMutationClosure* aClosure,
62
                           mozilla::MutationClosureData* aClosureData) final
63
0
  {
64
0
    if (!mIsSMILOverride) {
65
0
      aClosure->function = MutationClosureFunction;
66
0
      aClosure->data = aClosureData;
67
0
      aClosureData->mClosure = MutationClosureFunction;
68
0
      aClosureData->mElement = mElement;
69
0
    }
70
0
  }
71
72
protected:
73
  ~nsDOMCSSAttributeDeclaration();
74
75
  virtual nsresult SetCSSDeclaration(mozilla::DeclarationBlock* aDecl,
76
                                     mozilla::MutationClosureData* aClosureData) override;
77
  virtual nsIDocument* DocToUpdate() override;
78
79
  RefPtr<Element> mElement;
80
81
  /* If true, this indicates that this nsDOMCSSAttributeDeclaration
82
   * should interact with mContent's SMIL override style rule (rather
83
   * than the inline style rule).
84
   */
85
  const bool mIsSMILOverride;
86
};
87
88
#endif /* nsDOMCSSAttributeDeclaration_h */