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 3d678d73a50c6ba9d7abf3f442380782b632241d..75c8d85484e7599fb680799ea2d9e743f5a1f75f 100644 |
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp |
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp |
@@ -404,7 +404,9 @@ static bool parseHexColor(CSSParserTokenRange& range, RGBA32& result, bool accep |
{ |
const CSSParserToken& token = range.peek(); |
String color; |
- if (acceptQuirkyColors) { |
+ if (token.type() == HashToken) { |
+ color = token.value(); |
+ } else if (acceptQuirkyColors) { |
if (token.type() == NumberToken || token.type() == DimensionToken) { |
if (token.numericValueType() != IntegerValueType |
|| token.numericValue() < 0. || token.numericValue() >= 1000000.) |
@@ -416,14 +418,12 @@ static bool parseHexColor(CSSParserTokenRange& range, RGBA32& result, bool accep |
while (color.length() < 6) |
color = "0" + color; |
} else if (token.type() == IdentToken) { // e.g. FF0000 |
- unsigned length = token.value().length(); |
- if (length != 3 && length != 6) |
- return false; |
color = token.value(); |
} |
+ unsigned length = color.length(); |
+ if (length != 3 && length != 6) |
+ return false; |
} |
- if (token.type() == HashToken) |
- color = token.value(); |
if (!Color::parseHexColor(color, result)) |
return false; |
range.consumeIncludingWhitespace(); |