Bug 1300369 part 12b - Make nsIFrame::ComputeISizeValue clamp the min-content size when eIClampMarginBoxMinSize is in aFlags. r=dholbert
authorMats Palmgren <mats@mozilla.com>
Sat, 05 Nov 2016 02:57:07 +0100
changeset 351304 e3bc6e35c8046af9a4b74737c197d799cacad149
parent 351303 8c76a7dbadc1f5315f3c4c8626725d2d2b69d3e0
child 351305 728204430c0bf24aeb3d0f256f24827772f43430
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1300369
milestone52.0a1
Bug 1300369 part 12b - Make nsIFrame::ComputeISizeValue clamp the min-content size when eIClampMarginBoxMinSize is in aFlags. r=dholbert
layout/generic/nsFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -5359,23 +5359,31 @@ nsIFrame::ComputeISizeValue(nsRenderingC
     switch (val) {
       case NS_STYLE_WIDTH_MAX_CONTENT:
         result = GetPrefISize(aRenderingContext);
         NS_ASSERTION(result >= 0, "inline-size less than zero");
         break;
       case NS_STYLE_WIDTH_MIN_CONTENT:
         result = GetMinISize(aRenderingContext);
         NS_ASSERTION(result >= 0, "inline-size less than zero");
+        if (MOZ_UNLIKELY(aFlags & ComputeSizeFlags::eIClampMarginBoxMinSize)) {
+          auto available = aContainingBlockISize -
+                           (aBoxSizingToMarginEdge + aContentEdgeToBoxSizing);
+          result = std::min(available, result);
+        }
         break;
       case NS_STYLE_WIDTH_FIT_CONTENT:
         {
           nscoord pref = GetPrefISize(aRenderingContext),
                    min = GetMinISize(aRenderingContext),
                   fill = aContainingBlockISize -
                          (aBoxSizingToMarginEdge + aContentEdgeToBoxSizing);
+          if (MOZ_UNLIKELY(aFlags & ComputeSizeFlags::eIClampMarginBoxMinSize)) {
+            min = std::min(min, fill);
+          }
           result = std::max(min, std::min(pref, fill));
           NS_ASSERTION(result >= 0, "inline-size less than zero");
         }
         break;
       case NS_STYLE_WIDTH_AVAILABLE:
         result = aContainingBlockISize -
                  (aBoxSizingToMarginEdge + aContentEdgeToBoxSizing);
     }