SVGMaskElement.h (2119B)
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_SVGMASKELEMENT_H_ 8 #define DOM_SVG_SVGMASKELEMENT_H_ 9 10 #include "SVGAnimatedEnumeration.h" 11 #include "SVGAnimatedLength.h" 12 #include "mozilla/dom/SVGElement.h" 13 14 nsresult NS_NewSVGMaskElement( 15 nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 16 17 namespace mozilla { 18 class SVGMaskFrame; 19 20 namespace dom { 21 22 //--------------------- Masks ------------------------ 23 24 using SVGMaskElementBase = SVGElement; 25 26 class SVGMaskElement final : public SVGMaskElementBase { 27 friend class mozilla::SVGMaskFrame; 28 29 protected: 30 friend nsresult(::NS_NewSVGMaskElement( 31 nsIContent** aResult, 32 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)); 33 explicit SVGMaskElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 34 JSObject* WrapNode(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override; 35 36 public: 37 // nsIContent interface 38 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 39 40 // SVGSVGElement methods: 41 bool HasValidDimensions() const override; 42 43 // WebIDL 44 already_AddRefed<DOMSVGAnimatedEnumeration> MaskUnits(); 45 already_AddRefed<DOMSVGAnimatedEnumeration> MaskContentUnits(); 46 already_AddRefed<DOMSVGAnimatedLength> X(); 47 already_AddRefed<DOMSVGAnimatedLength> Y(); 48 already_AddRefed<DOMSVGAnimatedLength> Width(); 49 already_AddRefed<DOMSVGAnimatedLength> Height(); 50 51 protected: 52 LengthAttributesInfo GetLengthInfo() override; 53 EnumAttributesInfo GetEnumInfo() override; 54 55 enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT }; 56 SVGAnimatedLength mLengthAttributes[4]; 57 static LengthInfo sLengthInfo[4]; 58 59 enum { MASKUNITS, MASKCONTENTUNITS }; 60 SVGAnimatedEnumeration mEnumAttributes[2]; 61 static EnumInfo sEnumInfo[2]; 62 }; 63 64 } // namespace dom 65 } // namespace mozilla 66 67 #endif // DOM_SVG_SVGMASKELEMENT_H_