OSDN Git Service

Merge "Fix text-shadow style when blur is 0px"
[android-x86/external-webkit.git] / WebCore / svg / SVGPathElement.h
1 /*
2  * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3  * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4  *
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.
9  *
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.
14  *
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.
19  */
20
21 #ifndef SVGPathElement_h
22 #define SVGPathElement_h
23
24 #if ENABLE(SVG)
25 #include "SVGAnimatedPathData.h"
26 #include "SVGExternalResourcesRequired.h"
27 #include "SVGLangSpace.h"
28 #include "SVGStyledTransformableElement.h"
29 #include "SVGTests.h"
30
31 namespace WebCore {
32
33     class SVGPathSeg;
34     class SVGPathSegArcAbs;
35     class SVGPathSegArcRel;
36     class SVGPathSegClosePath;
37     class SVGPathSegLinetoAbs;
38     class SVGPathSegLinetoRel;
39     class SVGPathSegMovetoAbs;
40     class SVGPathSegMovetoRel;
41     class SVGPathSegCurvetoCubicAbs;
42     class SVGPathSegCurvetoCubicRel;
43     class SVGPathSegLinetoVerticalAbs;
44     class SVGPathSegLinetoVerticalRel;
45     class SVGPathSegLinetoHorizontalAbs;
46     class SVGPathSegLinetoHorizontalRel;
47     class SVGPathSegCurvetoQuadraticAbs;
48     class SVGPathSegCurvetoQuadraticRel;
49     class SVGPathSegCurvetoCubicSmoothAbs;
50     class SVGPathSegCurvetoCubicSmoothRel;
51     class SVGPathSegCurvetoQuadraticSmoothAbs;
52     class SVGPathSegCurvetoQuadraticSmoothRel;
53
54     class SVGPathElement : public SVGStyledTransformableElement,
55                            public SVGTests,
56                            public SVGLangSpace,
57                            public SVGExternalResourcesRequired,
58                            public SVGAnimatedPathData {
59     public:
60         static PassRefPtr<SVGPathElement> create(const QualifiedName&, Document*);
61         
62         float getTotalLength();
63         FloatPoint getPointAtLength(float distance);
64         unsigned long getPathSegAtLength(float distance);
65
66         static PassRefPtr<SVGPathSegClosePath> createSVGPathSegClosePath();
67         static PassRefPtr<SVGPathSegMovetoAbs> createSVGPathSegMovetoAbs(float x, float y);
68         static PassRefPtr<SVGPathSegMovetoRel> createSVGPathSegMovetoRel(float x, float y);
69         static PassRefPtr<SVGPathSegLinetoAbs> createSVGPathSegLinetoAbs(float x, float y);
70         static PassRefPtr<SVGPathSegLinetoRel> createSVGPathSegLinetoRel(float x, float y);
71         static PassRefPtr<SVGPathSegCurvetoCubicAbs> createSVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2);
72         static PassRefPtr<SVGPathSegCurvetoCubicRel> createSVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2);
73         static PassRefPtr<SVGPathSegCurvetoQuadraticAbs> createSVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1);
74         static PassRefPtr<SVGPathSegCurvetoQuadraticRel> createSVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1);
75         static PassRefPtr<SVGPathSegArcAbs> createSVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag);
76         static PassRefPtr<SVGPathSegArcRel> createSVGPathSegArcRel(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag);
77         static PassRefPtr<SVGPathSegLinetoHorizontalAbs> createSVGPathSegLinetoHorizontalAbs(float x);
78         static PassRefPtr<SVGPathSegLinetoHorizontalRel> createSVGPathSegLinetoHorizontalRel(float x);
79         static PassRefPtr<SVGPathSegLinetoVerticalAbs> createSVGPathSegLinetoVerticalAbs(float y);
80         static PassRefPtr<SVGPathSegLinetoVerticalRel> createSVGPathSegLinetoVerticalRel(float y);
81         static PassRefPtr<SVGPathSegCurvetoCubicSmoothAbs> createSVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2);
82         static PassRefPtr<SVGPathSegCurvetoCubicSmoothRel> createSVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2);
83         static PassRefPtr<SVGPathSegCurvetoQuadraticSmoothAbs> createSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y);
84         static PassRefPtr<SVGPathSegCurvetoQuadraticSmoothRel> createSVGPathSegCurvetoQuadraticSmoothRel(float x, float y);
85
86         // Derived from: 'SVGAnimatedPathData'
87         virtual SVGPathSegList* pathSegList() const;
88         virtual SVGPathSegList* normalizedPathSegList() const;
89         virtual SVGPathSegList* animatedPathSegList() const;
90         virtual SVGPathSegList* animatedNormalizedPathSegList() const;
91
92         virtual void toPathData(Path&) const;
93
94     private:
95         SVGPathElement(const QualifiedName&, Document*);
96
97         virtual bool isValid() const { return SVGTests::isValid(); }
98
99         virtual void parseMappedAttribute(Attribute*);
100         virtual void svgAttributeChanged(const QualifiedName&);
101         virtual void synchronizeProperty(const QualifiedName&);
102
103         virtual bool supportsMarkers() const { return true; }
104
105         mutable RefPtr<SVGPathSegList> m_pathSegList;
106
107         DECLARE_ANIMATED_PROPERTY(SVGPathElement, SVGNames::pathLengthAttr, float, PathLength, pathLength)
108
109         // SVGExternalResourcesRequired
110         DECLARE_ANIMATED_PROPERTY(SVGPathElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
111     };
112
113 } // namespace WebCore
114
115 #endif // ENABLE(SVG)
116 #endif