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

--HG--
extra : rebase_source : 92d20c8b607d9526c19f387258248388d1c89d85
This commit is contained in:
Daniel Holbert 2018-02-28 09:40:48 -08:00
Родитель 010964c7b6
Коммит e1f331768e
1 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -1942,20 +1942,20 @@ FlexItem::CheckForMinSizeAuto(const ReflowInput& aFlexItemReflowInput,
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 nsStyleCoord& mainMinSize = aAxisTracker.IsRowOriented()
? pos->MinISize(aAxisTracker.GetWritingMode())
: pos->MinBSize(aAxisTracker.GetWritingMode());
const uint8_t overflowVal = GET_MAIN_COMPONENT(aAxisTracker,
disp->mOverflowX,
disp->mOverflowY);
mNeedsMinSizeAutoResolution = (minSize.GetUnit() == eStyleUnit_Auto &&
overflowVal == NS_STYLE_OVERFLOW_VISIBLE);
// 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