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

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

Issue 2366243002: Remove all ordering requirements in CSSValueKeywords.in (WIP) (Closed)
Patch Set: Some mor efixes Created 4 years, 1 month 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/css/parser/CSSPropertyParserHelpers.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
index bc5add7bbd2976607aff81c7cadeb0fe2056f918..2aaabdc236ff801477cdf1133a6b3c2984a4569f 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
@@ -486,14 +486,22 @@ static bool parseHexColor(CSSParserTokenRange& range,
return true;
}
+static bool isRGBFunctionId(CSSValueID functionId) {
+ return functionId == CSSValueRgb || functionId == CSSValueRgba;
+}
+
+static bool isHSLFunctionId(CSSValueID functionId) {
+ return functionId == CSSValueHsl || functionId == CSSValueHsla;
+}
+
static bool parseColorFunction(CSSParserTokenRange& range, RGBA32& result) {
CSSValueID functionId = range.peek().functionId();
- if (functionId < CSSValueRgb || functionId > CSSValueHsla)
+ if (!isRGBFunctionId(functionId) && !isHSLFunctionId(functionId))
return false;
CSSParserTokenRange colorRange = range;
- if ((functionId <= CSSValueRgba &&
+ if ((isRGBFunctionId(functionId) &&
!parseRGBParameters(colorRange, result, functionId == CSSValueRgba)) ||
- (functionId >= CSSValueHsl &&
+ (isHSLFunctionId(functionId) &&
!parseHSLParameters(colorRange, result, functionId == CSSValueHsla)))
return false;
range = colorRange;

Powered by Google App Engine
This is Rietveld 408576698