Commit 99b81927 authored by Morris Tseng's avatar Morris Tseng
Browse files

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

--HG--
extra : commitid : HWZIwem6z6u
parent b7a0aef8
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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;
+3 −1
Original line number Diff line number Diff line
@@ -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);
  }