Chromium Code Reviews| Index: Source/core/css/parser/CSSPropertyParser.cpp |
| diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp |
| index 8708db5e2f520e111c93f0c4bf08c7aaedfef9eb..dad869c6e02ee0f4d5680b6a619bff4241710212 100644 |
| --- a/Source/core/css/parser/CSSPropertyParser.cpp |
| +++ b/Source/core/css/parser/CSSPropertyParser.cpp |
| @@ -5082,7 +5082,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; |
| @@ -5305,9 +5305,14 @@ 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) { |
| + ASSERT(value->string[0] != '#'); |
|
Timothy Loh
2015/05/22 01:05:10
I don't think this assertion is right (you can wri
|
| + 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 */ && |