2
* Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
* Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Library General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Library General Public License for more details.
15
* You should have received a copy of the GNU Library General Public License
16
* along with this library; see the file COPYING.LIB. If not, write to
17
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
* Boston, MA 02110-1301, USA.
21
#ifndef SVGPathElement_h
22
#define SVGPathElement_h
25
#include "SVGAnimatedBoolean.h"
26
#include "SVGAnimatedNumber.h"
27
#include "SVGExternalResourcesRequired.h"
28
#include "SVGLangSpace.h"
29
#include "SVGPathByteStream.h"
30
#include "SVGPathSegList.h"
31
#include "SVGStyledTransformableElement.h"
36
class SVGPathSegArcAbs;
37
class SVGPathSegArcRel;
38
class SVGPathSegClosePath;
39
class SVGPathSegLinetoAbs;
40
class SVGPathSegLinetoRel;
41
class SVGPathSegMovetoAbs;
42
class SVGPathSegMovetoRel;
43
class SVGPathSegCurvetoCubicAbs;
44
class SVGPathSegCurvetoCubicRel;
45
class SVGPathSegLinetoVerticalAbs;
46
class SVGPathSegLinetoVerticalRel;
47
class SVGPathSegLinetoHorizontalAbs;
48
class SVGPathSegLinetoHorizontalRel;
49
class SVGPathSegCurvetoQuadraticAbs;
50
class SVGPathSegCurvetoQuadraticRel;
51
class SVGPathSegCurvetoCubicSmoothAbs;
52
class SVGPathSegCurvetoCubicSmoothRel;
53
class SVGPathSegCurvetoQuadraticSmoothAbs;
54
class SVGPathSegCurvetoQuadraticSmoothRel;
55
class SVGPathSegListPropertyTearOff;
57
class SVGPathElement : public SVGStyledTransformableElement,
60
public SVGExternalResourcesRequired {
62
static PassRefPtr<SVGPathElement> create(const QualifiedName&, Document*);
64
float getTotalLength();
65
FloatPoint getPointAtLength(float distance);
66
unsigned getPathSegAtLength(float distance);
68
PassRefPtr<SVGPathSegClosePath> createSVGPathSegClosePath(SVGPathSegRole role = PathSegUndefinedRole);
69
PassRefPtr<SVGPathSegMovetoAbs> createSVGPathSegMovetoAbs(float x, float y, SVGPathSegRole role = PathSegUndefinedRole);
70
PassRefPtr<SVGPathSegMovetoRel> createSVGPathSegMovetoRel(float x, float y, SVGPathSegRole role = PathSegUndefinedRole);
71
PassRefPtr<SVGPathSegLinetoAbs> createSVGPathSegLinetoAbs(float x, float y, SVGPathSegRole role = PathSegUndefinedRole);
72
PassRefPtr<SVGPathSegLinetoRel> createSVGPathSegLinetoRel(float x, float y, SVGPathSegRole role = PathSegUndefinedRole);
73
PassRefPtr<SVGPathSegCurvetoCubicAbs> createSVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2, SVGPathSegRole role = PathSegUndefinedRole);
74
PassRefPtr<SVGPathSegCurvetoCubicRel> createSVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2, SVGPathSegRole role = PathSegUndefinedRole);
75
PassRefPtr<SVGPathSegCurvetoQuadraticAbs> createSVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1, SVGPathSegRole role = PathSegUndefinedRole);
76
PassRefPtr<SVGPathSegCurvetoQuadraticRel> createSVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1, SVGPathSegRole role = PathSegUndefinedRole);
77
PassRefPtr<SVGPathSegArcAbs> createSVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, SVGPathSegRole role = PathSegUndefinedRole);
78
PassRefPtr<SVGPathSegArcRel> createSVGPathSegArcRel(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, SVGPathSegRole role = PathSegUndefinedRole);
79
PassRefPtr<SVGPathSegLinetoHorizontalAbs> createSVGPathSegLinetoHorizontalAbs(float x, SVGPathSegRole role = PathSegUndefinedRole);
80
PassRefPtr<SVGPathSegLinetoHorizontalRel> createSVGPathSegLinetoHorizontalRel(float x, SVGPathSegRole role = PathSegUndefinedRole);
81
PassRefPtr<SVGPathSegLinetoVerticalAbs> createSVGPathSegLinetoVerticalAbs(float y, SVGPathSegRole role = PathSegUndefinedRole);
82
PassRefPtr<SVGPathSegLinetoVerticalRel> createSVGPathSegLinetoVerticalRel(float y, SVGPathSegRole role = PathSegUndefinedRole);
83
PassRefPtr<SVGPathSegCurvetoCubicSmoothAbs> createSVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2, SVGPathSegRole role = PathSegUndefinedRole);
84
PassRefPtr<SVGPathSegCurvetoCubicSmoothRel> createSVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2, SVGPathSegRole role = PathSegUndefinedRole);
85
PassRefPtr<SVGPathSegCurvetoQuadraticSmoothAbs> createSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y, SVGPathSegRole role = PathSegUndefinedRole);
86
PassRefPtr<SVGPathSegCurvetoQuadraticSmoothRel> createSVGPathSegCurvetoQuadraticSmoothRel(float x, float y, SVGPathSegRole role = PathSegUndefinedRole);
88
// Used in the bindings only.
89
SVGPathSegListPropertyTearOff* pathSegList();
90
SVGPathSegListPropertyTearOff* animatedPathSegList();
91
SVGPathSegListPropertyTearOff* normalizedPathSegList();
92
SVGPathSegListPropertyTearOff* animatedNormalizedPathSegList();
94
SVGPathByteStream* pathByteStream() const;
96
void pathSegListChanged(SVGPathSegRole, ListModification = ListModificationUnknown);
98
virtual FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate);
100
static const SVGPropertyInfo* dPropertyInfo();
102
bool isAnimValObserved() const { return m_isAnimValObserved; }
105
SVGPathElement(const QualifiedName&, Document*);
107
virtual bool isValid() const { return SVGTests::isValid(); }
108
virtual bool supportsFocus() const { return true; }
110
bool isSupportedAttribute(const QualifiedName&);
111
virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
112
virtual void svgAttributeChanged(const QualifiedName&);
113
virtual bool supportsMarkers() const { return true; }
115
// Custom 'd' property
116
static void synchronizeD(void* contextElement);
117
static PassRefPtr<SVGAnimatedProperty> lookupOrCreateDWrapper(void* contextElement);
119
BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPathElement)
120
DECLARE_ANIMATED_NUMBER(PathLength, pathLength)
121
DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired)
122
END_DECLARE_ANIMATED_PROPERTIES
125
virtual void synchronizeRequiredFeatures() { SVGTests::synchronizeRequiredFeatures(this); }
126
virtual void synchronizeRequiredExtensions() { SVGTests::synchronizeRequiredExtensions(this); }
127
virtual void synchronizeSystemLanguage() { SVGTests::synchronizeSystemLanguage(this); }
129
RenderObject* createRenderer(RenderArena*, RenderStyle*);
131
virtual Node::InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
132
virtual void removedFrom(ContainerNode*) OVERRIDE;
134
void invalidateMPathDependencies();
137
OwnPtr<SVGPathByteStream> m_pathByteStream;
138
mutable SVGSynchronizableAnimatedProperty<SVGPathSegList> m_pathSegList;
139
bool m_isAnimValObserved;
142
} // namespace WebCore
144
#endif // ENABLE(SVG)