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
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -5076,33 +5076,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 =
@@ -5320,19 +5320,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.)