SVGFilterElement.h (2488B)
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 DOM_SVG_SVGFILTERELEMENT_H_ 8 #define DOM_SVG_SVGFILTERELEMENT_H_ 9 10 #include "SVGAnimatedEnumeration.h" 11 #include "SVGAnimatedLength.h" 12 #include "SVGAnimatedString.h" 13 #include "mozilla/dom/SVGElement.h" 14 15 nsresult NS_NewSVGFilterElement( 16 nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 17 18 namespace mozilla { 19 class SVGFilterFrame; 20 class SVGFilterInstance; 21 22 namespace dom { 23 class DOMSVGAnimatedLength; 24 25 using SVGFilterElementBase = SVGElement; 26 27 class SVGFilterElement final : public SVGFilterElementBase { 28 friend class mozilla::SVGFilterFrame; 29 friend class mozilla::SVGFilterInstance; 30 31 protected: 32 friend nsresult(::NS_NewSVGFilterElement( 33 nsIContent** aResult, 34 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)); 35 explicit SVGFilterElement( 36 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 37 JSObject* WrapNode(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override; 38 39 public: 40 NS_IMPL_FROMNODE_WITH_TAG(SVGFilterElement, kNameSpaceID_SVG, filter) 41 42 // nsIContent 43 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 44 45 // SVGSVGElement methods: 46 bool HasValidDimensions() const override; 47 48 // WebIDL 49 already_AddRefed<DOMSVGAnimatedLength> X(); 50 already_AddRefed<DOMSVGAnimatedLength> Y(); 51 already_AddRefed<DOMSVGAnimatedLength> Width(); 52 already_AddRefed<DOMSVGAnimatedLength> Height(); 53 already_AddRefed<DOMSVGAnimatedEnumeration> FilterUnits(); 54 already_AddRefed<DOMSVGAnimatedEnumeration> PrimitiveUnits(); 55 already_AddRefed<DOMSVGAnimatedString> Href(); 56 57 protected: 58 LengthAttributesInfo GetLengthInfo() override; 59 EnumAttributesInfo GetEnumInfo() override; 60 StringAttributesInfo GetStringInfo() override; 61 62 enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT }; 63 SVGAnimatedLength mLengthAttributes[4]; 64 static LengthInfo sLengthInfo[4]; 65 66 enum { FILTERUNITS, PRIMITIVEUNITS }; 67 SVGAnimatedEnumeration mEnumAttributes[2]; 68 static EnumInfo sEnumInfo[2]; 69 70 enum { HREF, XLINK_HREF }; 71 SVGAnimatedString mStringAttributes[2]; 72 static StringInfo sStringInfo[2]; 73 }; 74 75 } // namespace dom 76 } // namespace mozilla 77 78 #endif // DOM_SVG_SVGFILTERELEMENT_H_