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

Unified Diff: third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp

Issue 1527993002: Tidy up SVGParserUtilities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Extra math for Android. Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp b/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp
index 5cb58a395ef3050e5021165aa99f2f842f80fe3b..6cc52916f27db6465c7e45f81a181fb55d1bb6d0 100644
--- a/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp
@@ -23,11 +23,7 @@
#include "config.h"
#include "core/svg/SVGParserUtilities.h"
-#include "core/svg/SVGPointList.h"
-#include "platform/geometry/FloatRect.h"
-#include "platform/transforms/AffineTransform.h"
-#include "wtf/ASCIICType.h"
-#include "wtf/text/StringHash.h"
+#include "wtf/MathExtras.h"
#include <limits>
namespace blink {
@@ -251,58 +247,4 @@ bool parseNumberOrPercentage(const String& string, float& number)
return genericParseNumberOrPercentage(ptr, end, number);
}
-static const LChar skewXDesc[] = {'s', 'k', 'e', 'w', 'X'};
-static const LChar skewYDesc[] = {'s', 'k', 'e', 'w', 'Y'};
-static const LChar scaleDesc[] = {'s', 'c', 'a', 'l', 'e'};
-static const LChar translateDesc[] = {'t', 'r', 'a', 'n', 's', 'l', 'a', 't', 'e'};
-static const LChar rotateDesc[] = {'r', 'o', 't', 'a', 't', 'e'};
-static const LChar matrixDesc[] = {'m', 'a', 't', 'r', 'i', 'x'};
-
-template<typename CharType>
-bool parseAndSkipTransformType(const CharType*& ptr, const CharType* end, SVGTransformType& type)
-{
- if (ptr >= end)
- return false;
-
- if (*ptr == 's') {
- if (skipString(ptr, end, skewXDesc, WTF_ARRAY_LENGTH(skewXDesc)))
- type = SVG_TRANSFORM_SKEWX;
- else if (skipString(ptr, end, skewYDesc, WTF_ARRAY_LENGTH(skewYDesc)))
- type = SVG_TRANSFORM_SKEWY;
- else if (skipString(ptr, end, scaleDesc, WTF_ARRAY_LENGTH(scaleDesc)))
- type = SVG_TRANSFORM_SCALE;
- else
- return false;
- } else if (skipString(ptr, end, translateDesc, WTF_ARRAY_LENGTH(translateDesc)))
- type = SVG_TRANSFORM_TRANSLATE;
- else if (skipString(ptr, end, rotateDesc, WTF_ARRAY_LENGTH(rotateDesc)))
- type = SVG_TRANSFORM_ROTATE;
- else if (skipString(ptr, end, matrixDesc, WTF_ARRAY_LENGTH(matrixDesc)))
- type = SVG_TRANSFORM_MATRIX;
- else
- return false;
-
- return true;
-}
-
-template bool parseAndSkipTransformType(const UChar*& current, const UChar* end, SVGTransformType&);
-template bool parseAndSkipTransformType(const LChar*& current, const LChar* end, SVGTransformType&);
-
-SVGTransformType parseTransformType(const String& string)
-{
- if (string.isEmpty())
- return SVG_TRANSFORM_UNKNOWN;
- SVGTransformType type = SVG_TRANSFORM_UNKNOWN;
- if (string.is8Bit()) {
- const LChar* ptr = string.characters8();
- const LChar* end = ptr + string.length();
- parseAndSkipTransformType(ptr, end, type);
- } else {
- const UChar* ptr = string.characters16();
- const UChar* end = ptr + string.length();
- parseAndSkipTransformType(ptr, end, type);
- }
- return type;
-}
-
}
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGParserUtilities.h ('k') | third_party/WebKit/Source/core/svg/SVGPreserveAspectRatio.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698