From 76fb14b99891526a5f6a41ba192360981fc8633d Mon Sep 17 00:00:00 2001 From: Brad Werth Date: Fri, 14 Oct 2016 17:17:33 -0700 Subject: [PATCH] Bug 1235922 Part 4: Add support for "align-content: space-evenly" to flexbox layout. r=mats MozReview-Commit-ID: 3ETuPrIURJ3 --HG-- extra : rebase_source : 95d4d7029660086b0bf6380b98efe57e11d4be83 --- layout/generic/nsFlexContainerFrame.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp index b30b3b6a05fd..9fba06b7fb54 100644 --- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -2806,14 +2806,15 @@ CrossAxisPositionTracker:: } // If packing space is negative, 'space-between' and 'stretch' behave like - // 'flex-start', and 'space-around' behaves like 'center'. In those cases, - // it's simplest to just pretend we have a different 'align-content' value - // and share code. + // 'flex-start', and 'space-around' and 'space-evenly' behave like 'center'. + // In those cases, it's simplest to just pretend we have a different + // 'align-content' value and share code. if (mPackingSpaceRemaining < 0) { if (mAlignContent == NS_STYLE_ALIGN_SPACE_BETWEEN || mAlignContent == NS_STYLE_ALIGN_STRETCH) { mAlignContent = NS_STYLE_ALIGN_FLEX_START; - } else if (mAlignContent == NS_STYLE_ALIGN_SPACE_AROUND) { + } else if (mAlignContent == NS_STYLE_ALIGN_SPACE_AROUND || + mAlignContent == NS_STYLE_ALIGN_SPACE_EVENLY) { mAlignContent = NS_STYLE_ALIGN_CENTER; } } @@ -2858,10 +2859,9 @@ CrossAxisPositionTracker:: switch (mAlignContent) { case NS_STYLE_ALIGN_SELF_START: case NS_STYLE_ALIGN_SELF_END: - case NS_STYLE_ALIGN_SPACE_EVENLY: case NS_STYLE_ALIGN_BASELINE: case NS_STYLE_ALIGN_LAST_BASELINE: - NS_WARNING("NYI: align-items/align-self:left/right/self-start/self-end/space-evenly/baseline/last-baseline"); + NS_WARNING("NYI: align-items/align-self:left/right/self-start/self-end/baseline/last-baseline"); MOZ_FALLTHROUGH; case NS_STYLE_ALIGN_FLEX_START: // All packing space should go at the end --> nothing to do here. @@ -2876,6 +2876,7 @@ CrossAxisPositionTracker:: break; case NS_STYLE_ALIGN_SPACE_BETWEEN: case NS_STYLE_ALIGN_SPACE_AROUND: + case NS_STYLE_ALIGN_SPACE_EVENLY: nsFlexContainerFrame::CalculatePackingSpace(numLines, mAlignContent, &mPosition, @@ -2915,9 +2916,10 @@ CrossAxisPositionTracker::TraversePackingSpace() { if (mNumPackingSpacesRemaining) { MOZ_ASSERT(mAlignContent == NS_STYLE_ALIGN_SPACE_BETWEEN || - mAlignContent == NS_STYLE_ALIGN_SPACE_AROUND, + mAlignContent == NS_STYLE_ALIGN_SPACE_AROUND || + mAlignContent == NS_STYLE_ALIGN_SPACE_EVENLY, "mNumPackingSpacesRemaining only applies for " - "space-between/space-around"); + "space-between/space-around/space-evenly"); MOZ_ASSERT(mPackingSpaceRemaining >= 0, "ran out of packing space earlier than we expected");