| 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 | |
| 30 | namespace WebCore { |
| 31 | |
| 32 | class SVGPathSegClosePath final : public SVGPathSeg { |
| 33 | public: |
| 34 | static Ref<SVGPathSegClosePath> create() { return adoptRef(*new SVGPathSegClosePath()); } |
| 35 | private: |
| 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 | |
| 42 | class SVGPathSegLinetoHorizontalAbs final : public SVGPathSegLinetoHorizontal { |
| 43 | public: |
| 44 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegLinetoHorizontalAbs>; |
| 45 | private: |
| 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 | |
| 52 | class SVGPathSegLinetoHorizontalRel final : public SVGPathSegLinetoHorizontal { |
| 53 | public: |
| 54 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegLinetoHorizontalRel>; |
| 55 | private: |
| 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 | |
| 62 | class SVGPathSegLinetoVerticalAbs final : public SVGPathSegLinetoVertical { |
| 63 | public: |
| 64 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegLinetoVerticalAbs>; |
| 65 | private: |
| 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 | |
| 72 | class SVGPathSegLinetoVerticalRel final : public SVGPathSegLinetoVertical { |
| 73 | public: |
| 74 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegLinetoVerticalRel>; |
| 75 | private: |
| 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 | |
| 82 | class SVGPathSegMovetoAbs final : public SVGPathSegSingleCoordinate { |
| 83 | public: |
| 84 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegMovetoAbs>; |
| 85 | private: |
| 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 | |
| 92 | class SVGPathSegMovetoRel final : public SVGPathSegSingleCoordinate { |
| 93 | public: |
| 94 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegMovetoRel>; |
| 95 | private: |
| 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 | |
| 102 | class SVGPathSegLinetoAbs final : public SVGPathSegSingleCoordinate { |
| 103 | public: |
| 104 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegLinetoAbs>; |
| 105 | private: |
| 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 | |
| 112 | class SVGPathSegLinetoRel final : public SVGPathSegSingleCoordinate { |
| 113 | public: |
| 114 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegLinetoRel>; |
| 115 | private: |
| 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 | |
| 122 | class SVGPathSegCurvetoQuadraticAbs final : public SVGPathSegCurvetoQuadratic { |
| 123 | public: |
| 124 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegCurvetoQuadraticAbs>; |
| 125 | private: |
| 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 | |
| 132 | class SVGPathSegCurvetoQuadraticRel final : public SVGPathSegCurvetoQuadratic { |
| 133 | public: |
| 134 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegCurvetoQuadraticRel>; |
| 135 | private: |
| 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 | |
| 142 | class SVGPathSegCurvetoCubicAbs final : public SVGPathSegCurvetoCubic { |
| 143 | public: |
| 144 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegCurvetoCubicAbs>; |
| 145 | private: |
| 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 | |
| 152 | class SVGPathSegCurvetoCubicRel final : public SVGPathSegCurvetoCubic { |
| 153 | public: |
| 154 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegCurvetoCubicRel>; |
| 155 | private: |
| 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 | |
| 162 | class SVGPathSegArcAbs final : public SVGPathSegArc { |
| 163 | public: |
| 164 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegArcAbs>; |
| 165 | private: |
| 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 | |
| 172 | class SVGPathSegArcRel final : public SVGPathSegArc { |
| 173 | public: |
| 174 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegArcRel>; |
| 175 | private: |
| 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 | |
| 182 | class SVGPathSegCurvetoQuadraticSmoothAbs final : public SVGPathSegSingleCoordinate { |
| 183 | public: |
| 184 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegCurvetoQuadraticSmoothAbs>; |
| 185 | private: |
| 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 | |
| 192 | class SVGPathSegCurvetoQuadraticSmoothRel final : public SVGPathSegSingleCoordinate { |
| 193 | public: |
| 194 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegCurvetoQuadraticSmoothRel>; |
| 195 | private: |
| 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 | |
| 202 | class SVGPathSegCurvetoCubicSmoothAbs final : public SVGPathSegCurvetoCubicSmooth { |
| 203 | public: |
| 204 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegCurvetoCubicSmoothAbs>; |
| 205 | private: |
| 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 | |
| 212 | class SVGPathSegCurvetoCubicSmoothRel final : public SVGPathSegCurvetoCubicSmooth { |
| 213 | public: |
| 214 | constexpr static auto create = SVGPathSegValue::create<SVGPathSegCurvetoCubicSmoothRel>; |
| 215 | private: |
| 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 | |