Bug 1174003 part 9: [css-flexbox] Remove GET_MAIN_COMPONENT calls from CheckForMinSizeAuto(). r?mats
This patch doesn't change behavior.
The GET_MAIN_COMPONENT macro (some of whose calls I'm removing here) makes a
call to IsMainAxisHorizontal() under the hood. So I want to get rid of calls
to this this macro, to get closer to killing that method.
In this code, we're interested in the flex item's min-size property in the flex
container's main axis. This patch makes us simply use MinISize/MinBSize (in
terms of the *flex container's* writing mode) to get the appropriate min-size
property. The call to IsRowOriented() (querying the flex container's
"flex-direction" property) tells us whether the inline or block axis is the
main axis.
This patch also does away with an unnecessary axis-specific 'overflow-{x/y}'
check, which we don't need to bother with, as noted in a new code-comment (due
to how the 'overflow' subproperties influence each other).
MozReview-Commit-ID: Kqyh69W5IQJ
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -1937,30 +1937,30 @@ FlexItem::FlexItem(nsIFrame* aChildFrame
void
FlexItem::CheckForMinSizeAuto(const ReflowInput& aFlexItemReflowInput,
const FlexboxAxisTracker& aAxisTracker)
{
const nsStylePosition* pos = aFlexItemReflowInput.mStylePosition;
const nsStyleDisplay* disp = aFlexItemReflowInput.mStyleDisplay;
// We'll need special behavior for "min-[width|height]:auto" (whichever is in
- // the main axis) iff:
+ // the flex container's main axis) iff:
// (a) its computed value is "auto"
// (b) the "overflow" sub-property in the same axis (the main axis) has a
// computed value of "visible"
- const nsStyleCoord& minSize = GET_MAIN_COMPONENT(aAxisTracker,
- pos->mMinWidth,
- pos->mMinHeight);
-
- const uint8_t overflowVal = GET_MAIN_COMPONENT(aAxisTracker,
- disp->mOverflowX,
- disp->mOverflowY);
-
- mNeedsMinSizeAutoResolution = (minSize.GetUnit() == eStyleUnit_Auto &&
- overflowVal == NS_STYLE_OVERFLOW_VISIBLE);
+ const nsStyleCoord& mainMinSize = aAxisTracker.IsRowOriented()
+ ? pos->MinISize(aAxisTracker.GetWritingMode())
+ : pos->MinBSize(aAxisTracker.GetWritingMode());
+
+ // NOTE: Technically we should be checking the 'overflow' subproperty in the
+ // main axis. But since we only care whether it's 'visible', we can check
+ // either subproperty -- because they must be BOTH 'visible' or BOTH
+ // non-'visible' due to the way the subproperties interact.
+ mNeedsMinSizeAutoResolution = (mainMinSize.GetUnit() == eStyleUnit_Auto &&
+ disp->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE);
}
nscoord
FlexItem::GetBaselineOffsetFromOuterCrossEdge(
AxisEdgeType aEdge,
const FlexboxAxisTracker& aAxisTracker,
bool aUseFirstLineBaseline) const
{