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
This commit is contained in:
Brad Werth 2016-10-14 17:17:33 -07:00
Родитель 9b5c1b9026
Коммит 76fb14b998
1 изменённых файлов: 10 добавлений и 8 удалений

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

@ -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");