~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/WebCore/svg/SVGPathElement.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 "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"
 
32
#include "SVGTests.h"
 
33
 
 
34
namespace WebCore {
 
35
 
 
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;
 
56
 
 
57
class SVGPathElement : public SVGStyledTransformableElement,
 
58
                       public SVGTests,
 
59
                       public SVGLangSpace,
 
60
                       public SVGExternalResourcesRequired {
 
61
public:
 
62
    static PassRefPtr<SVGPathElement> create(const QualifiedName&, Document*);
 
63
    
 
64
    float getTotalLength();
 
65
    FloatPoint getPointAtLength(float distance);
 
66
    unsigned getPathSegAtLength(float distance);
 
67
 
 
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);
 
87
 
 
88
    // Used in the bindings only.
 
89
    SVGPathSegListPropertyTearOff* pathSegList();
 
90
    SVGPathSegListPropertyTearOff* animatedPathSegList();
 
91
    SVGPathSegListPropertyTearOff* normalizedPathSegList();
 
92
    SVGPathSegListPropertyTearOff* animatedNormalizedPathSegList();
 
93
 
 
94
    SVGPathByteStream* pathByteStream() const;
 
95
 
 
96
    void pathSegListChanged(SVGPathSegRole, ListModification = ListModificationUnknown);
 
97
 
 
98
    virtual FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate);
 
99
 
 
100
    static const SVGPropertyInfo* dPropertyInfo();
 
101
 
 
102
    bool isAnimValObserved() const { return m_isAnimValObserved; }
 
103
 
 
104
private:
 
105
    SVGPathElement(const QualifiedName&, Document*);
 
106
 
 
107
    virtual bool isValid() const { return SVGTests::isValid(); }
 
108
    virtual bool supportsFocus() const { return true; }
 
109
 
 
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; }
 
114
 
 
115
    // Custom 'd' property
 
116
    static void synchronizeD(void* contextElement);
 
117
    static PassRefPtr<SVGAnimatedProperty> lookupOrCreateDWrapper(void* contextElement);
 
118
 
 
119
    BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPathElement)
 
120
        DECLARE_ANIMATED_NUMBER(PathLength, pathLength)
 
121
        DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired)
 
122
    END_DECLARE_ANIMATED_PROPERTIES
 
123
 
 
124
    // SVGTests
 
125
    virtual void synchronizeRequiredFeatures() { SVGTests::synchronizeRequiredFeatures(this); }
 
126
    virtual void synchronizeRequiredExtensions() { SVGTests::synchronizeRequiredExtensions(this); }
 
127
    virtual void synchronizeSystemLanguage() { SVGTests::synchronizeSystemLanguage(this); }
 
128
 
 
129
    RenderObject* createRenderer(RenderArena*, RenderStyle*);
 
130
 
 
131
    virtual Node::InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
 
132
    virtual void removedFrom(ContainerNode*) OVERRIDE;
 
133
 
 
134
    void invalidateMPathDependencies();
 
135
 
 
136
private:
 
137
    OwnPtr<SVGPathByteStream> m_pathByteStream;
 
138
    mutable SVGSynchronizableAnimatedProperty<SVGPathSegList> m_pathSegList;
 
139
    bool m_isAnimValObserved;
 
140
};
 
141
 
 
142
} // namespace WebCore
 
143
 
 
144
#endif // ENABLE(SVG)
 
145
#endif