Bug 1218178 part 2 - Minor code cleanup (idempotent). r=dholbert
authorMats Palmgren <mats@mozilla.com>
Sat, 05 Nov 2016 02:57:05 +0100
changeset 347937 60d6fd3a6aa89b4913eaa083e6dc29d03af99697
parent 347936 28dad79c43336578ff855f70d9f27854a40222f8
child 347938 4e9d3d21f20db22985bf61346d03b40097bd47e3
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1218178
milestone52.0a1
Bug 1218178 part 2 - Minor code cleanup (idempotent). r=dholbert
layout/base/nsLayoutUtils.cpp
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -5421,30 +5421,25 @@ nsLayoutUtils::ComputeSizeWithIntrinsicD
                    const IntrinsicSize& aIntrinsicSize,
                    nsSize aIntrinsicRatio,
                    const mozilla::LogicalSize& aCBSize,
                    const mozilla::LogicalSize& aMargin,
                    const mozilla::LogicalSize& aBorder,
                    const mozilla::LogicalSize& aPadding)
 {
   const nsStylePosition* stylePos = aFrame->StylePosition();
-
-  // If we're a flex item, we'll compute our size a bit differently.
-  bool isVertical = aWM.IsVertical();
   const nsStyleCoord* inlineStyleCoord = &stylePos->ISize(aWM);
   const nsStyleCoord* blockStyleCoord = &stylePos->BSize(aWM);
-
-  nsIAtom* parentFrameType =
+  const nsIAtom* parentFrameType =
     aFrame->GetParent() ? aFrame->GetParent()->GetType() : nullptr;
   const bool isGridItem = (parentFrameType == nsGkAtoms::gridContainerFrame &&
                            !(aFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW));
   const bool isFlexItem = (parentFrameType == nsGkAtoms::flexContainerFrame &&
                            !(aFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW));
   bool isInlineFlexItem = false;
-
   Maybe<nsStyleCoord> imposedMainSizeStyleCoord;
 
   // If this is a flex item, and we're measuring its cross size after flexing
   // to resolve its main size, then we need to use the resolved main size
   // that the container provides to us *instead of* the main-size coordinate
   // from our style struct. (Otherwise, we'll be using an irrelevant value in
   // the aspect-ratio calculations below.)
   if (isFlexItem) {
@@ -5600,16 +5595,17 @@ nsLayoutUtils::ComputeSizeWithIntrinsicD
     minBSize = 0;
   }
 
   // Resolve percentage intrinsic iSize/bSize as necessary:
 
   NS_ASSERTION(aCBSize.ISize(aWM) != NS_UNCONSTRAINEDSIZE,
                "Our containing block must not have unconstrained inline-size!");
 
+  const bool isVertical = aWM.IsVertical();
   const nsStyleCoord& isizeCoord =
     isVertical ? aIntrinsicSize.height : aIntrinsicSize.width;
   const nsStyleCoord& bsizeCoord =
     isVertical ? aIntrinsicSize.width : aIntrinsicSize.height;
 
   bool hasIntrinsicISize, hasIntrinsicBSize;
   nscoord intrinsicISize, intrinsicBSize;