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

Side by Side 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, 6 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
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/css/parser/CSSParserFastPaths.h"
6
7 #include "core/css/CSSPrimitiveValue.h"
8 #include "core/css/CSSValueList.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace blink {
12
13 TEST(CSSParserFastPathsTest, ParseTransform)
14 {
15 CSSValue* value = CSSParserFastPaths::maybeParseValue(CSSPropertyTransform, "translate(5.5px, 5px)", HTMLStandardMode);
16 ASSERT_NE(nullptr, value);
17 ASSERT_TRUE(value->isValueList());
18 ASSERT_EQ("translate(5.5px, 5px)", value->cssText());
19
20 value = CSSParserFastPaths::maybeParseValue(CSSPropertyTransform, "translate 3d(5px, 5px, 10.1px)", HTMLStandardMode);
21 ASSERT_NE(nullptr, value);
22 ASSERT_TRUE(value->isValueList());
23 ASSERT_EQ("translate3d(5px, 5px, 10.1px)", value->cssText());
24 }
25
26 TEST(CSSParserFastPathsTest, ParseComplexTransform)
27 {
28 // Random whitespace is on purpose.
29 static const char* kComplexTransform =
30 "translateX(5px) "
31 "translateZ(20.5px) "
32 "translateY(10px) "
33 "scale3d(0.5, 1, 0.7) "
34 "matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) ";
35 static const char* kComplexTransformNormalized =
36 "translateX(5px) "
37 "translateZ(20.5px) "
38 "translateY(10px) "
39 "scale3d(0.5, 1, 0.7) "
40 "matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)";
41 CSSValue* value = CSSParserFastPaths::maybeParseValue(CSSPropertyTransform, kComplexTransform, HTMLStandardMode);
42 ASSERT_NE(nullptr, value);
43 ASSERT_TRUE(value->isValueList());
44 ASSERT_EQ(kComplexTransformNormalized, value->cssText());
45 }
46
47 TEST(CSSParserFastPathsTest, ParseTransformNotFastPath)
48 {
49 CSSValue* value = CSSParserFastPaths::maybeParseValue(CSSPropertyTransform, "rotateX(1deg)", HTMLStandardMode);
50 ASSERT_EQ(nullptr, value);
51 value = CSSParserFastPaths::maybeParseValue(CSSPropertyTransform, "translate Z(1px) rotateX(1deg)", HTMLStandardMode);
52 ASSERT_EQ(nullptr, value);
53 }
54
55 } // namespace blink
OLDNEW
« 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