зеркало из https://github.com/mozilla/gecko-dev.git
Bug 752187 - Part 8: Implement unprefixed linear-gradient parsing. r=dbaron
This commit is contained in:
Родитель
b27adf13d6
Коммит
6eab3cff50
|
@ -4999,34 +4999,12 @@ CSSParserImpl::ParseLinearGradient(nsCSSValue& aValue, bool aIsRepeating,
|
|||
nsRefPtr<nsCSSValueGradient> cssGradient
|
||||
= new nsCSSValueGradient(false, aIsRepeating);
|
||||
|
||||
// <gradient-line>
|
||||
if (!GetToken(true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool toCorner = false;
|
||||
if (mToken.mType == eCSSToken_Ident &&
|
||||
mToken.mIdent.LowerCaseEqualsLiteral("to")) {
|
||||
toCorner = true;
|
||||
if (!GetToken(true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
nsCSSTokenType ty = mToken.mType;
|
||||
nsString id = mToken.mIdent;
|
||||
cssGradient->mIsLegacySyntax = !toCorner;
|
||||
UngetToken();
|
||||
|
||||
// <legacy-gradient-line>
|
||||
bool haveGradientLine = IsLegacyGradientLine(ty, id);
|
||||
if (haveGradientLine) {
|
||||
if (toCorner) {
|
||||
// "to" syntax only allows box position keywords
|
||||
if (ty != eCSSToken_Ident) {
|
||||
SkipUntil(')');
|
||||
return false;
|
||||
}
|
||||
|
||||
// "to" syntax doesn't allow explicit "center"
|
||||
if (!ParseBoxPositionValues(cssGradient->mBgPos, false, false)) {
|
||||
|
@ -5034,6 +5012,7 @@ CSSParserImpl::ParseLinearGradient(nsCSSValue& aValue, bool aIsRepeating,
|
|||
return false;
|
||||
}
|
||||
|
||||
// [ to [left | right] || [top | bottom] ] ,
|
||||
const nsCSSValue& xValue = cssGradient->mBgPos.mXValue;
|
||||
const nsCSSValue& yValue = cssGradient->mBgPos.mYValue;
|
||||
if (xValue.GetUnit() != eCSSUnit_Enumerated ||
|
||||
|
@ -5052,7 +5031,31 @@ CSSParserImpl::ParseLinearGradient(nsCSSValue& aValue, bool aIsRepeating,
|
|||
SkipUntil(')');
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
||||
return ParseGradientColorStops(cssGradient, aValue);
|
||||
}
|
||||
|
||||
if (!aIsLegacy) {
|
||||
UngetToken();
|
||||
|
||||
// <angle> ,
|
||||
if (ParseVariant(cssGradient->mAngle, VARIANT_ANGLE, nsnull) &&
|
||||
!ExpectSymbol(',', true)) {
|
||||
SkipUntil(')');
|
||||
return false;
|
||||
}
|
||||
|
||||
return ParseGradientColorStops(cssGradient, aValue);
|
||||
}
|
||||
|
||||
nsCSSTokenType ty = mToken.mType;
|
||||
nsString id = mToken.mIdent;
|
||||
UngetToken();
|
||||
|
||||
// <legacy-gradient-line>
|
||||
bool haveGradientLine = IsLegacyGradientLine(ty, id);
|
||||
if (haveGradientLine) {
|
||||
cssGradient->mIsLegacySyntax = true;
|
||||
bool haveAngle =
|
||||
ParseVariant(cssGradient->mAngle, VARIANT_ANGLE, nsnull);
|
||||
|
||||
|
@ -5075,7 +5078,6 @@ CSSParserImpl::ParseLinearGradient(nsCSSValue& aValue, bool aIsRepeating,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ParseGradientColorStops(cssGradient, aValue);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче