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

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

Issue 246833005: Allow hex-style colors to be parsed by fastParseColor in strict mode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | « no previous file | 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 4b3b4acb72fba29fb124eb6843920f22f6f6e976..7cc5f9a6fdb34e495578fb5337ecd9bd3036dbfc 100644
--- a/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/Source/core/css/parser/CSSPropertyParser.cpp
@@ -5185,14 +5185,12 @@ static inline bool fastParseColorInternal(RGBA32& rgb, const CharacterType* char
{
CSSPrimitiveValue::UnitTypes expect = CSSPrimitiveValue::CSS_UNKNOWN;
+ if (length >= 4 && characters[0] == '#')
+ return Color::parseHexColor(characters + 1, length - 1, rgb);
+
if (!strict && length >= 3) {
- if (characters[0] == '#') {
- if (Color::parseHexColor(characters + 1, length - 1, rgb))
- return true;
- } else {
- if (Color::parseHexColor(characters, length, rgb))
- return true;
- }
+ if (Color::parseHexColor(characters, length, rgb))
+ return true;
}
// Try rgba() syntax.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698