Bug 752187 - Part 1: Separate color stops parsing. r=dbaron

This commit is contained in:
Masatoshi Kimura 2012-07-07 10:27:07 -04:00
parent 8e1f1321e9
commit 43403583e2

View File

@ -574,6 +574,8 @@ protected:
bool ParseColorStop(nsCSSValueGradient* aGradient);
bool ParseGradient(nsCSSValue& aValue, bool aIsRadial,
bool aIsRepeating);
bool ParseGradientColorStops(nsCSSValueGradient* aGradient,
nsCSSValue& aValue);
void SetParsingCompoundProperty(bool aBool) {
mParsingCompoundProperty = aBool;
@ -5127,17 +5129,24 @@ CSSParserImpl::ParseGradient(nsCSSValue& aValue, bool aIsRadial,
}
}
return ParseGradientColorStops(cssGradient, aValue);
}
bool
CSSParserImpl::ParseGradientColorStops(nsCSSValueGradient* aGradient,
nsCSSValue& aValue)
{
// At least two color stops are required
if (!ParseColorStop(cssGradient) ||
if (!ParseColorStop(aGradient) ||
!ExpectSymbol(',', true) ||
!ParseColorStop(cssGradient)) {
!ParseColorStop(aGradient)) {
SkipUntil(')');
return false;
}
// Additional color stops
while (ExpectSymbol(',', true)) {
if (!ParseColorStop(cssGradient)) {
if (!ParseColorStop(aGradient)) {
SkipUntil(')');
return false;
}
@ -5148,7 +5157,7 @@ CSSParserImpl::ParseGradient(nsCSSValue& aValue, bool aIsRadial,
return false;
}
aValue.SetGradientValue(cssGradient);
aValue.SetGradientValue(aGradient);
return true;
}