Bug 1387152 part 1: Adjust indentation and use HasAnyStateBits() instead of manual bitwise arithmetic, in nsFrame size-computation code. r=mats
authorDaniel Holbert <dholbert@cs.stanford.edu>
Thu, 03 Aug 2017 11:04:08 -0700
changeset 378334 929f225ca7206f4647f9e44c3f4c6aaf62ea661f
parent 378333 e5a2005e75342ab1be1d49d4e497b7b5d0220b09
child 378335 d5110841090cc545500ce537d021d1d8230798c0
push id32428
push userarchaeopteryx@coole-files.de
push dateSat, 02 Sep 2017 08:52:28 +0000
treeherdermozilla-central@b01a7e57425b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1387152
milestone57.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 1387152 part 1: Adjust indentation and use HasAnyStateBits() instead of manual bitwise arithmetic, in nsFrame size-computation code. r=mats * HasAnyStateBits is slightly more foolproof and readable -- in particular, you can put the logical "!" directly alongside the expression, rather than needing to separate it with a layer of logical-grouping-parens. * The deindentation here isn't super-important, but it conforms better to our coding style, and it'll make this code consistent with a new chunk that I'm adding in the next patch (and that chunk will *have* to be deindented like this, to avoid going over 80 characters). MozReview-Commit-ID: FWfqrKjHedP
layout/generic/nsFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -5071,33 +5071,33 @@ nsFrame::ComputeSize(gfxContext*        
     boxSizingAdjust.ISize(aWM);
 
   const nsStyleCoord* inlineStyleCoord = &stylePos->ISize(aWM);
   const nsStyleCoord* blockStyleCoord = &stylePos->BSize(aWM);
 
   auto parentFrame = GetParent();
   auto alignCB = parentFrame;
   bool isGridItem = parentFrame && parentFrame->IsGridContainerFrame() &&
-                    !(GetStateBits() & NS_FRAME_OUT_OF_FLOW);
+    !HasAnyStateBits(NS_FRAME_OUT_OF_FLOW);
   if (parentFrame && parentFrame->IsTableWrapperFrame() && IsTableFrame()) {
     // An inner table frame is sized as a grid item if its table wrapper is,
     // because they actually have the same CB (the wrapper's CB).
     // @see ReflowInput::InitCBReflowInput
     auto tableWrapper = GetParent();
     auto grandParent = tableWrapper->GetParent();
     isGridItem = (grandParent->IsGridContainerFrame() &&
                   !(tableWrapper->GetStateBits() & NS_FRAME_OUT_OF_FLOW));
     if (isGridItem) {
       // When resolving justify/align-self below, we want to use the grid
       // container's justify/align-items value and WritingMode.
       alignCB = grandParent;
     }
   }
   bool isFlexItem = parentFrame && parentFrame->IsFlexContainerFrame() &&
-                    !(GetStateBits() & NS_FRAME_OUT_OF_FLOW);
+    !HasAnyStateBits(NS_FRAME_OUT_OF_FLOW);
   bool isInlineFlexItem = false;
   if (isFlexItem) {
     // Flex items use their "flex-basis" property in place of their main-size
     // property (e.g. "width") for sizing purposes, *unless* they have
     // "flex-basis:auto", in which case they use their main-size property after
     // all.
     uint32_t flexDirection = GetParent()->StylePosition()->mFlexDirection;
     isInlineFlexItem =
@@ -5315,19 +5315,19 @@ nsFrame::ComputeSizeWithIntrinsicDimensi
                                             const LogicalSize&   aPadding,
                                             ComputeSizeFlags     aFlags)
 {
   const nsStylePosition* stylePos = StylePosition();
   const nsStyleCoord* inlineStyleCoord = &stylePos->ISize(aWM);
   const nsStyleCoord* blockStyleCoord = &stylePos->BSize(aWM);
   auto* parentFrame = GetParent();
   const bool isGridItem = parentFrame && parentFrame->IsGridContainerFrame() &&
-                          !(GetStateBits() & NS_FRAME_OUT_OF_FLOW);
+    !HasAnyStateBits(NS_FRAME_OUT_OF_FLOW);
   const bool isFlexItem = parentFrame && parentFrame->IsFlexContainerFrame() &&
-                          !(GetStateBits() & NS_FRAME_OUT_OF_FLOW);
+    !HasAnyStateBits(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.)