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