Bug 1174003 part 2: [css-flexbox] Reformat code around GetMinimumWidgetSize call slightly. r?mats draft
authorDaniel Holbert <dholbert@cs.stanford.edu>
Tue, 27 Feb 2018 11:26:43 -0800
changeset 760660 5b30f58d1ea3914eb61ab3ac7319f669f7730f6b
parent 760659 e4f88a07e757cd7ac95326bcfff5536bea1d5e87
child 760661 520de25519cf723502708c4f7e9c9b60fe187443
child 760681 aa3b6f2846bf1446566595e26be9934cadaf7cbc
push id100711
push userdholbert@mozilla.com
push dateTue, 27 Feb 2018 23:17:59 +0000
reviewersmats
bugs1174003
milestone60.0a1
Bug 1174003 part 2: [css-flexbox] Reformat code around GetMinimumWidgetSize call slightly. r?mats This patch doesn't change behavior. It's purely to allow the next patch to be more surgical. Specifically, this patch: - splits a subtract-and-clamp operation into two separate operations. - splits one a comment into two. ...so that the next patch can swap out these variables for new ones, without pushing these lines over 80 characters. MozReview-Commit-ID: 4N5sI755CqF
layout/generic/nsFlexContainerFrame.cpp
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -1277,23 +1277,24 @@ nsFlexContainerFrame::GenerateFlexItemFo
 
     nscoord widgetMainMinSize =
       aPresContext->DevPixelsToAppUnits(
         aAxisTracker.GetMainComponent(widgetMinSize));
     nscoord widgetCrossMinSize =
       aPresContext->DevPixelsToAppUnits(
         aAxisTracker.GetCrossComponent(widgetMinSize));
 
-    // GMWS() returns border-box. We need content-box, so subtract
-    // borderPadding (but don't let that push our min sizes below 0).
+    // GetMinimumWidgetSize() returns border-box. We need content-box, so
+    // subtract borderPadding.
     nsMargin& bp = childRI.ComputedPhysicalBorderPadding();
-    widgetMainMinSize = std::max(widgetMainMinSize -
-                                 aAxisTracker.GetMarginSizeInMainAxis(bp), 0);
-    widgetCrossMinSize = std::max(widgetCrossMinSize -
-                                  aAxisTracker.GetMarginSizeInCrossAxis(bp), 0);
+    widgetMainMinSize -= aAxisTracker.GetMarginSizeInMainAxis(bp);
+    widgetCrossMinSize -= aAxisTracker.GetMarginSizeInCrossAxis(bp);
+    // ... (but don't let that push these min sizes below 0).
+    widgetMainMinSize = std::max(0, widgetMainMinSize);
+    widgetCrossMinSize = std::max(0, widgetCrossMinSize);
 
     if (!canOverride) {
       // Fixed-size widget: freeze our main-size at the widget's mandated size.
       // (Set min and max main-sizes to that size, too, to keep us from
       // clamping to any other size later on.)
       flexBaseSize = mainMinSize = mainMaxSize = widgetMainMinSize;
       tentativeCrossSize = crossMinSize = crossMaxSize = widgetCrossMinSize;
       isFixedSizeWidget = true;