Bug 823483 patch 1 - Check for percentage max-width in addition to percentage width when deciding to ignore intrinsic min-width of replaced elements. r=dholbert a=lizzard
authorL. David Baron <dbaron@dbaron.org>
Tue, 09 Feb 2016 22:16:39 -0800
changeset 318644 f8ad0bef38d6254c77fb0ada70f4195a115a2e14
parent 318643 7523d9722a0a05fd5c3c22172b99613eb63dec2c
child 318645 73e66a157d15784d7273eb0fe28a4402387ef821
push id1079
push userjlund@mozilla.com
push dateFri, 15 Apr 2016 21:02:33 +0000
treeherdermozilla-release@575fbf6786d5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert, lizzard
bugs823483
milestone46.0a2
Bug 823483 patch 1 - Check for percentage max-width in addition to percentage width when deciding to ignore intrinsic min-width of replaced elements. r=dholbert a=lizzard This (modulo changes in later patches) matches the behavior of Chromium and Edge. It increases the set of elements to which this quirky behavior applies.
layout/base/nsLayoutUtils.cpp
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -4544,22 +4544,21 @@ AddIntrinsicSizeOffset(nsRenderingContex
 
   nscoord size;
   if (GetAbsoluteCoord(aStyleSize, size) ||
       GetIntrinsicCoord(aStyleSize, aRenderingContext, aFrame,
                         PROP_WIDTH, size)) {
     result = nsLayoutUtils::AddPercents(aType, size + coordOutsideSize,
                                         pctOutsideSize);
   } else if (aType == nsLayoutUtils::MIN_ISIZE &&
-             // The only cases of coord-percent-calc() units that
-             // GetAbsoluteCoord didn't handle are percent and calc()s
-             // containing percent.
-             aStyleSize.IsCoordPercentCalcUnit() &&
+             (aStyleSize.HasPercent() ||
+              aStyleMaxSize.HasPercent()) &&
              aFrame->IsFrameOfType(nsIFrame::eReplaced)) {
-    // A percentage width on replaced elements means they can shrink to 0.
+    // A percentage width or max-width on replaced elements means they
+    // can shrink to 0.
     result = 0; // let |min| handle padding/border/margin
   } else {
     // NOTE: We could really do a lot better for percents and for some
     // cases of calc() containing percent (certainly including any where
     // the coefficient on the percent is positive and there are no max()
     // expressions).  However, doing better for percents wouldn't be
     // backwards compatible.
     result = nsLayoutUtils::AddPercents(aType, result, pctTotal);