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

Unified Diff: Source/core/css/parser/CSSParserFastPaths.cpp

Issue 1235943002: Align color keyword handling in CSSParserFastPaths with CSSPropertyParser (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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 | « Source/core/css/parser/CSSParserFastPaths.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/parser/CSSParserFastPaths.cpp
diff --git a/Source/core/css/parser/CSSParserFastPaths.cpp b/Source/core/css/parser/CSSParserFastPaths.cpp
index 83d290a3eaf83ff7eb2fbea7ac560ed83a94e22d..e22118082e69ab8bf006b3f40bf2d5c2d4fe7ded 100644
--- a/Source/core/css/parser/CSSParserFastPaths.cpp
+++ b/Source/core/css/parser/CSSParserFastPaths.cpp
@@ -428,18 +428,20 @@ static bool fastParseColorInternal(RGBA32& rgb, const CharacterType* characters,
return false;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSParserFastPaths::parseColor(const String& string, bool quirksMode)
+PassRefPtrWillBeRawPtr<CSSValue> CSSParserFastPaths::parseColor(const String& string, CSSParserMode parserMode)
{
ASSERT(!string.isEmpty());
CSSParserString cssString;
cssString.init(string);
CSSValueID valueID = cssValueKeywordID(cssString);
- if (valueID == CSSValueCurrentcolor || valueID == CSSValueGrey
- || (valueID >= CSSValueAqua && valueID <= CSSValueWindowtext) || valueID == CSSValueMenu
- || (quirksMode && valueID >= CSSValueWebkitFocusRingColor && valueID <= CSSValueWebkitText))
+ if (CSSPropertyParser::isColorKeyword(valueID)) {
+ if (!isValueAllowedInMode(valueID, parserMode))
fs 2015/07/13 13:59:28 Could also just have picked HTMLStandardMode/HTMLQ
+ return nullptr;
return cssValuePool().createIdentifierValue(valueID);
+ }
RGBA32 color;
+ bool quirksMode = isQuirksModeBehavior(parserMode);
// Fast path for hex colors and rgb()/rgba() colors
bool parseResult;
@@ -947,7 +949,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSParserFastPaths::maybeParseValue(CSSProperty
if (RefPtrWillBeRawPtr<CSSValue> length = parseSimpleLengthValue(propertyID, string, parserMode))
return length.release();
if (isColorPropertyID(propertyID))
- return parseColor(string, isQuirksModeBehavior(parserMode));
+ return parseColor(string, parserMode);
if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, string))
return keyword.release();
if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID, string))
« no previous file with comments | « Source/core/css/parser/CSSParserFastPaths.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698