From 442ba161eeec7baf163c940680fee21ca42f2d91 Mon Sep 17 00:00:00 2001 From: "rob.buis@samsung.com" Date: Wed, 18 Feb 2015 01:10:54 +0000 Subject: [PATCH] Combine two validUnit calls It is less and more efficient code to just combine the flags and call validUnit once. BUG=404023 Review URL: https://codereview.chromium.org/920553002 git-svn-id: svn://svn.chromium.org/blink/trunk@190374 bbb929c8-8fbe-4397-9dbb-9b2b20218538 --- third_party/WebKit/LayoutTests/css3/calc/calc-numbers-expected.txt | 1 + third_party/WebKit/LayoutTests/css3/calc/calc-numbers.html | 6 ++++++ third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp | 7 ++----- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/third_party/WebKit/LayoutTests/css3/calc/calc-numbers-expected.txt b/third_party/WebKit/LayoutTests/css3/calc/calc-numbers-expected.txt index 48ffef0768c9..77cd938c9884 100644 --- a/third_party/WebKit/LayoutTests/css3/calc/calc-numbers-expected.txt +++ b/third_party/WebKit/LayoutTests/css3/calc/calc-numbers-expected.txt @@ -3,6 +3,7 @@ PASS getComputedValue(".int-non-neg-invalid", "tabSize") is "12345" PASS Number(getComputedValue(".float", "opacity")) is within 0.0001 of 0.5 PASS getComputedValue(".float-invalid", "tabSize") is "12345" PASS Number(getComputedValue(".px-invalid", "opacity")) is within 0.0001 of 0.9 +PASS getComputedValue(".num-length-invalid", "tabSize") is "12345" PASS successfullyParsed is true TEST COMPLETE diff --git a/third_party/WebKit/LayoutTests/css3/calc/calc-numbers.html b/third_party/WebKit/LayoutTests/css3/calc/calc-numbers.html index 587becd5e86a..1bb61ed0e426 100644 --- a/third_party/WebKit/LayoutTests/css3/calc/calc-numbers.html +++ b/third_party/WebKit/LayoutTests/css3/calc/calc-numbers.html @@ -18,12 +18,17 @@ opacity: 0.9; opacity: calc((2 / 4) * 1px); } +.num-length-invalid { + tab-size: 12345; + tab-size: calc(1 + 1px); +}
+
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp index e81d7a23241e..e70d834aea28 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp @@ -1020,11 +1020,8 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important) return true; } case CSSPropertyTabSize: - // May be specified as a unit-less non-negative integer indicating number of space characters... - validPrimitive = validUnit(value, FInteger | FNonNeg); - // ... or as a Length. - if (!validPrimitive) - validPrimitive = validUnit(value, FLength | FNonNeg); + // May be specified as a unit-less non-negative integer or length indicating number of space characters. + validPrimitive = validUnit(value, FInteger | FLength | FNonNeg); break; case CSSPropertyBorderRadius: case CSSPropertyWebkitBorderRadius: -- 2.11.4.GIT