Disable the unitless length quirk inside of calc(). (Bug 774122, patch 3) r=bzbarsky
authorL. David Baron <dbaron@dbaron.org>
Mon, 16 Jul 2012 09:11:33 -0400
changeset 99441 3350e8b1618c5d512b81458690ba434dd1d91d49
parent 99440 473df589abf135570829e654731834d2445d21e9
child 99442 8837ebfb30459ee3600f0744d950bc06ff390a04
push id23135
push useremorley@mozilla.com
push dateTue, 17 Jul 2012 09:04:49 +0000
treeherdermozilla-central@ba8463beab13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs774122
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Disable the unitless length quirk inside of calc(). (Bug 774122, patch 3) r=bzbarsky I noticed this bug because the new assertions in ParseVariant, introduced in the previous patch, are stricter and would assert without this fix.
layout/style/nsCSSParser.cpp
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -7286,32 +7286,37 @@ CSSParserImpl::ParseCalc(nsCSSValue &aVa
 {
   // Parsing calc expressions requires, in a number of cases, looking
   // 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");
   NS_ABORT_IF_FALSE(aVariantMask != 0, "unexpected variant mask");
 
+  bool oldUnitlessLengthQuirk = mUnitlessLengthQuirk;
+  mUnitlessLengthQuirk = false;
+
   // One-iteration loop so we can break to the error-handling case.
   do {
     // The toplevel of a calc() is always an nsCSSValue::Array of length 1.
     nsRefPtr<nsCSSValue::Array> arr = nsCSSValue::Array::Create(1);
 
     if (!ParseCalcAdditiveExpression(arr->Item(0), aVariantMask))
       break;
 
     if (!ExpectSymbol(')', true))
       break;
 
     aValue.SetArrayValue(arr, eCSSUnit_Calc);
+    mUnitlessLengthQuirk = oldUnitlessLengthQuirk;
     return true;
   } while (false);
 
   SkipUntil(')');
+  mUnitlessLengthQuirk = oldUnitlessLengthQuirk;
   return false;
 }
 
 // We optimize away the <value-expression> production given that
 // ParseVariant consumes initial whitespace and we call
 // ExpectSymbol(')') with true for aSkipWS.
 //  * If aVariantMask is VARIANT_NUMBER, this function parses the
 //    <number-additive-expression> production.