/work/obj-fuzz/dist/include/mozilla/dom/SVGScriptElement.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_SVGScriptElement_h |
8 | | #define mozilla_dom_SVGScriptElement_h |
9 | | |
10 | | #include "nsSVGElement.h" |
11 | | #include "nsCOMPtr.h" |
12 | | #include "nsSVGString.h" |
13 | | #include "mozilla/dom/ScriptElement.h" |
14 | | |
15 | | class nsIDocument; |
16 | | |
17 | | nsresult NS_NewSVGScriptElement(nsIContent **aResult, |
18 | | already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, |
19 | | mozilla::dom::FromParser aFromParser); |
20 | | |
21 | | namespace mozilla { |
22 | | namespace dom { |
23 | | |
24 | | typedef nsSVGElement SVGScriptElementBase; |
25 | | |
26 | | class SVGScriptElement final : public SVGScriptElementBase, |
27 | | public ScriptElement |
28 | | { |
29 | | protected: |
30 | | friend nsresult (::NS_NewSVGScriptElement(nsIContent **aResult, |
31 | | already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, |
32 | | mozilla::dom::FromParser aFromParser)); |
33 | | SVGScriptElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, |
34 | | FromParser aFromParser); |
35 | | |
36 | | virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override; |
37 | | |
38 | | public: |
39 | | // interfaces: |
40 | | |
41 | | NS_DECL_ISUPPORTS_INHERITED |
42 | | |
43 | | // nsIScriptElement |
44 | | virtual bool GetScriptType(nsAString& type) override; |
45 | | virtual void GetScriptText(nsAString& text) override; |
46 | | virtual void GetScriptCharset(nsAString& charset) override; |
47 | | virtual void FreezeExecutionAttrs(nsIDocument* aOwnerDoc) override; |
48 | | virtual CORSMode GetCORSMode() const override; |
49 | | |
50 | | // ScriptElement |
51 | | virtual bool HasScriptContent() override; |
52 | | |
53 | | // nsIContent specializations: |
54 | | virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, |
55 | | nsIContent* aBindingParent) override; |
56 | | virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName, |
57 | | const nsAttrValue* aValue, |
58 | | const nsAttrValue* aOldValue, |
59 | | nsIPrincipal* aSubjectPrincipal, |
60 | | bool aNotify) override; |
61 | | virtual bool ParseAttribute(int32_t aNamespaceID, |
62 | | nsAtom* aAttribute, |
63 | | const nsAString& aValue, |
64 | | nsIPrincipal* aMaybeScriptedPrincipal, |
65 | | nsAttrValue& aResult) override; |
66 | | |
67 | | virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; |
68 | | |
69 | | // WebIDL |
70 | | void GetType(nsAString & aType); |
71 | | void SetType(const nsAString & aType, ErrorResult& rv); |
72 | | void GetCrossOrigin(nsAString & aCrossOrigin); |
73 | | void SetCrossOrigin(const nsAString & aCrossOrigin, ErrorResult& aError); |
74 | | already_AddRefed<SVGAnimatedString> Href(); |
75 | | |
76 | | protected: |
77 | | ~SVGScriptElement(); |
78 | | |
79 | | virtual StringAttributesInfo GetStringInfo() override; |
80 | | |
81 | | // SVG Script elements don't have the ability to set async properties on |
82 | | // themselves, so this will always return false. |
83 | | virtual bool GetAsyncState() override |
84 | 0 | { |
85 | 0 | return false; |
86 | 0 | } |
87 | | |
88 | | enum { HREF, XLINK_HREF }; |
89 | | nsSVGString mStringAttributes[2]; |
90 | | static StringInfo sStringInfo[2]; |
91 | | }; |
92 | | |
93 | | } // namespace dom |
94 | | } // namespace mozilla |
95 | | |
96 | | #endif // mozilla_dom_SVGScriptElement_h |