diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index d6c16296fd..063e6cc10e 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -1788,6 +1788,25 @@ SetFactor(const nsCSSValue& aValue, float& aField, RuleNodeCacheConditions& aCon } return; + #include "CSSCalc.h" + + struct RuleNodeReduceNumberCalcOps + : public mozilla::css::BasicFloatCalcOps + , public mozilla::css::CSSValueInputCalcOps + { + float ComputeLeafValue(const nsCSSValue& aValue) + { + MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Number, + "Expected a number-only calc expression"); + return aValue.GetFloatValue(); + } + + float ComputeNumber(const nsCSSValue& aValue) + { + return mozilla::css::ComputeCalc(aValue, *this); + } + }; + case eCSSUnit_Calc: { RuleNodeReduceNumberCalcOps ops; aField = css::ComputeCalc(aValue, ops);