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"
19 class XMLStylesheetProcessingInstruction final
: public ProcessingInstruction
,
22 XMLStylesheetProcessingInstruction(
23 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
,
24 const nsAString
& aData
)
25 : ProcessingInstruction(std::move(aNodeInfo
), aData
) {}
27 XMLStylesheetProcessingInstruction(nsNodeInfoManager
* aNodeInfoManager
,
28 const nsAString
& aData
)
29 : ProcessingInstruction(
30 aNodeInfoManager
->GetNodeInfo(
31 nsGkAtoms::processingInstructionTagName
, nullptr,
32 kNameSpaceID_None
, PROCESSING_INSTRUCTION_NODE
,
33 nsGkAtoms::xml_stylesheet
),
37 NS_DECL_ISUPPORTS_INHERITED
38 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XMLStylesheetProcessingInstruction
,
39 ProcessingInstruction
)
42 virtual void SetNodeValueInternal(const nsAString
& aNodeValue
,
43 mozilla::ErrorResult
& aError
) override
;
46 virtual nsresult
BindToTree(BindContext
&, nsINode
& aParent
) override
;
47 virtual void UnbindFromTree(bool aNullParent
= true) override
;
50 * Tells this processing instruction to use a different base URI. This is used
51 * for proper loading of xml-stylesheet processing instructions in XUL
52 * overlays and is only currently used by nsXMLStylesheetPI.
54 * @param aNewBaseURI the new base URI, nullptr to use the default base URI.
56 void OverrideBaseURI(nsIURI
* aNewBaseURI
);
59 void GetCharset(nsAString
& aCharset
) override
;
61 virtual void SetData(const nsAString
& aData
,
62 mozilla::ErrorResult
& rv
) override
{
63 CharacterData::SetData(aData
, rv
);
67 Unused
<< UpdateStyleSheetInternal(nullptr, nullptr, ForceUpdate::Yes
);
71 virtual ~XMLStylesheetProcessingInstruction();
73 nsCOMPtr
<nsIURI
> mOverriddenBaseURI
;
75 nsIContent
& AsContent() final
{ return *this; }
76 const LinkStyle
* AsLinkStyle() const final
{ return this; }
77 Maybe
<SheetInfo
> GetStyleSheetInfo() final
;
79 already_AddRefed
<CharacterData
> CloneDataNode(
80 mozilla::dom::NodeInfo
* aNodeInfo
, bool aCloneText
) const final
;
84 } // namespace mozilla
86 #endif // mozilla_dom_XMLStylesheetProcessingInstruction_h