Bug 594933 - Part 1: Let calc() supports number. r=dbaron

--HG--
extra : commitid : HWZIwem6z6u
This commit is contained in:
Morris Tseng 2016-03-15 10:37:37 +08:00
Родитель b7a0aef870
Коммит 99b819272d
2 изменённых файлов: 7 добавлений и 4 удалений

Просмотреть файл

@ -7876,8 +7876,10 @@ CSSParserImpl::ParseVariant(nsCSSValue& aValue,
(eCSSToken_Function == tk->mType) &&
(tk->mIdent.LowerCaseEqualsLiteral("calc") ||
tk->mIdent.LowerCaseEqualsLiteral("-moz-calc"))) {
// calc() currently allows only lengths and percents inside it.
if (!ParseCalc(aValue, aVariantMask & VARIANT_LP)) {
// calc() currently allows only lengths and percents and number inside it.
// 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::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.
// This can be done without lookahead when we assume that the property
// values cannot themselves be numbers.
NS_ASSERTION(!(aVariantMask & VARIANT_NUMBER), "unexpected variant mask");
MOZ_ASSERT(aVariantMask != 0, "unexpected variant mask");
bool oldUnitlessLengthQuirk = mUnitlessLengthQuirk;

Просмотреть файл

@ -812,7 +812,9 @@ struct CSSValueSerializeCalcOps {
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");
aValue.AppendToString(mProperty, mResult, mValueSerialization);
}