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

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

Issue 1151593003: Remove hexDigit check in CSSParserValueList (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove ASSERT and add subtest Created 5 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 | « Source/core/css/parser/CSSParserValues.cpp ('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/CSSPropertyParser.cpp
diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp
index 92ad1ec0ffb497ff18b4964cfd079da71c7c920a..50f5f374ad39d12fbd21a617ab4480b5719451c9 100644
--- a/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/Source/core/css/parser/CSSPropertyParser.cpp
@@ -5030,7 +5030,7 @@ static inline bool mightBeRGB(const CharacterType* characters, unsigned length)
}
template <typename CharacterType>
-static inline bool fastParseColorInternal(RGBA32& rgb, const CharacterType* characters, unsigned length , bool strict)
+static inline bool fastParseColorInternal(RGBA32& rgb, const CharacterType* characters, unsigned length, bool strict)
{
CSSPrimitiveValue::UnitType expect = CSSPrimitiveValue::CSS_UNKNOWN;
@@ -5253,9 +5253,13 @@ bool CSSPropertyParser::parseColorFromValue(CSSParserValue* value, RGBA32& c, bo
while (color.length() < 6)
color = "0" + color;
return fastParseColor(c, color, false);
- } else if (value->unit == CSSParserValue::HexColor || value->unit == CSSPrimitiveValue::CSS_IDENT) {
- if (!fastParseColor(c, value->string, !acceptQuirkyColors && value->unit == CSSPrimitiveValue::CSS_IDENT))
+ } else if (value->unit == CSSPrimitiveValue::CSS_IDENT) {
+ if (!fastParseColor(c, value->string, !acceptQuirkyColors))
return false;
+ } else if (value->unit == CSSParserValue::HexColor) {
+ if (value->string.is8Bit())
+ return Color::parseHexColor(value->string.characters8(), value->string.length(), c);
+ return Color::parseHexColor(value->string.characters16(), value->string.length(), c);
} else if (value->unit == CSSParserValue::Function &&
value->function->args != 0 &&
value->function->args->size() == 5 /* rgb + two commas */ &&
« no previous file with comments | « Source/core/css/parser/CSSParserValues.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698