Bug 1867190 - Initialise the PHC allocate delay later r=glandium
[gecko.git] / dom / html / HTMLStyleElement.h
blobf12d6e0cae494f1bbf1e5c6334c228b45b1ee5ea
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/. */
7 #ifndef mozilla_dom_HTMLStyleElement_h
8 #define mozilla_dom_HTMLStyleElement_h
10 #include "mozilla/Attributes.h"
11 #include "mozilla/dom/LinkStyle.h"
12 #include "nsGenericHTMLElement.h"
13 #include "nsStubMutationObserver.h"
15 namespace mozilla::dom {
17 class HTMLStyleElement final : public nsGenericHTMLElement,
18 public LinkStyle,
19 public nsStubMutationObserver {
20 public:
21 explicit HTMLStyleElement(
22 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
24 // nsISupports
25 NS_DECL_ISUPPORTS_INHERITED
27 // CC
28 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLStyleElement,
29 nsGenericHTMLElement)
31 void GetInnerHTML(nsAString& aInnerHTML, OOMReporter& aError) override;
32 using nsGenericHTMLElement::SetInnerHTML;
33 virtual void SetInnerHTML(const nsAString& aInnerHTML,
34 nsIPrincipal* aSubjectPrincipal,
35 mozilla::ErrorResult& aError) override;
36 virtual void SetTextContentInternal(const nsAString& aTextContent,
37 nsIPrincipal* aSubjectPrincipal,
38 mozilla::ErrorResult& aError) override;
39 /**
40 * Mark this style element with a devtools-specific principal that
41 * skips Content Security Policy unsafe-inline checks. This triggering
42 * principal will be overwritten by any callers that set textContent
43 * or innerHTML on this element.
45 void SetDevtoolsAsTriggeringPrincipal();
47 virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
48 virtual void UnbindFromTree(bool aNullParent = true) override;
49 virtual void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
50 const nsAttrValue* aValue,
51 const nsAttrValue* aOldValue,
52 nsIPrincipal* aSubjectPrincipal,
53 bool aNotify) override;
55 virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
57 // nsIMutationObserver
58 NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
59 NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
60 NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
61 NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
63 bool Disabled() const;
64 void SetDisabled(bool aDisabled);
65 void GetMedia(nsAString& aValue) { GetHTMLAttr(nsGkAtoms::media, aValue); }
66 void SetMedia(const nsAString& aMedia, ErrorResult& aError) {
67 SetHTMLAttr(nsGkAtoms::media, aMedia, aError);
69 void GetType(nsAString& aValue) { GetHTMLAttr(nsGkAtoms::type, aValue); }
70 void SetType(const nsAString& aType, ErrorResult& aError) {
71 SetHTMLAttr(nsGkAtoms::type, aType, aError);
74 virtual JSObject* WrapNode(JSContext* aCx,
75 JS::Handle<JSObject*> aGivenProto) override;
77 protected:
78 virtual ~HTMLStyleElement();
80 nsIContent& AsContent() final { return *this; }
81 const LinkStyle* AsLinkStyle() const final { return this; }
82 Maybe<SheetInfo> GetStyleSheetInfo() final;
84 /**
85 * Common method to call from the various mutation observer methods.
86 * aContent is a content node that's either the one that changed or its
87 * parent; we should only respond to the change if aContent is non-anonymous.
89 void ContentChanged(nsIContent* aContent);
92 } // namespace mozilla::dom
94 #endif