1/*
2 * Copyright (C) 2019 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#pragma once
27
28#include "SVGPathSegValue.h"
29
30namespace WebCore {
31
32class SVGPathSegClosePath final : public SVGPathSeg {
33public:
34 static Ref<SVGPathSegClosePath> create() { return adoptRef(*new SVGPathSegClosePath()); }
35private:
36 using SVGPathSeg::SVGPathSeg;
37 unsigned short pathSegType() const final { return PATHSEG_CLOSEPATH; }
38 String pathSegTypeAsLetter() const final { return "Z"; }
39 Ref<SVGPathSeg> clone() const final { return adoptRef(*new SVGPathSegClosePath()); }
40};
41
42class SVGPathSegLinetoHorizontalAbs final : public SVGPathSegLinetoHorizontal {
43public:
44 constexpr static auto create = SVGPathSegValue::create<SVGPathSegLinetoHorizontalAbs>;
45private:
46 using SVGPathSegLinetoHorizontal::SVGPathSegLinetoHorizontal;
47 unsigned short pathSegType() const final { return PATHSEG_LINETO_HORIZONTAL_ABS; }
48 String pathSegTypeAsLetter() const final { return "H"; }
49 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegLinetoHorizontalAbs>(); }
50};
51
52class SVGPathSegLinetoHorizontalRel final : public SVGPathSegLinetoHorizontal {
53public:
54 constexpr static auto create = SVGPathSegValue::create<SVGPathSegLinetoHorizontalRel>;
55private:
56 using SVGPathSegLinetoHorizontal::SVGPathSegLinetoHorizontal;
57 unsigned short pathSegType() const final { return PATHSEG_LINETO_HORIZONTAL_REL; }
58 String pathSegTypeAsLetter() const final { return "h"; }
59 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegLinetoHorizontalRel>(); }
60};
61
62class SVGPathSegLinetoVerticalAbs final : public SVGPathSegLinetoVertical {
63public:
64 constexpr static auto create = SVGPathSegValue::create<SVGPathSegLinetoVerticalAbs>;
65private:
66 using SVGPathSegLinetoVertical::SVGPathSegLinetoVertical;
67 unsigned short pathSegType() const final { return PATHSEG_LINETO_VERTICAL_ABS; }
68 String pathSegTypeAsLetter() const final { return "V"; }
69 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegLinetoVerticalAbs>(); }
70};
71
72class SVGPathSegLinetoVerticalRel final : public SVGPathSegLinetoVertical {
73public:
74 constexpr static auto create = SVGPathSegValue::create<SVGPathSegLinetoVerticalRel>;
75private:
76 using SVGPathSegLinetoVertical::SVGPathSegLinetoVertical;
77 unsigned short pathSegType() const final { return PATHSEG_LINETO_VERTICAL_REL; }
78 String pathSegTypeAsLetter() const final { return "v"; }
79 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegLinetoVerticalRel>(); }
80};
81
82class SVGPathSegMovetoAbs final : public SVGPathSegSingleCoordinate {
83public:
84 constexpr static auto create = SVGPathSegValue::create<SVGPathSegMovetoAbs>;
85private:
86 using SVGPathSegSingleCoordinate::SVGPathSegSingleCoordinate;
87 unsigned short pathSegType() const final { return PATHSEG_MOVETO_ABS; }
88 String pathSegTypeAsLetter() const final { return "M"; }
89 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegMovetoAbs>(); }
90};
91
92class SVGPathSegMovetoRel final : public SVGPathSegSingleCoordinate {
93public:
94 constexpr static auto create = SVGPathSegValue::create<SVGPathSegMovetoRel>;
95private:
96 using SVGPathSegSingleCoordinate::SVGPathSegSingleCoordinate;
97 unsigned short pathSegType() const final { return PATHSEG_MOVETO_REL; }
98 String pathSegTypeAsLetter() const final { return "m"; }
99 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegMovetoRel>(); }
100};
101
102class SVGPathSegLinetoAbs final : public SVGPathSegSingleCoordinate {
103public:
104 constexpr static auto create = SVGPathSegValue::create<SVGPathSegLinetoAbs>;
105private:
106 using SVGPathSegSingleCoordinate::SVGPathSegSingleCoordinate;
107 unsigned short pathSegType() const final { return PATHSEG_LINETO_ABS; }
108 String pathSegTypeAsLetter() const final { return "L"; }
109 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegLinetoAbs>(); }
110};
111
112class SVGPathSegLinetoRel final : public SVGPathSegSingleCoordinate {
113public:
114 constexpr static auto create = SVGPathSegValue::create<SVGPathSegLinetoRel>;
115private:
116 using SVGPathSegSingleCoordinate::SVGPathSegSingleCoordinate;
117 unsigned short pathSegType() const final { return PATHSEG_LINETO_REL; }
118 String pathSegTypeAsLetter() const final { return "l"; }
119 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegLinetoRel>(); }
120};
121
122class SVGPathSegCurvetoQuadraticAbs final : public SVGPathSegCurvetoQuadratic {
123public:
124 constexpr static auto create = SVGPathSegValue::create<SVGPathSegCurvetoQuadraticAbs>;
125private:
126 using SVGPathSegCurvetoQuadratic::SVGPathSegCurvetoQuadratic;
127 unsigned short pathSegType() const final { return PATHSEG_CURVETO_QUADRATIC_ABS; }
128 String pathSegTypeAsLetter() const final { return "Q"; }
129 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegCurvetoQuadraticAbs>(); }
130};
131
132class SVGPathSegCurvetoQuadraticRel final : public SVGPathSegCurvetoQuadratic {
133public:
134 constexpr static auto create = SVGPathSegValue::create<SVGPathSegCurvetoQuadraticRel>;
135private:
136 using SVGPathSegCurvetoQuadratic::SVGPathSegCurvetoQuadratic;
137 unsigned short pathSegType() const final { return PATHSEG_CURVETO_QUADRATIC_REL; }
138 String pathSegTypeAsLetter() const final { return "q"; }
139 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegCurvetoQuadraticRel>(); }
140};
141
142class SVGPathSegCurvetoCubicAbs final : public SVGPathSegCurvetoCubic {
143public:
144 constexpr static auto create = SVGPathSegValue::create<SVGPathSegCurvetoCubicAbs>;
145private:
146 using SVGPathSegCurvetoCubic::SVGPathSegCurvetoCubic;
147 unsigned short pathSegType() const final { return PATHSEG_CURVETO_CUBIC_ABS; }
148 String pathSegTypeAsLetter() const final { return "C"; }
149 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegCurvetoCubicAbs>(); }
150};
151
152class SVGPathSegCurvetoCubicRel final : public SVGPathSegCurvetoCubic {
153public:
154 constexpr static auto create = SVGPathSegValue::create<SVGPathSegCurvetoCubicRel>;
155private:
156 using SVGPathSegCurvetoCubic::SVGPathSegCurvetoCubic;
157 unsigned short pathSegType() const final { return PATHSEG_CURVETO_CUBIC_REL; }
158 String pathSegTypeAsLetter() const final { return "c"; }
159 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegCurvetoCubicRel>(); }
160};
161
162class SVGPathSegArcAbs final : public SVGPathSegArc {
163public:
164 constexpr static auto create = SVGPathSegValue::create<SVGPathSegArcAbs>;
165private:
166 using SVGPathSegArc::SVGPathSegArc;
167 unsigned short pathSegType() const final { return PATHSEG_ARC_ABS; }
168 String pathSegTypeAsLetter() const final { return "A"; }
169 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegArcAbs>(); }
170};
171
172class SVGPathSegArcRel final : public SVGPathSegArc {
173public:
174 constexpr static auto create = SVGPathSegValue::create<SVGPathSegArcRel>;
175private:
176 using SVGPathSegArc::SVGPathSegArc;
177 unsigned short pathSegType() const final { return PATHSEG_ARC_REL; }
178 String pathSegTypeAsLetter() const final { return "a"; }
179 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegArcRel>(); }
180};
181
182class SVGPathSegCurvetoQuadraticSmoothAbs final : public SVGPathSegSingleCoordinate {
183public:
184 constexpr static auto create = SVGPathSegValue::create<SVGPathSegCurvetoQuadraticSmoothAbs>;
185private:
186 using SVGPathSegSingleCoordinate::SVGPathSegSingleCoordinate;
187 unsigned short pathSegType() const final { return PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS; }
188 String pathSegTypeAsLetter() const final { return "T"; }
189 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegCurvetoQuadraticSmoothAbs>(); }
190};
191
192class SVGPathSegCurvetoQuadraticSmoothRel final : public SVGPathSegSingleCoordinate {
193public:
194 constexpr static auto create = SVGPathSegValue::create<SVGPathSegCurvetoQuadraticSmoothRel>;
195private:
196 using SVGPathSegSingleCoordinate::SVGPathSegSingleCoordinate;
197 unsigned short pathSegType() const final { return PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL; }
198 String pathSegTypeAsLetter() const final { return "t"; }
199 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegCurvetoQuadraticSmoothRel>(); }
200};
201
202class SVGPathSegCurvetoCubicSmoothAbs final : public SVGPathSegCurvetoCubicSmooth {
203public:
204 constexpr static auto create = SVGPathSegValue::create<SVGPathSegCurvetoCubicSmoothAbs>;
205private:
206 using SVGPathSegCurvetoCubicSmooth::SVGPathSegCurvetoCubicSmooth;
207 unsigned short pathSegType() const final { return PATHSEG_CURVETO_CUBIC_SMOOTH_ABS; }
208 String pathSegTypeAsLetter() const final { return "S"; }
209 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegCurvetoCubicSmoothAbs>(); }
210};
211
212class SVGPathSegCurvetoCubicSmoothRel final : public SVGPathSegCurvetoCubicSmooth {
213public:
214 constexpr static auto create = SVGPathSegValue::create<SVGPathSegCurvetoCubicSmoothRel>;
215private:
216 using SVGPathSegCurvetoCubicSmooth::SVGPathSegCurvetoCubicSmooth;
217 unsigned short pathSegType() const final { return PATHSEG_CURVETO_CUBIC_SMOOTH_REL; }
218 String pathSegTypeAsLetter() const final { return "s"; }
219 Ref<SVGPathSeg> clone() const final { return SVGPathSegValue::clone<SVGPathSegCurvetoCubicSmoothRel>(); }
220};
221
222}
223