Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/HTMLStyleElement.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
#ifndef mozilla_dom_HTMLStyleElement_h
8
#define mozilla_dom_HTMLStyleElement_h
9
10
#include "mozilla/Attributes.h"
11
#include "nsGenericHTMLElement.h"
12
#include "nsStyleLinkElement.h"
13
#include "nsStubMutationObserver.h"
14
15
class nsIDocument;
16
17
namespace mozilla {
18
namespace dom {
19
20
class HTMLStyleElement final : public nsGenericHTMLElement,
21
                               public nsStyleLinkElement,
22
                               public nsStubMutationObserver
23
{
24
public:
25
  explicit HTMLStyleElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
26
27
  // nsISupports
28
  NS_DECL_ISUPPORTS_INHERITED
29
30
  // CC
31
  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLStyleElement,
32
                                           nsGenericHTMLElement)
33
34
  void GetInnerHTML(nsAString& aInnerHTML, OOMReporter& aError) override;
35
  using nsGenericHTMLElement::SetInnerHTML;
36
  virtual void SetInnerHTML(const nsAString& aInnerHTML,
37
                            nsIPrincipal* aSubjectPrincipal,
38
                            mozilla::ErrorResult& aError) override;
39
  virtual void SetTextContentInternal(const nsAString& aTextContent,
40
                                      nsIPrincipal* aSubjectPrincipal,
41
                                      mozilla::ErrorResult& aError) override;
42
43
  virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
44
                              nsIContent* aBindingParent) override;
45
  virtual void UnbindFromTree(bool aDeep = true,
46
                              bool aNullParent = true) override;
47
  virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
48
                                const nsAttrValue* aValue,
49
                                const nsAttrValue* aOldValue,
50
                                nsIPrincipal* aSubjectPrincipal,
51
                                bool aNotify) override;
52
53
  virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
54
55
  // nsIMutationObserver
56
  NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
57
  NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
58
  NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
59
  NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
60
61
  bool Disabled();
62
  void SetDisabled(bool aDisabled);
63
  void GetMedia(nsAString& aValue)
64
0
  {
65
0
    GetHTMLAttr(nsGkAtoms::media, aValue);
66
0
  }
67
  void SetMedia(const nsAString& aMedia, ErrorResult& aError)
68
0
  {
69
0
    SetHTMLAttr(nsGkAtoms::media, aMedia, aError);
70
0
  }
71
  void GetType(nsAString& aValue)
72
0
  {
73
0
    GetHTMLAttr(nsGkAtoms::type, aValue);
74
0
  }
75
  void SetType(const nsAString& aType, ErrorResult& aError)
76
0
  {
77
0
    SetHTMLAttr(nsGkAtoms::type, aType, aError);
78
0
  }
79
80
  virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
81
82
protected:
83
  virtual ~HTMLStyleElement();
84
85
  Maybe<SheetInfo> GetStyleSheetInfo() final;
86
87
  /**
88
   * Common method to call from the various mutation observer methods.
89
   * aContent is a content node that's either the one that changed or its
90
   * parent; we should only respond to the change if aContent is non-anonymous.
91
   */
92
  void ContentChanged(nsIContent* aContent);
93
};
94
95
} // namespace dom
96
} // namespace mozilla
97
98
#endif
99