Index: Source/core/css/parser/CSSPropertyParser.cpp |
diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp |
index 99840173992ec605b59de9bde4dc1a70b1854375..9837f52fd0cee293a11874ee096806881f1f8768 100644 |
--- a/Source/core/css/parser/CSSPropertyParser.cpp |
+++ b/Source/core/css/parser/CSSPropertyParser.cpp |
@@ -6823,6 +6823,13 @@ bool CSSPropertyParser::parseGradientColorStops(CSSParserValueList* valueList, C |
CSSParserValue* a = valueList->current(); |
// Now look for color stops. |
+ // <color-stop-list> = [ <color-stop> , <color-hint>? ]# , <color-stop> |
+ const bool kSupportColorHints = |
f(malita)
2014/10/08 16:13:54
bool supportsColorHints = ...
(not a static const
rosca
2014/10/08 17:18:52
Done.
|
+ gradient->gradientType() == CSSLinearGradient |
+ || gradient->gradientType() == CSSRadialGradient; |
+ |
+ // The first color stop cannot be a color hint. |
+ bool previousStopWasColorHint = true; |
while (a) { |
// Look for the comma before the next stop. |
if (expectComma) { |
@@ -6835,12 +6842,18 @@ bool CSSPropertyParser::parseGradientColorStops(CSSParserValueList* valueList, C |
} |
// <color-stop> = <color> [ <percentage> | <length> ]? |
+ // <color-hint> = <length> | <percentage> |
CSSGradientColorStop stop; |
stop.m_color = parseGradientColorOrKeyword(this, a); |
- if (!stop.m_color) |
+ |
+ // Two midpoints in a row is not allowed. |
f(malita)
2014/10/08 16:13:54
// Two hints in a row are not allowed.
rosca
2014/10/08 17:18:52
Done.
|
+ if (!stop.m_color && (!kSupportColorHints || previousStopWasColorHint)) |
return false; |
+ previousStopWasColorHint = !stop.m_color; |
+ |
+ if (stop.m_color) |
+ a = valueList->next(); |
- a = valueList->next(); |
if (a) { |
if (validUnit(a, FLength | FPercent)) { |
stop.m_position = createPrimitiveNumericValue(a); |
@@ -6848,10 +6861,17 @@ bool CSSPropertyParser::parseGradientColorStops(CSSParserValueList* valueList, C |
} |
} |
+ if (!stop.m_color && !stop.m_position) |
+ return false; |
+ |
gradient->addStop(stop); |
expectComma = true; |
} |
+ // The last color stop cannot be a color hint. |
+ if (previousStopWasColorHint) |
+ return false; |
+ |
// Must have 2 or more stops to be valid. |
return gradient->stopCount() >= 2; |
} |