1 | /* |
2 | * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
3 | * Copyright (C) 2019 Apple Inc. All rights reserved. |
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 | #pragma once |
22 | |
23 | #include "FloatPoint.h" |
24 | #include "SVGPathSeg.h" |
25 | #include "SVGPathSource.h" |
26 | #include <wtf/RefPtr.h> |
27 | |
28 | namespace WebCore { |
29 | |
30 | class SVGPathSegList; |
31 | |
32 | class SVGPathSegListSource final : public SVGPathSource { |
33 | public: |
34 | explicit SVGPathSegListSource(const SVGPathSegList&); |
35 | |
36 | private: |
37 | bool hasMoreData() const final; |
38 | bool moveToNextToken() final { return true; } |
39 | bool parseSVGSegmentType(SVGPathSegType&) final; |
40 | SVGPathSegType nextCommand(SVGPathSegType) final; |
41 | |
42 | bool parseMoveToSegment(FloatPoint&) final; |
43 | bool parseLineToSegment(FloatPoint&) final; |
44 | bool parseLineToHorizontalSegment(float&) final; |
45 | bool parseLineToVerticalSegment(float&) final; |
46 | bool parseCurveToCubicSegment(FloatPoint&, FloatPoint&, FloatPoint&) final; |
47 | bool parseCurveToCubicSmoothSegment(FloatPoint&, FloatPoint&) final; |
48 | bool parseCurveToQuadraticSegment(FloatPoint&, FloatPoint&) final; |
49 | bool parseCurveToQuadraticSmoothSegment(FloatPoint&) final; |
50 | bool parseArcToSegment(float&, float&, float&, bool&, bool&, FloatPoint&) final; |
51 | |
52 | const SVGPathSegList& m_pathSegList; |
53 | RefPtr<SVGPathSeg> m_segment; |
54 | size_t m_itemCurrent; |
55 | size_t m_itemEnd; |
56 | }; |
57 | |
58 | } // namespace WebCore |
59 | |