Backed out changeset 06f41c22f3a6 (bug 1888460) for causing linux xpcshell failures...
[gecko.git] / dom / xml / ProcessingInstruction.h
blob69902049d4c3846810ad5be010b7068962a3f622
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_ProcessingInstruction_h
8 #define mozilla_dom_ProcessingInstruction_h
10 #include "mozilla/Attributes.h"
11 #include "mozilla/dom/CharacterData.h"
12 #include "nsAString.h"
14 class nsIPrincipal;
15 class nsIURI;
17 namespace mozilla {
19 class StyleSheet;
21 namespace dom {
23 class ProcessingInstruction : public CharacterData {
24 public:
25 ProcessingInstruction(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
26 const nsAString& aData);
28 virtual already_AddRefed<CharacterData> CloneDataNode(
29 dom::NodeInfo* aNodeInfo, bool aCloneText) const override;
31 #ifdef MOZ_DOM_LIST
32 virtual void List(FILE* out, int32_t aIndent) const override;
33 virtual void DumpContent(FILE* out, int32_t aIndent,
34 bool aDumpAll) const override;
35 #endif
37 // WebIDL API
38 void GetTarget(nsAString& aTarget) { aTarget = NodeName(); }
39 // This is the WebIDL API for LinkStyle, even though only
40 // XMLStylesheetProcessingInstruction actually implements LinkStyle.
41 StyleSheet* GetSheetForBindings() const;
43 NS_IMPL_FROMNODE_HELPER(ProcessingInstruction, IsProcessingInstruction())
45 protected:
46 virtual ~ProcessingInstruction();
48 /**
49 * This will parse the content of the PI, to extract the value of the pseudo
50 * attribute with the name specified in aName. See
51 * http://www.w3.org/TR/xml-stylesheet/#NT-StyleSheetPI for the specification
52 * which is used to parse the content of the PI.
54 * @param aName the name of the attribute to get the value for
55 * @param aValue [out] the value for the attribute with name specified in
56 * aAttribute. Empty if the attribute isn't present.
58 bool GetAttrValue(nsAtom* aName, nsAString& aValue);
60 JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
63 } // namespace dom
64 } // namespace mozilla
66 /**
67 * aNodeInfoManager must not be null.
69 already_AddRefed<mozilla::dom::ProcessingInstruction>
70 NS_NewXMLProcessingInstruction(nsNodeInfoManager* aNodeInfoManager,
71 const nsAString& aTarget,
72 const nsAString& aData);
74 #endif // mozilla_dom_ProcessingInstruction_h