Bug 1586068 - Replace #define NS_STYLE_FLEX_WRAP with enum class. r=emilio

MANUAL PUSH: Rebasing contributor patch.

Differential Revision: https://phabricator.services.mozilla.com/D48166
This commit is contained in:
Savo 2019-10-04 12:34:28 +02:00 коммит произвёл Emilio Cobos Álvarez
Родитель da1a862fc2
Коммит be6805c792
6 изменённых файлов: 15 добавлений и 11 удалений

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

@ -1220,7 +1220,7 @@ uint16_t nsFlexContainerFrame::CSSAlignmentForAbsPosChild(
const uint8_t alignContent = SimplifyAlignOrJustifyContentForOneItem( const uint8_t alignContent = SimplifyAlignOrJustifyContentForOneItem(
containerStylePos->mAlignContent, containerStylePos->mAlignContent,
/*aIsAlign = */ true); /*aIsAlign = */ true);
if (NS_STYLE_FLEX_WRAP_NOWRAP != containerStylePos->mFlexWrap && if (StyleFlexWrap::Nowrap != containerStylePos->mFlexWrap &&
alignContent != NS_STYLE_ALIGN_STRETCH) { alignContent != NS_STYLE_ALIGN_STRETCH) {
// Multi-line, align-content isn't stretch --> align-content determines // Multi-line, align-content isn't stretch --> align-content determines
// this child's alignment in the cross axis. // this child's alignment in the cross axis.
@ -1600,7 +1600,7 @@ void nsFlexContainerFrame::ResolveAutoFlexBasisAndMinSize(
const ReflowInput* flexContainerRI = aItemReflowInput.mParentReflowInput; const ReflowInput* flexContainerRI = aItemReflowInput.mParentReflowInput;
MOZ_ASSERT(flexContainerRI, MOZ_ASSERT(flexContainerRI,
"flex item's reflow input should have ptr to container's state"); "flex item's reflow input should have ptr to container's state");
if (NS_STYLE_FLEX_WRAP_NOWRAP == flexContainerRI->mStylePosition->mFlexWrap) { if (StyleFlexWrap::Nowrap == flexContainerRI->mStylePosition->mFlexWrap) {
// XXXdholbert Maybe this should share logic with ComputeCrossSize()... // XXXdholbert Maybe this should share logic with ComputeCrossSize()...
// Alternately, maybe tentative container cross size should be passed down. // Alternately, maybe tentative container cross size should be passed down.
nscoord containerCrossSize = GET_CROSS_COMPONENT_LOGICAL( nscoord containerCrossSize = GET_CROSS_COMPONENT_LOGICAL(
@ -3150,7 +3150,7 @@ CrossAxisPositionTracker::CrossAxisPositionTracker(
} }
const bool isSingleLine = const bool isSingleLine =
NS_STYLE_FLEX_WRAP_NOWRAP == aReflowInput.mStylePosition->mFlexWrap; StyleFlexWrap::Nowrap == aReflowInput.mStylePosition->mFlexWrap;
if (isSingleLine) { if (isSingleLine) {
MOZ_ASSERT(!aFirstLine->getNext(), MOZ_ASSERT(!aFirstLine->getNext(),
"If we're styled as single-line, we should only have 1 line"); "If we're styled as single-line, we should only have 1 line");
@ -3782,7 +3782,7 @@ void FlexboxAxisTracker::InitAxesFromModernProps(
} }
// "flex-wrap: wrap-reverse" reverses our cross axis. // "flex-wrap: wrap-reverse" reverses our cross axis.
if (stylePos->mFlexWrap == NS_STYLE_FLEX_WRAP_WRAP_REVERSE) { if (stylePos->mFlexWrap == StyleFlexWrap::WrapReverse) {
mCrossAxis = GetReverseAxis(mCrossAxis); mCrossAxis = GetReverseAxis(mCrossAxis);
mIsCrossAxisReversed = true; mIsCrossAxisReversed = true;
} else { } else {
@ -3845,7 +3845,7 @@ void nsFlexContainerFrame::GenerateFlexLines(
MOZ_ASSERT(aLines.isEmpty(), "Expecting outparam to start out empty"); MOZ_ASSERT(aLines.isEmpty(), "Expecting outparam to start out empty");
const bool isSingleLine = const bool isSingleLine =
NS_STYLE_FLEX_WRAP_NOWRAP == aReflowInput.mStylePosition->mFlexWrap; StyleFlexWrap::Nowrap == aReflowInput.mStylePosition->mFlexWrap;
// If we're transparently reversing axes, then we'll need to link up our // If we're transparently reversing axes, then we'll need to link up our
// FlexItems and FlexLines in the reverse order, so that the rest of flex // FlexItems and FlexLines in the reverse order, so that the rest of flex
@ -5364,7 +5364,7 @@ nscoord nsFlexContainerFrame::IntrinsicISize(gfxContext* aRenderingContext,
// is the max of its items' min isizes. // is the max of its items' min isizes.
// * For a row-oriented multi-line flex container, the intrinsic // * For a row-oriented multi-line flex container, the intrinsic
// pref isize is former (sum), and its min isize is the latter (max). // pref isize is former (sum), and its min isize is the latter (max).
bool isSingleLine = (NS_STYLE_FLEX_WRAP_NOWRAP == stylePos->mFlexWrap); bool isSingleLine = (StyleFlexWrap::Nowrap == stylePos->mFlexWrap);
if (axisTracker.IsRowOriented() && if (axisTracker.IsRowOriented() &&
(isSingleLine || aType == nsLayoutUtils::PREF_ISIZE)) { (isSingleLine || aType == nsLayoutUtils::PREF_ISIZE)) {
containerISize += childISize; containerISize += childISize;

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

@ -127,6 +127,7 @@ rusty-enums = [
"mozilla::StyleTextRendering", "mozilla::StyleTextRendering",
"mozilla::StyleColorAdjust", "mozilla::StyleColorAdjust",
"mozilla::StyleFlexDirection", "mozilla::StyleFlexDirection",
"mozilla::StyleFlexWrap",
"mozilla::StyleTextDecorationSkipInk", "mozilla::StyleTextDecorationSkipInk",
"mozilla::StyleTextDecorationLength", "mozilla::StyleTextDecorationLength",
"nsStyleImageType", "nsStyleImageType",

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

@ -453,9 +453,11 @@ enum class StyleFlexDirection : uint8_t {
}; };
// See nsStylePosition // See nsStylePosition
#define NS_STYLE_FLEX_WRAP_NOWRAP 0 enum class StyleFlexWrap : uint8_t {
#define NS_STYLE_FLEX_WRAP_WRAP 1 Nowrap,
#define NS_STYLE_FLEX_WRAP_WRAP_REVERSE 2 Wrap,
WrapReverse,
};
// See nsStylePosition // See nsStylePosition
// NOTE: This is the initial value of the integer-valued 'order' property // NOTE: This is the initial value of the integer-valued 'order' property

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

@ -1176,7 +1176,7 @@ nsStylePosition::nsStylePosition(const Document& aDocument)
mJustifyItems(NS_STYLE_JUSTIFY_NORMAL), mJustifyItems(NS_STYLE_JUSTIFY_NORMAL),
mJustifySelf(NS_STYLE_JUSTIFY_AUTO), mJustifySelf(NS_STYLE_JUSTIFY_AUTO),
mFlexDirection(StyleFlexDirection::Row), mFlexDirection(StyleFlexDirection::Row),
mFlexWrap(NS_STYLE_FLEX_WRAP_NOWRAP), mFlexWrap(StyleFlexWrap::Nowrap),
mObjectFit(NS_STYLE_OBJECT_FIT_FILL), mObjectFit(NS_STYLE_OBJECT_FIT_FILL),
mOrder(NS_STYLE_ORDER_INITIAL), mOrder(NS_STYLE_ORDER_INITIAL),
mFlexGrow(0.0f), mFlexGrow(0.0f),

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

@ -1033,7 +1033,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePosition {
uint8_t mJustifyItems; uint8_t mJustifyItems;
uint8_t mJustifySelf; uint8_t mJustifySelf;
mozilla::StyleFlexDirection mFlexDirection; mozilla::StyleFlexDirection mFlexDirection;
uint8_t mFlexWrap; // NS_STYLE_FLEX_WRAP_* mozilla::StyleFlexWrap mFlexWrap;
uint8_t mObjectFit; // NS_STYLE_OBJECT_FIT_* uint8_t mObjectFit; // NS_STYLE_OBJECT_FIT_*
int32_t mOrder; int32_t mOrder;
float mFlexGrow; float mFlexGrow;

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

@ -91,6 +91,7 @@ ${helpers.single_keyword(
extra_prefixes="webkit", extra_prefixes="webkit",
animation_value_type="discrete", animation_value_type="discrete",
servo_restyle_damage = "reflow", servo_restyle_damage = "reflow",
gecko_enum_prefix = "StyleFlexWrap",
)} )}
% if engine == "servo-2013": % if engine == "servo-2013":