SVGTransformableElement.h (1938B)
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_SVGTRANSFORMABLEELEMENT_H_ 8 #define DOM_SVG_SVGTRANSFORMABLEELEMENT_H_ 9 10 #include "gfxMatrix.h" 11 #include "mozilla/UniquePtr.h" 12 #include "mozilla/dom/SVGAnimatedTransformList.h" 13 #include "mozilla/dom/SVGElement.h" 14 #include "mozilla/gfx/Matrix.h" 15 16 namespace mozilla::dom { 17 18 class DOMSVGAnimatedTransformList; 19 class SVGGraphicsElement; 20 class SVGMatrix; 21 class SVGRect; 22 struct SVGBoundingBoxOptions; 23 24 class SVGTransformableElement : public SVGElement { 25 public: 26 explicit SVGTransformableElement(already_AddRefed<dom::NodeInfo>&& aNodeInfo) 27 : SVGElement(std::move(aNodeInfo)) {} 28 virtual ~SVGTransformableElement() = default; 29 30 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override = 0; 31 32 // WebIDL 33 already_AddRefed<DOMSVGAnimatedTransformList> Transform(); 34 35 // SVGElement overrides 36 bool IsEventAttributeNameInternal(nsAtom* aName) override; 37 38 const gfx::Matrix* GetAnimateMotionTransform() const override; 39 void SetAnimateMotionTransform(const gfx::Matrix* aMatrix) override; 40 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override; 41 42 SVGAnimatedTransformList* GetAnimatedTransformList( 43 uint32_t aFlags = 0) override; 44 nsStaticAtom* GetTransformListAttrName() const override { 45 return nsGkAtoms::transform; 46 } 47 48 bool IsTransformable() override { return true; } 49 50 protected: 51 UniquePtr<SVGAnimatedTransformList> mTransforms; 52 53 // XXX maybe move this to property table, to save space on un-animated elems? 54 UniquePtr<gfx::Matrix> mAnimateMotionTransform; 55 }; 56 57 } // namespace mozilla::dom 58 59 #endif // DOM_SVG_SVGTRANSFORMABLEELEMENT_H_