diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index b3951f5dd9f3..536b855531b7 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -2326,14 +2326,19 @@ static bool GetAbsoluteCoord(const nsStyleCoord& aStyle, nscoord& aResult) return true; } +// Only call on style coords for which GetAbsoluteCoord returned false. static bool GetPercentHeight(const nsStyleCoord& aStyle, nsIFrame* aFrame, nscoord& aResult) { - if (eStyleUnit_Percent != aStyle.GetUnit()) + if (eStyleUnit_Percent != aStyle.GetUnit() && + !aStyle.IsCalcUnit()) return false; + MOZ_ASSERT(!aStyle.IsCalcUnit() || aStyle.CalcHasPercent(), + "GetAbsoluteCoord should have handled this"); + nsIFrame *f = aFrame->GetContainingBlock(); if (!f) { NS_NOTREACHED("top of frame tree not a containing block"); @@ -2391,6 +2396,11 @@ GetPercentHeight(const nsStyleCoord& aStyle, "unknown min-height unit"); } + if (aStyle.IsCalcUnit()) { + aResult = NS_MAX(nsRuleNode::ComputeComputedCalc(aStyle, h), 0); + return true; + } + aResult = NSToCoordRound(aStyle.GetPercentValue() * h); return true; } diff --git a/layout/reftests/box-sizing/reftest.list b/layout/reftests/box-sizing/reftest.list index ce4839abcefb..83677c2df1e9 100644 --- a/layout/reftests/box-sizing/reftest.list +++ b/layout/reftests/box-sizing/reftest.list @@ -1,6 +1,6 @@ == intrinsic-1a.html intrinsic-1-ref.html == intrinsic-1b.html intrinsic-1-ref.html == intrinsic-1c.html intrinsic-1-ref.html -fails == intrinsic-1d.html intrinsic-1-ref.html # Bug 801994 -fails == intrinsic-1e.html intrinsic-1-ref.html # Bug 801994 +== intrinsic-1d.html intrinsic-1-ref.html +== intrinsic-1e.html intrinsic-1-ref.html == intrinsic-1f.html intrinsic-1-ref.html diff --git a/layout/reftests/bugs/801994-1-ref.html b/layout/reftests/bugs/801994-1-ref.html new file mode 100644 index 000000000000..72645c67fc26 --- /dev/null +++ b/layout/reftests/bugs/801994-1-ref.html @@ -0,0 +1,4 @@ + +