Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGTransformList.cpp

Issue 2176623003: Remove platform/text/ParserUtilities.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove from blink_platform.gypi Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 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 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2008 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2012. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2012. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 16 * Library General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Library General Public License 18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to 19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 */ 22 */
23 23
24 #include "core/svg/SVGTransformList.h" 24 #include "core/svg/SVGTransformList.h"
25 25
26 #include "core/SVGNames.h" 26 #include "core/SVGNames.h"
27 #include "core/svg/SVGParserUtilities.h" 27 #include "core/svg/SVGParserUtilities.h"
28 #include "core/svg/SVGTransformDistance.h" 28 #include "core/svg/SVGTransformDistance.h"
29 #include "platform/text/ParserUtilities.h" 29 #include "platform/ParsingUtilities.h"
30 #include "wtf/text/StringBuilder.h" 30 #include "wtf/text/StringBuilder.h"
31 #include "wtf/text/WTFString.h" 31 #include "wtf/text/WTFString.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 SVGTransformList::SVGTransformList() 35 SVGTransformList::SVGTransformList()
36 { 36 {
37 } 37 }
38 38
39 SVGTransformList::~SVGTransformList() 39 SVGTransformList::~SVGTransformList()
(...skipping 17 matching lines...) Expand all
57 ConstIterator it = begin(); 57 ConstIterator it = begin();
58 ConstIterator itEnd = end(); 58 ConstIterator itEnd = end();
59 for (; it != itEnd; ++it) 59 for (; it != itEnd; ++it)
60 result *= it->matrix(); 60 result *= it->matrix();
61 61
62 return true; 62 return true;
63 } 63 }
64 64
65 namespace { 65 namespace {
66 66
67 const LChar skewXDesc[] = {'s', 'k', 'e', 'w', 'X'};
68 const LChar skewYDesc[] = {'s', 'k', 'e', 'w', 'Y'};
69 const LChar scaleDesc[] = {'s', 'c', 'a', 'l', 'e'};
70 const LChar translateDesc[] = {'t', 'r', 'a', 'n', 's', 'l', 'a', 't', 'e'};
71 const LChar rotateDesc[] = {'r', 'o', 't', 'a', 't', 'e'};
72 const LChar matrixDesc[] = {'m', 'a', 't', 'r', 'i', 'x'};
73
74 template<typename CharType> 67 template<typename CharType>
75 SVGTransformType parseAndSkipTransformType(const CharType*& ptr, const CharType* end) 68 SVGTransformType parseAndSkipTransformType(const CharType*& ptr, const CharType* end)
76 { 69 {
77 if (ptr >= end) 70 if (ptr >= end)
78 return SVG_TRANSFORM_UNKNOWN; 71 return SVG_TRANSFORM_UNKNOWN;
79 72
80 if (*ptr == 's') { 73 if (*ptr == 's') {
81 if (skipString(ptr, end, skewXDesc, WTF_ARRAY_LENGTH(skewXDesc))) 74 if (skipToken(ptr, end, "skewX"))
82 return SVG_TRANSFORM_SKEWX; 75 return SVG_TRANSFORM_SKEWX;
83 if (skipString(ptr, end, skewYDesc, WTF_ARRAY_LENGTH(skewYDesc))) 76 if (skipToken(ptr, end, "skewY"))
84 return SVG_TRANSFORM_SKEWY; 77 return SVG_TRANSFORM_SKEWY;
85 if (skipString(ptr, end, scaleDesc, WTF_ARRAY_LENGTH(scaleDesc))) 78 if (skipToken(ptr, end, "scale"))
86 return SVG_TRANSFORM_SCALE; 79 return SVG_TRANSFORM_SCALE;
87 80
88 return SVG_TRANSFORM_UNKNOWN; 81 return SVG_TRANSFORM_UNKNOWN;
89 } 82 }
90 if (skipString(ptr, end, translateDesc, WTF_ARRAY_LENGTH(translateDesc))) 83 if (skipToken(ptr, end, "translate"))
91 return SVG_TRANSFORM_TRANSLATE; 84 return SVG_TRANSFORM_TRANSLATE;
92 if (skipString(ptr, end, rotateDesc, WTF_ARRAY_LENGTH(rotateDesc))) 85 if (skipToken(ptr, end, "rotate"))
93 return SVG_TRANSFORM_ROTATE; 86 return SVG_TRANSFORM_ROTATE;
94 if (skipString(ptr, end, matrixDesc, WTF_ARRAY_LENGTH(matrixDesc))) 87 if (skipToken(ptr, end, "matrix"))
95 return SVG_TRANSFORM_MATRIX; 88 return SVG_TRANSFORM_MATRIX;
96 89
97 return SVG_TRANSFORM_UNKNOWN; 90 return SVG_TRANSFORM_UNKNOWN;
98 } 91 }
99 92
100 // These should be kept in sync with enum SVGTransformType 93 // These should be kept in sync with enum SVGTransformType
101 const unsigned requiredValuesForType[] = {0, 6, 1, 1, 1, 1, 1}; 94 const unsigned requiredValuesForType[] = {0, 6, 1, 1, 1, 1, 1};
102 const unsigned optionalValuesForType[] = {0, 0, 1, 1, 2, 0, 0}; 95 const unsigned optionalValuesForType[] = {0, 0, 1, 1, 2, 0, 0};
103 static_assert(SVG_TRANSFORM_UNKNOWN == 0, "index of SVG_TRANSFORM_UNKNOWN has ch anged"); 96 static_assert(SVG_TRANSFORM_UNKNOWN == 0, "index of SVG_TRANSFORM_UNKNOWN has ch anged");
104 static_assert(SVG_TRANSFORM_MATRIX == 1, "index of SVG_TRANSFORM_MATRIX has chan ged"); 97 static_assert(SVG_TRANSFORM_MATRIX == 1, "index of SVG_TRANSFORM_MATRIX has chan ged");
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 if (at(0)->transformType() == toList->at(0)->transformType()) 391 if (at(0)->transformType() == toList->at(0)->transformType())
399 return -1; 392 return -1;
400 393
401 // Spec: http://www.w3.org/TR/SVG/animate.html#complexDistances 394 // Spec: http://www.w3.org/TR/SVG/animate.html#complexDistances
402 // Paced animations assume a notion of distance between the various animatio n values defined by the 'to', 'from', 'by' and 'values' attributes. 395 // Paced animations assume a notion of distance between the various animatio n values defined by the 'to', 'from', 'by' and 'values' attributes.
403 // Distance is defined only for scalar types (such as <length>), colors and the subset of transformation types that are supported by 'animateTransform'. 396 // Distance is defined only for scalar types (such as <length>), colors and the subset of transformation types that are supported by 'animateTransform'.
404 return SVGTransformDistance(at(0), toList->at(0)).distance(); 397 return SVGTransformDistance(at(0), toList->at(0)).distance();
405 } 398 }
406 399
407 } // namespace blink 400 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPreserveAspectRatio.cpp ('k') | third_party/WebKit/Source/core/svg/SVGViewSpec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698