SVGForeignObjectElement.h (2048B)
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_SVGFOREIGNOBJECTELEMENT_H_ 8 #define DOM_SVG_SVGFOREIGNOBJECTELEMENT_H_ 9 10 #include "NonCustomCSSPropertyId.h" 11 #include "SVGAnimatedLength.h" 12 #include "mozilla/dom/SVGGraphicsElement.h" 13 14 nsresult NS_NewSVGForeignObjectElement( 15 nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 16 17 namespace mozilla { 18 class SVGForeignObjectFrame; 19 20 namespace dom { 21 22 class SVGForeignObjectElement final : public SVGGraphicsElement { 23 friend class mozilla::SVGForeignObjectFrame; 24 25 protected: 26 friend nsresult(::NS_NewSVGForeignObjectElement( 27 nsIContent** aResult, 28 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)); 29 explicit SVGForeignObjectElement( 30 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 31 JSObject* WrapNode(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override; 32 33 public: 34 // SVGElement specializations: 35 gfxMatrix ChildToUserSpaceTransform() const override; 36 bool HasValidDimensions() const override; 37 38 // nsIContent interface 39 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* name) const override; 40 41 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 42 43 static NonCustomCSSPropertyId GetCSSPropertyIdForAttrEnum(uint8_t aAttrEnum); 44 45 // WebIDL 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 54 enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT }; 55 SVGAnimatedLength mLengthAttributes[4]; 56 static LengthInfo sLengthInfo[4]; 57 }; 58 59 } // namespace dom 60 } // namespace mozilla 61 62 #endif // DOM_SVG_SVGFOREIGNOBJECTELEMENT_H_