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 @@ + +
+ +
diff --git a/layout/reftests/bugs/801994-1.html b/layout/reftests/bugs/801994-1.html new file mode 100644 index 000000000000..53d7a7dff7ec --- /dev/null +++ b/layout/reftests/bugs/801994-1.html @@ -0,0 +1,4 @@ + +
+ +
diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 6bf8a5896400..89b697f23727 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1725,3 +1725,4 @@ fuzzy-if(true,17,5859) == 759036-2.html 759036-2-ref.html == 787947-1.html 787947-1-ref.html fuzzy(40,800) == 797797-1.html 797797-1-ref.html # 'opacity:N' and rgba(,,,N) text don't match precisely fuzzy(40,800) == 797797-2.html 797797-2-ref.html # 'opacity:N' and rgba(,,,N) text don't match precisely +== 801994-1.html 801994-1-ref.html