2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) 2014 Google, Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 #ifndef SVGGraphicsElement_h
23 #define SVGGraphicsElement_h
25 #include "core/CoreExport.h"
26 #include "core/svg/SVGAnimatedTransformList.h"
27 #include "core/svg/SVGElement.h"
28 #include "core/svg/SVGRectTearOff.h"
29 #include "core/svg/SVGTests.h"
30 #include "platform/heap/Handle.h"
34 class AffineTransform
;
36 class SVGMatrixTearOff
;
38 class CORE_EXPORT SVGGraphicsElement
: public SVGElement
, public SVGTests
{
39 DEFINE_WRAPPERTYPEINFO();
40 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SVGGraphicsElement
);
42 ~SVGGraphicsElement() override
;
44 enum StyleUpdateStrategy
{ AllowStyleUpdate
, DisallowStyleUpdate
};
46 AffineTransform
getCTM(StyleUpdateStrategy
= AllowStyleUpdate
);
47 AffineTransform
getScreenCTM(StyleUpdateStrategy
= AllowStyleUpdate
);
48 PassRefPtrWillBeRawPtr
<SVGMatrixTearOff
> getCTMFromJavascript();
49 PassRefPtrWillBeRawPtr
<SVGMatrixTearOff
> getScreenCTMFromJavascript();
51 PassRefPtrWillBeRawPtr
<SVGMatrixTearOff
> getTransformToElement(SVGElement
*, ExceptionState
&);
53 SVGElement
* nearestViewportElement() const;
54 SVGElement
* farthestViewportElement() const;
56 AffineTransform
localCoordinateSpaceTransform(SVGElement::CTMScope
) const override
{ return calculateAnimatedLocalTransform(); }
57 bool hasAnimatedLocalTransform() const;
58 AffineTransform
calculateAnimatedLocalTransform() const;
59 AffineTransform
* animateMotionTransform() override
;
61 virtual FloatRect
getBBox();
62 PassRefPtrWillBeRawPtr
<SVGRectTearOff
> getBBoxFromJavascript();
64 bool isValid() const final
{ return SVGTests::isValid(document()); }
66 SVGAnimatedTransformList
* transform() { return m_transform
.get(); }
67 const SVGAnimatedTransformList
* transform() const { return m_transform
.get(); }
69 AffineTransform
computeCTM(SVGElement::CTMScope mode
, SVGGraphicsElement::StyleUpdateStrategy
,
70 const SVGGraphicsElement
* ancestor
= 0) const;
72 DECLARE_VIRTUAL_TRACE();
75 SVGGraphicsElement(const QualifiedName
&, Document
&, ConstructionType
= CreateSVGElement
);
77 bool supportsFocus() const override
{ return Element::supportsFocus() || hasFocusEventListeners(); }
79 void svgAttributeChanged(const QualifiedName
&) override
;
81 RefPtrWillBeMember
<SVGAnimatedTransformList
> m_transform
;
84 bool isSVGGraphicsElement() const final
{ return true; }
87 inline bool isSVGGraphicsElement(const SVGElement
& element
)
89 return element
.isSVGGraphicsElement();
92 DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGGraphicsElement
);
96 #endif // SVGGraphicsElement_h