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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSParserFastPathsTest.cpp

Issue 2007823002: Fix whitespace handling in parseSimpleTransformList (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: only transform tests for now. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/parser/CSSParserFastPathsTest.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserFastPathsTest.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserFastPathsTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5e30abe85209123d176077892cedb16b70eab677
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserFastPathsTest.cpp
@@ -0,0 +1,55 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/css/parser/CSSParserFastPaths.h"
+
+#include "core/css/CSSPrimitiveValue.h"
+#include "core/css/CSSValueList.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace blink {
+
+TEST(CSSParserFastPathsTest, ParseTransform)
+{
+ CSSValue* value = CSSParserFastPaths::maybeParseValue(CSSPropertyTransform, "translate(5.5px, 5px)", HTMLStandardMode);
+ ASSERT_NE(nullptr, value);
+ ASSERT_TRUE(value->isValueList());
+ ASSERT_EQ("translate(5.5px, 5px)", value->cssText());
+
+ value = CSSParserFastPaths::maybeParseValue(CSSPropertyTransform, "translate3d(5px, 5px, 10.1px)", HTMLStandardMode);
+ ASSERT_NE(nullptr, value);
+ ASSERT_TRUE(value->isValueList());
+ ASSERT_EQ("translate3d(5px, 5px, 10.1px)", value->cssText());
+}
+
+TEST(CSSParserFastPathsTest, ParseComplexTransform)
+{
+ // Random whitespace is on purpose.
+ static const char* kComplexTransform =
+ "translateX(5px) "
+ "translateZ(20.5px) "
+ "translateY(10px) "
+ "scale3d(0.5, 1, 0.7) "
+ "matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) ";
+ static const char* kComplexTransformNormalized =
+ "translateX(5px) "
+ "translateZ(20.5px) "
+ "translateY(10px) "
+ "scale3d(0.5, 1, 0.7) "
+ "matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)";
+ CSSValue* value = CSSParserFastPaths::maybeParseValue(CSSPropertyTransform, kComplexTransform, HTMLStandardMode);
+ ASSERT_NE(nullptr, value);
+ ASSERT_TRUE(value->isValueList());
+ ASSERT_EQ(kComplexTransformNormalized, value->cssText());
+}
+
+TEST(CSSParserFastPathsTest, ParseTransformNotFastPath)
+{
+ CSSValue* value = CSSParserFastPaths::maybeParseValue(CSSPropertyTransform, "rotateX(1deg)", HTMLStandardMode);
+ ASSERT_EQ(nullptr, value);
+ value = CSSParserFastPaths::maybeParseValue(CSSPropertyTransform, "translateZ(1px) rotateX(1deg)", HTMLStandardMode);
+ ASSERT_EQ(nullptr, value);
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698