| Index: Source/core/rendering/RenderFlexibleBox.cpp
|
| diff --git a/Source/core/rendering/RenderFlexibleBox.cpp b/Source/core/rendering/RenderFlexibleBox.cpp
|
| index e62118127ede08103e8459a02c41682165b3be74..1ce097ed78524e873e65546e6e541ff0f5170de6 100644
|
| --- a/Source/core/rendering/RenderFlexibleBox.cpp
|
| +++ b/Source/core/rendering/RenderFlexibleBox.cpp
|
| @@ -155,7 +155,7 @@ int RenderFlexibleBox::firstLineBoxBaseline() const
|
| for (RenderBox* child = m_orderIterator.first(); child; child = m_orderIterator.next()) {
|
| if (child->isOutOfFlowPositioned())
|
| continue;
|
| - if (alignmentForChild(child) == AlignBaseline && !hasAutoMarginsInCrossAxis(child)) {
|
| + if (alignmentForChild(child) == ItemPositionBaseline && !hasAutoMarginsInCrossAxis(child)) {
|
| baselineChild = child;
|
| break;
|
| }
|
| @@ -196,10 +196,10 @@ int RenderFlexibleBox::inlineBlockBaseline(LineDirectionMode direction) const
|
| return synthesizedBaselineFromContentBox(this, direction) + marginAscent;
|
| }
|
|
|
| -static EAlignItems resolveAlignment(const RenderStyle* parentStyle, const RenderStyle* childStyle)
|
| +static ItemPosition resolveAlignment(const RenderStyle* parentStyle, const RenderStyle* childStyle)
|
| {
|
| - EAlignItems align = childStyle->alignSelf();
|
| - if (align == AlignAuto)
|
| + ItemPosition align = childStyle->alignSelf();
|
| + if (align == ItemPositionAuto)
|
| align = parentStyle->alignItems();
|
| return align;
|
| }
|
| @@ -208,12 +208,12 @@ void RenderFlexibleBox::styleDidChange(StyleDifference diff, const RenderStyle*
|
| {
|
| RenderBlock::styleDidChange(diff, oldStyle);
|
|
|
| - if (oldStyle && oldStyle->alignItems() == AlignStretch && diff == StyleDifferenceLayout) {
|
| + if (oldStyle && oldStyle->alignItems() == ItemPositionStretch && diff == StyleDifferenceLayout) {
|
| // Flex items that were previously stretching need to be relayed out so we can compute new available cross axis space.
|
| // This is only necessary for stretching since other alignment values don't change the size of the box.
|
| for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
|
| - EAlignItems previousAlignment = resolveAlignment(oldStyle, child->style());
|
| - if (previousAlignment == AlignStretch && previousAlignment != resolveAlignment(style(), child->style()))
|
| + ItemPosition previousAlignment = resolveAlignment(oldStyle, child->style());
|
| + if (previousAlignment == ItemPositionStretch && previousAlignment != resolveAlignment(style(), child->style()))
|
| child->setChildNeedsLayout(MarkOnlyThis);
|
| }
|
| }
|
| @@ -1016,18 +1016,18 @@ void RenderFlexibleBox::prepareChildForPositionedLayout(RenderBox* child, Layout
|
| }
|
| }
|
|
|
| -EAlignItems RenderFlexibleBox::alignmentForChild(RenderBox* child) const
|
| +ItemPosition RenderFlexibleBox::alignmentForChild(RenderBox* child) const
|
| {
|
| - EAlignItems align = resolveAlignment(style(), child->style());
|
| + ItemPosition align = resolveAlignment(style(), child->style());
|
|
|
| - if (align == AlignBaseline && hasOrthogonalFlow(child))
|
| - align = AlignFlexStart;
|
| + if (align == ItemPositionBaseline && hasOrthogonalFlow(child))
|
| + align = ItemPositionFlexStart;
|
|
|
| if (style()->flexWrap() == FlexWrapReverse) {
|
| - if (align == AlignFlexStart)
|
| - align = AlignFlexEnd;
|
| - else if (align == AlignFlexEnd)
|
| - align = AlignFlexStart;
|
| + if (align == ItemPositionFlexStart)
|
| + align = ItemPositionFlexEnd;
|
| + else if (align == ItemPositionFlexEnd)
|
| + align = ItemPositionFlexStart;
|
| }
|
|
|
| return align;
|
| @@ -1087,7 +1087,7 @@ void RenderFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons
|
| updateAutoMarginsInMainAxis(child, autoMarginOffset);
|
|
|
| LayoutUnit childCrossAxisMarginBoxExtent;
|
| - if (alignmentForChild(child) == AlignBaseline && !hasAutoMarginsInCrossAxis(child)) {
|
| + if (alignmentForChild(child) == ItemPositionBaseline && !hasAutoMarginsInCrossAxis(child)) {
|
| LayoutUnit ascent = marginBoxAscentForChild(child);
|
| LayoutUnit descent = (crossAxisMarginExtentForChild(child) + crossAxisExtentForChild(child)) - ascent;
|
|
|
| @@ -1250,25 +1250,25 @@ void RenderFlexibleBox::alignChildren(const Vector<LineContext>& lineContexts)
|
| continue;
|
|
|
| switch (alignmentForChild(child)) {
|
| - case AlignAuto:
|
| + case ItemPositionAuto:
|
| ASSERT_NOT_REACHED();
|
| break;
|
| - case AlignStretch: {
|
| + case ItemPositionStretch: {
|
| applyStretchAlignmentToChild(child, lineCrossAxisExtent);
|
| // Since wrap-reverse flips cross start and cross end, strech children should be aligned with the cross end.
|
| if (style()->flexWrap() == FlexWrapReverse)
|
| adjustAlignmentForChild(child, availableAlignmentSpaceForChild(lineCrossAxisExtent, child));
|
| break;
|
| }
|
| - case AlignFlexStart:
|
| + case ItemPositionFlexStart:
|
| break;
|
| - case AlignFlexEnd:
|
| + case ItemPositionFlexEnd:
|
| adjustAlignmentForChild(child, availableAlignmentSpaceForChild(lineCrossAxisExtent, child));
|
| break;
|
| - case AlignCenter:
|
| + case ItemPositionCenter:
|
| adjustAlignmentForChild(child, availableAlignmentSpaceForChild(lineCrossAxisExtent, child) / 2);
|
| break;
|
| - case AlignBaseline: {
|
| + case ItemPositionBaseline: {
|
| // FIXME: If we get here in columns, we want the use the descent, except we currently can't get the ascent/descent of orthogonal children.
|
| // https://bugs.webkit.org/show_bug.cgi?id=98076
|
| LayoutUnit ascent = marginBoxAscentForChild(child);
|
| @@ -1279,6 +1279,16 @@ void RenderFlexibleBox::alignChildren(const Vector<LineContext>& lineContexts)
|
| minMarginAfterBaseline = std::min(minMarginAfterBaseline, availableAlignmentSpaceForChild(lineCrossAxisExtent, child) - startOffset);
|
| break;
|
| }
|
| + case ItemPositionSelfStart:
|
| + case ItemPositionSelfEnd:
|
| + case ItemPositionStart:
|
| + case ItemPositionEnd:
|
| + case ItemPositionLeft:
|
| + case ItemPositionRight:
|
| + // FIXME: File a bug about implementing that. The extended grammar
|
| + // is not enabled by default so we shouldn't hit this codepath.
|
| + ASSERT_NOT_REACHED();
|
| + break;
|
| }
|
| }
|
| minMarginAfterBaselines.append(minMarginAfterBaseline);
|
| @@ -1294,7 +1304,7 @@ void RenderFlexibleBox::alignChildren(const Vector<LineContext>& lineContexts)
|
| LayoutUnit minMarginAfterBaseline = minMarginAfterBaselines[lineNumber];
|
| for (size_t childNumber = 0; childNumber < lineContexts[lineNumber].numberOfChildren; ++childNumber, child = m_orderIterator.next()) {
|
| ASSERT(child);
|
| - if (alignmentForChild(child) == AlignBaseline && !hasAutoMarginsInCrossAxis(child) && minMarginAfterBaseline)
|
| + if (alignmentForChild(child) == ItemPositionBaseline && !hasAutoMarginsInCrossAxis(child) && minMarginAfterBaseline)
|
| adjustAlignmentForChild(child, minMarginAfterBaseline);
|
| }
|
| }
|
|
|