/work/obj-fuzz/dist/include/mozilla/dom/SVGImageElement.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_SVGImageElement_h |
8 | | #define mozilla_dom_SVGImageElement_h |
9 | | |
10 | | #include "nsImageLoadingContent.h" |
11 | | #include "nsSVGLength2.h" |
12 | | #include "nsSVGString.h" |
13 | | #include "SVGGeometryElement.h" |
14 | | #include "SVGAnimatedPreserveAspectRatio.h" |
15 | | |
16 | | nsresult NS_NewSVGImageElement(nsIContent **aResult, |
17 | | already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); |
18 | | |
19 | | class nsSVGImageFrame; |
20 | | |
21 | | namespace mozilla { |
22 | | namespace dom { |
23 | | class DOMSVGAnimatedPreserveAspectRatio; |
24 | | |
25 | | typedef SVGGeometryElement SVGImageElementBase; |
26 | | |
27 | | class SVGImageElement : public SVGImageElementBase, |
28 | | public nsImageLoadingContent |
29 | | { |
30 | | friend class ::nsSVGImageFrame; |
31 | | |
32 | | protected: |
33 | | explicit SVGImageElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); |
34 | | virtual ~SVGImageElement(); |
35 | | virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override; |
36 | | friend nsresult (::NS_NewSVGImageElement(nsIContent **aResult, |
37 | | already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)); |
38 | | |
39 | | public: |
40 | | // interfaces: |
41 | | |
42 | | NS_DECL_ISUPPORTS_INHERITED |
43 | | |
44 | | // EventTarget |
45 | | virtual void AsyncEventRunning(AsyncEventDispatcher* aEvent) override; |
46 | | |
47 | | // nsIContent interface |
48 | | bool ParseAttribute(int32_t aNamespaceID, |
49 | | nsAtom* aAttribute, |
50 | | const nsAString& aValue, |
51 | | nsIPrincipal* aMaybeScriptedPrincipal, |
52 | | nsAttrValue& aResult) override; |
53 | | virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName, |
54 | | const nsAttrValue* aValue, |
55 | | const nsAttrValue* aOldValue, |
56 | | nsIPrincipal* aSubjectPrincipal, |
57 | | bool aNotify) override; |
58 | | virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, |
59 | | nsIContent* aBindingParent) override; |
60 | | virtual void UnbindFromTree(bool aDeep, bool aNullParent) override; |
61 | | |
62 | | virtual EventStates IntrinsicState() const override; |
63 | | |
64 | | NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* name) const override; |
65 | | |
66 | | // SVGGeometryElement methods: |
67 | | virtual bool GetGeometryBounds(Rect* aBounds, const StrokeOptions& aStrokeOptions, |
68 | | const Matrix& aToBoundsSpace, |
69 | | const Matrix* aToNonScalingStrokeSpace = nullptr) override; |
70 | | virtual already_AddRefed<Path> BuildPath(PathBuilder* aBuilder) override; |
71 | | |
72 | | // nsSVGSVGElement methods: |
73 | | virtual bool HasValidDimensions() const override; |
74 | | |
75 | | virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; |
76 | | |
77 | | nsresult CopyInnerTo(mozilla::dom::Element* aDest); |
78 | | |
79 | | void MaybeLoadSVGImage(); |
80 | | |
81 | | // WebIDL |
82 | | already_AddRefed<SVGAnimatedLength> X(); |
83 | | already_AddRefed<SVGAnimatedLength> Y(); |
84 | | already_AddRefed<SVGAnimatedLength> Width(); |
85 | | already_AddRefed<SVGAnimatedLength> Height(); |
86 | | already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio(); |
87 | | already_AddRefed<SVGAnimatedString> Href(); |
88 | | |
89 | | void SetDecoding(const nsAString& aDecoding, ErrorResult& aError) |
90 | 0 | { |
91 | 0 | SetAttr(nsGkAtoms::decoding, aDecoding, aError); |
92 | 0 | } |
93 | | void GetDecoding(nsAString& aValue); |
94 | | |
95 | | protected: |
96 | | nsresult LoadSVGImage(bool aForce, bool aNotify); |
97 | | |
98 | | virtual LengthAttributesInfo GetLengthInfo() override; |
99 | | virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio() override; |
100 | | virtual StringAttributesInfo GetStringInfo() override; |
101 | | |
102 | | // Override for nsImageLoadingContent. |
103 | 0 | nsIContent* AsContent() override { return this; } |
104 | | |
105 | | enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT }; |
106 | | nsSVGLength2 mLengthAttributes[4]; |
107 | | static LengthInfo sLengthInfo[4]; |
108 | | |
109 | | SVGAnimatedPreserveAspectRatio mPreserveAspectRatio; |
110 | | |
111 | | enum { HREF, XLINK_HREF }; |
112 | | nsSVGString mStringAttributes[2]; |
113 | | static StringInfo sStringInfo[2]; |
114 | | }; |
115 | | |
116 | | } // namespace dom |
117 | | } // namespace mozilla |
118 | | |
119 | | #endif // mozilla_dom_SVGImageElement_h |