OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 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 | 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, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 */ | 19 */ |
20 | 20 |
21 #ifndef SVGPathElement_h | 21 #ifndef SVGPathElement_h |
22 #define SVGPathElement_h | 22 #define SVGPathElement_h |
23 | 23 |
24 #include "core/SVGNames.h" | 24 #include "core/SVGNames.h" |
25 #include "core/svg/SVGAnimatedBoolean.h" | |
26 #include "core/svg/SVGAnimatedNumber.h" | 25 #include "core/svg/SVGAnimatedNumber.h" |
27 #include "core/svg/SVGAnimatedPath.h" | 26 #include "core/svg/SVGAnimatedPath.h" |
28 #include "core/svg/SVGGeometryElement.h" | 27 #include "core/svg/SVGGeometryElement.h" |
29 #include "core/svg/SVGPathByteStream.h" | 28 #include "core/svg/SVGPathByteStream.h" |
30 #include "platform/heap/Handle.h" | 29 #include "platform/heap/Handle.h" |
31 | 30 |
32 namespace blink { | 31 namespace blink { |
33 | 32 |
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 final : public SVGGeometryElement { | 33 class SVGPathElement final : public SVGGeometryElement { |
55 DEFINE_WRAPPERTYPEINFO(); | 34 DEFINE_WRAPPERTYPEINFO(); |
56 public: | 35 public: |
57 DECLARE_NODE_FACTORY(SVGPathElement); | 36 DECLARE_NODE_FACTORY(SVGPathElement); |
58 | 37 |
59 Path asPath() const override; | 38 Path asPath() const override; |
60 | 39 |
61 float getTotalLength(); | 40 float getTotalLength(); |
62 PassRefPtrWillBeRawPtr<SVGPointTearOff> getPointAtLength(float distance); | 41 PassRefPtrWillBeRawPtr<SVGPointTearOff> getPointAtLength(float distance); |
63 unsigned getPathSegAtLength(float distance); | 42 unsigned getPathSegAtLength(float distance); |
64 | 43 |
65 SVGAnimatedNumber* pathLength() { return m_pathLength.get(); } | 44 SVGAnimatedNumber* pathLength() { return m_pathLength.get(); } |
66 | 45 |
67 PassRefPtrWillBeRawPtr<SVGPathSegClosePath> createSVGPathSegClosePath(); | 46 const SVGPathByteStream& pathByteStream() const { return m_path->currentValu
e()->byteStream(); } |
68 PassRefPtrWillBeRawPtr<SVGPathSegMovetoAbs> createSVGPathSegMovetoAbs(float
x, float y); | |
69 PassRefPtrWillBeRawPtr<SVGPathSegMovetoRel> createSVGPathSegMovetoRel(float
x, float y); | |
70 PassRefPtrWillBeRawPtr<SVGPathSegLinetoAbs> createSVGPathSegLinetoAbs(float
x, float y); | |
71 PassRefPtrWillBeRawPtr<SVGPathSegLinetoRel> createSVGPathSegLinetoRel(float
x, float y); | |
72 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoCubicAbs> createSVGPathSegCurvetoCub
icAbs(float x, float y, float x1, float y1, float x2, float y2); | |
73 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoCubicRel> createSVGPathSegCurvetoCub
icRel(float x, float y, float x1, float y1, float x2, float y2); | |
74 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoQuadraticAbs> createSVGPathSegCurvet
oQuadraticAbs(float x, float y, float x1, float y1); | |
75 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoQuadraticRel> createSVGPathSegCurvet
oQuadraticRel(float x, float y, float x1, float y1); | |
76 PassRefPtrWillBeRawPtr<SVGPathSegArcAbs> createSVGPathSegArcAbs(float x, flo
at y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag); | |
77 PassRefPtrWillBeRawPtr<SVGPathSegArcRel> createSVGPathSegArcRel(float x, flo
at y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag); | |
78 PassRefPtrWillBeRawPtr<SVGPathSegLinetoHorizontalAbs> createSVGPathSegLineto
HorizontalAbs(float x); | |
79 PassRefPtrWillBeRawPtr<SVGPathSegLinetoHorizontalRel> createSVGPathSegLineto
HorizontalRel(float x); | |
80 PassRefPtrWillBeRawPtr<SVGPathSegLinetoVerticalAbs> createSVGPathSegLinetoVe
rticalAbs(float y); | |
81 PassRefPtrWillBeRawPtr<SVGPathSegLinetoVerticalRel> createSVGPathSegLinetoVe
rticalRel(float y); | |
82 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoCubicSmoothAbs> createSVGPathSegCurv
etoCubicSmoothAbs(float x, float y, float x2, float y2); | |
83 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoCubicSmoothRel> createSVGPathSegCurv
etoCubicSmoothRel(float x, float y, float x2, float y2); | |
84 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoQuadraticSmoothAbs> createSVGPathSeg
CurvetoQuadraticSmoothAbs(float x, float y); | |
85 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoQuadraticSmoothRel> createSVGPathSeg
CurvetoQuadraticSmoothRel(float x, float y); | |
86 | |
87 // Used in the bindings only. | |
88 SVGPathSegListTearOff* pathSegList() { return m_pathSegList->baseVal(); } | |
89 SVGPathSegListTearOff* animatedPathSegList() { return m_pathSegList->animVal
(); } | |
90 | |
91 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normaliz
ed path segment lists! | |
92 SVGPathSegListTearOff* normalizedPathSegList() { return nullptr; } | |
93 SVGPathSegListTearOff* animatedNormalizedPathSegList() { return nullptr; } | |
94 | |
95 const SVGPathByteStream& pathByteStream() const { return m_pathSegList->curr
entValue()->byteStream(); } | |
96 | |
97 void pathSegListChanged(ListModification = ListModificationUnknown); | |
98 | 47 |
99 DECLARE_VIRTUAL_TRACE(); | 48 DECLARE_VIRTUAL_TRACE(); |
100 | 49 |
101 private: | 50 private: |
102 explicit SVGPathElement(Document&); | 51 explicit SVGPathElement(Document&); |
103 | 52 |
104 void svgAttributeChanged(const QualifiedName&) override; | 53 void svgAttributeChanged(const QualifiedName&) override; |
105 | 54 |
106 Node::InsertionNotificationRequest insertedInto(ContainerNode*) override; | 55 Node::InsertionNotificationRequest insertedInto(ContainerNode*) override; |
107 void removedFrom(ContainerNode*) override; | 56 void removedFrom(ContainerNode*) override; |
108 | 57 |
109 void invalidateMPathDependencies(); | 58 void invalidateMPathDependencies(); |
110 | 59 |
111 RefPtrWillBeMember<SVGAnimatedNumber> m_pathLength; | 60 RefPtrWillBeMember<SVGAnimatedNumber> m_pathLength; |
112 RefPtrWillBeMember<SVGAnimatedPath> m_pathSegList; | 61 RefPtrWillBeMember<SVGAnimatedPath> m_path; |
113 }; | 62 }; |
114 | 63 |
115 } // namespace blink | 64 } // namespace blink |
116 | 65 |
117 #endif // SVGPathElement_h | 66 #endif // SVGPathElement_h |
OLD | NEW |