зеркало из https://github.com/mozilla/gecko-dev.git
Bug 594933 - Part 1: Let calc() supports number. r=dbaron
--HG-- extra : commitid : HWZIwem6z6u
This commit is contained in:
Родитель
b7a0aef870
Коммит
99b819272d
|
@ -7876,8 +7876,10 @@ CSSParserImpl::ParseVariant(nsCSSValue& aValue,
|
||||||
(eCSSToken_Function == tk->mType) &&
|
(eCSSToken_Function == tk->mType) &&
|
||||||
(tk->mIdent.LowerCaseEqualsLiteral("calc") ||
|
(tk->mIdent.LowerCaseEqualsLiteral("calc") ||
|
||||||
tk->mIdent.LowerCaseEqualsLiteral("-moz-calc"))) {
|
tk->mIdent.LowerCaseEqualsLiteral("-moz-calc"))) {
|
||||||
// calc() currently allows only lengths and percents inside it.
|
// calc() currently allows only lengths and percents and number inside it.
|
||||||
if (!ParseCalc(aValue, aVariantMask & VARIANT_LP)) {
|
// And note that in current implementation, number cannot be mixed with
|
||||||
|
// length and percent.
|
||||||
|
if (!ParseCalc(aValue, aVariantMask & VARIANT_LPN)) {
|
||||||
return CSSParseResult::Error;
|
return CSSParseResult::Error;
|
||||||
}
|
}
|
||||||
return CSSParseResult::Ok;
|
return CSSParseResult::Ok;
|
||||||
|
@ -12960,7 +12962,6 @@ CSSParserImpl::ParseCalc(nsCSSValue &aValue, uint32_t aVariantMask)
|
||||||
// for a token that is *either* a value of the property or a number.
|
// for a token that is *either* a value of the property or a number.
|
||||||
// This can be done without lookahead when we assume that the property
|
// This can be done without lookahead when we assume that the property
|
||||||
// values cannot themselves be numbers.
|
// values cannot themselves be numbers.
|
||||||
NS_ASSERTION(!(aVariantMask & VARIANT_NUMBER), "unexpected variant mask");
|
|
||||||
MOZ_ASSERT(aVariantMask != 0, "unexpected variant mask");
|
MOZ_ASSERT(aVariantMask != 0, "unexpected variant mask");
|
||||||
|
|
||||||
bool oldUnitlessLengthQuirk = mUnitlessLengthQuirk;
|
bool oldUnitlessLengthQuirk = mUnitlessLengthQuirk;
|
||||||
|
|
|
@ -812,7 +812,9 @@ struct CSSValueSerializeCalcOps {
|
||||||
|
|
||||||
void AppendLeafValue(const input_type& aValue)
|
void AppendLeafValue(const input_type& aValue)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Percent || aValue.IsLengthUnit(),
|
MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Percent ||
|
||||||
|
aValue.IsLengthUnit() ||
|
||||||
|
aValue.GetUnit() == eCSSUnit_Number,
|
||||||
"unexpected unit");
|
"unexpected unit");
|
||||||
aValue.AppendToString(mProperty, mResult, mValueSerialization);
|
aValue.AppendToString(mProperty, mResult, mValueSerialization);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче