diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 780f62c1e9..7479e34344 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -1788,6 +1788,29 @@ SetFactor(const nsCSSValue& aValue, float& aField, RuleNodeCacheConditions& aCon } return; + case eCSSUnit_Calc: { + RuleNodeReduceNumberCalcOps ops; + aField = css::ComputeCalc(aValue, ops); + if (mozilla::IsNaN(aField)) { + aField = 0.0f; + } + if (aFlags & SETFCT_POSITIVE) { + NS_ASSERTION(aField >= 0.0f, "negative value for positive-only property"); + if (aField < 0.0f) { + aField = 0.0f; + } + } + if (aFlags & SETFCT_OPACITY) { + if (aField < 0.0f) { + aField = 0.0f; + } + if (aField > 1.0f) { + aField = 1.0f; + } + } + return; + } + case eCSSUnit_Inherit: aConditions.SetUncacheable(); aField = aParentValue; @@ -8130,6 +8153,7 @@ nsRuleNode::ComputeBorderData(void* aStartStruct, { const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_radius); + const float RADIUS_MAX = 17895697; // CSS length clamp value NS_FOR_CSS_FULL_CORNERS(corner) { int cx = FullToHalfCorner(corner, false); int cy = FullToHalfCorner(corner, true);