Bug 1674774 Part 1 - Move two variables' definition closer to their usage. r=mats
authorTing-Yu Lin <tlin@mozilla.com>
Tue, 01 Dec 2020 05:45:49 +0000
changeset 558864 7f28e2783cf187a0b610559f70833264d585d384
parent 558863 b5de1c09c9c7277135b0e44fa160653e8c8e1c88
child 558865 7448c4ef16ca58b3451a4aaad75cbb06c459447a
push id37992
push userapavel@mozilla.com
push dateTue, 01 Dec 2020 09:38:15 +0000
treeherdermozilla-central@abafe6c923eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1674774
milestone85.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1674774 Part 1 - Move two variables' definition closer to their usage. r=mats Differential Revision: https://phabricator.services.mozilla.com/D97519
layout/generic/nsFlexContainerFrame.cpp
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -4389,26 +4389,16 @@ void nsFlexContainerFrame::Reflow(nsPres
   RemoveStateBits(NS_STATE_FLEX_HAS_LINE_CLAMP_ELLIPSIS);
 
   const FlexboxAxisTracker axisTracker(this);
 
   // Check to see if we need to create a computed info structure, to
   // be filled out for use by devtools.
   ComputedFlexContainerInfo* containerInfo = CreateOrClearFlexContainerInfo();
 
-  // We assume we are the last fragment by using
-  // PreReflowBlockLevelLogicalSkipSides(). We will skip block-end
-  // border/padding when we know our content-box size after DoFlexLayout.
-  LogicalMargin borderPadding =
-      aReflowInput.ComputedLogicalBorderPadding(wm).ApplySkipSides(
-          PreReflowBlockLevelLogicalSkipSides());
-
-  const LogicalSize availableSizeForItems =
-      ComputeAvailableSizeForItems(aReflowInput, borderPadding);
-
   const nscoord consumedBSize = CalcAndCacheConsumedBSize();
   nscoord contentBoxMainSize =
       GetMainSizeFromReflowInput(aReflowInput, axisTracker, consumedBSize);
   nscoord contentBoxCrossSize;
   nscoord flexContainerAscent;
 
   // Calculate gap size for main and cross axis
   nscoord mainGapSize;
@@ -4461,16 +4451,26 @@ void nsFlexContainerFrame::Reflow(nsPres
     auto* data = FirstInFlow()->GetProperty(SharedFlexData::Prop());
     MOZ_ASSERT(data, "SharedFlexData should be set by our first-in-flow!");
 
     GenerateFlexLines(*data, lines);
     contentBoxMainSize = data->mContentBoxMainSize;
     contentBoxCrossSize = data->mContentBoxCrossSize;
   }
 
+  // We assume we are the last fragment by using
+  // PreReflowBlockLevelLogicalSkipSides(), and skip block-end border and
+  // padding if needed.
+  LogicalMargin borderPadding =
+      aReflowInput.ComputedLogicalBorderPadding(wm).ApplySkipSides(
+          PreReflowBlockLevelLogicalSkipSides());
+
+  const LogicalSize availableSizeForItems =
+      ComputeAvailableSizeForItems(aReflowInput, borderPadding);
+
   const LogicalSize contentBoxSize =
       axisTracker.LogicalSizeFromFlexRelativeSizes(contentBoxMainSize,
                                                    contentBoxCrossSize);
   const nscoord effectiveContentBSize =
       contentBoxSize.BSize(wm) - consumedBSize;
 
   // Check if we may need a next-in-flow. If so, we'll need to skip block-end
   // border and padding.