Bug 1867190 - Initialise the PHC allocate delay later r=glandium
[gecko.git] / dom / xml / XMLStylesheetProcessingInstruction.h
bloba6b3aa69784d3ed0e08291aee475faa10952c944
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_XMLStylesheetProcessingInstruction_h
8 #define mozilla_dom_XMLStylesheetProcessingInstruction_h
10 #include "mozilla/Attributes.h"
11 #include "mozilla/Unused.h"
12 #include "mozilla/dom/LinkStyle.h"
13 #include "mozilla/dom/ProcessingInstruction.h"
14 #include "nsIURI.h"
16 namespace mozilla::dom {
18 class XMLStylesheetProcessingInstruction final : public ProcessingInstruction,
19 public LinkStyle {
20 public:
21 XMLStylesheetProcessingInstruction(
22 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
23 const nsAString& aData)
24 : ProcessingInstruction(std::move(aNodeInfo), aData) {}
26 XMLStylesheetProcessingInstruction(nsNodeInfoManager* aNodeInfoManager,
27 const nsAString& aData)
28 : ProcessingInstruction(
29 aNodeInfoManager->GetNodeInfo(
30 nsGkAtoms::processingInstructionTagName, nullptr,
31 kNameSpaceID_None, PROCESSING_INSTRUCTION_NODE,
32 nsGkAtoms::xml_stylesheet),
33 aData) {}
35 // CC
36 NS_DECL_ISUPPORTS_INHERITED
37 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XMLStylesheetProcessingInstruction,
38 ProcessingInstruction)
40 // nsINode
41 virtual void SetNodeValueInternal(const nsAString& aNodeValue,
42 mozilla::ErrorResult& aError) override;
44 // nsIContent
45 virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
46 virtual void UnbindFromTree(bool aNullParent = true) override;
48 /**
49 * Tells this processing instruction to use a different base URI. This is used
50 * for proper loading of xml-stylesheet processing instructions in XUL
51 * overlays and is only currently used by nsXMLStylesheetPI.
53 * @param aNewBaseURI the new base URI, nullptr to use the default base URI.
55 void OverrideBaseURI(nsIURI* aNewBaseURI);
57 // LinkStyle
58 void GetCharset(nsAString& aCharset) override;
60 virtual void SetData(const nsAString& aData,
61 mozilla::ErrorResult& rv) override {
62 CharacterData::SetData(aData, rv);
63 if (rv.Failed()) {
64 return;
66 Unused << UpdateStyleSheetInternal(nullptr, nullptr, ForceUpdate::Yes);
69 protected:
70 virtual ~XMLStylesheetProcessingInstruction();
72 nsCOMPtr<nsIURI> mOverriddenBaseURI;
74 nsIContent& AsContent() final { return *this; }
75 const LinkStyle* AsLinkStyle() const final { return this; }
76 Maybe<SheetInfo> GetStyleSheetInfo() final;
78 already_AddRefed<CharacterData> CloneDataNode(
79 mozilla::dom::NodeInfo* aNodeInfo, bool aCloneText) const final;
82 } // namespace mozilla::dom
84 #endif // mozilla_dom_XMLStylesheetProcessingInstruction_h