1/*
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) 2019 Apple Inc. All rights reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
21
22#pragma once
23
24#include "SVGProperty.h"
25#include <wtf/text/WTFString.h>
26
27namespace WebCore {
28
29enum SVGPathSegType {
30 PathSegUnknown = 0,
31 PathSegClosePath = 1,
32 PathSegMoveToAbs = 2,
33 PathSegMoveToRel = 3,
34 PathSegLineToAbs = 4,
35 PathSegLineToRel = 5,
36 PathSegCurveToCubicAbs = 6,
37 PathSegCurveToCubicRel = 7,
38 PathSegCurveToQuadraticAbs = 8,
39 PathSegCurveToQuadraticRel = 9,
40 PathSegArcAbs = 10,
41 PathSegArcRel = 11,
42 PathSegLineToHorizontalAbs = 12,
43 PathSegLineToHorizontalRel = 13,
44 PathSegLineToVerticalAbs = 14,
45 PathSegLineToVerticalRel = 15,
46 PathSegCurveToCubicSmoothAbs = 16,
47 PathSegCurveToCubicSmoothRel = 17,
48 PathSegCurveToQuadraticSmoothAbs = 18,
49 PathSegCurveToQuadraticSmoothRel = 19
50};
51
52class SVGPathSeg : public SVGProperty {
53public:
54 virtual ~SVGPathSeg() = default;
55
56 // Forward declare these enums in the w3c naming scheme, for IDL generation
57 enum {
58 PATHSEG_UNKNOWN = PathSegUnknown,
59 PATHSEG_CLOSEPATH = PathSegClosePath,
60 PATHSEG_MOVETO_ABS = PathSegMoveToAbs,
61 PATHSEG_MOVETO_REL = PathSegMoveToRel,
62 PATHSEG_LINETO_ABS = PathSegLineToAbs,
63 PATHSEG_LINETO_REL = PathSegLineToRel,
64 PATHSEG_CURVETO_CUBIC_ABS = PathSegCurveToCubicAbs,
65 PATHSEG_CURVETO_CUBIC_REL = PathSegCurveToCubicRel,
66 PATHSEG_CURVETO_QUADRATIC_ABS = PathSegCurveToQuadraticAbs,
67 PATHSEG_CURVETO_QUADRATIC_REL = PathSegCurveToQuadraticRel,
68 PATHSEG_ARC_ABS = PathSegArcAbs,
69 PATHSEG_ARC_REL = PathSegArcRel,
70 PATHSEG_LINETO_HORIZONTAL_ABS = PathSegLineToHorizontalAbs,
71 PATHSEG_LINETO_HORIZONTAL_REL = PathSegLineToHorizontalRel,
72 PATHSEG_LINETO_VERTICAL_ABS = PathSegLineToVerticalAbs,
73 PATHSEG_LINETO_VERTICAL_REL = PathSegLineToVerticalRel,
74 PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = PathSegCurveToCubicSmoothAbs,
75 PATHSEG_CURVETO_CUBIC_SMOOTH_REL = PathSegCurveToCubicSmoothRel,
76 PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = PathSegCurveToQuadraticSmoothAbs,
77 PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = PathSegCurveToQuadraticSmoothRel
78 };
79
80 virtual unsigned short pathSegType() const = 0;
81 virtual String pathSegTypeAsLetter() const = 0;
82 virtual Ref<SVGPathSeg> clone() const = 0;
83
84protected:
85 using SVGProperty::SVGProperty;
86};
87
88} // namespace WebCore
89