| Index: Source/core/layout/LayoutFlexibleBox.cpp
|
| diff --git a/Source/core/layout/LayoutFlexibleBox.cpp b/Source/core/layout/LayoutFlexibleBox.cpp
|
| index 5de6becb21b9f66ef63b7ed635c9bea88309a265..be0b6f1a648a22d3cca6c56f9547d7f2edfb573b 100644
|
| --- a/Source/core/layout/LayoutFlexibleBox.cpp
|
| +++ b/Source/core/layout/LayoutFlexibleBox.cpp
|
| @@ -210,12 +210,12 @@ void LayoutFlexibleBox::styleDidChange(StyleDifference diff, const ComputedStyle
|
| {
|
| LayoutBlock::styleDidChange(diff, oldStyle);
|
|
|
| - if (oldStyle && oldStyle->alignItemsPosition() == ItemPositionStretch && diff.needsFullLayout()) {
|
| + if (oldStyle && (oldStyle->alignItemsPosition() == ItemPositionStretch || oldStyle->alignItemsPosition() == ItemPositionAuto) && diff.needsFullLayout()) {
|
| // 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 (LayoutBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
|
| - ItemPosition previousAlignment = ComputedStyle::resolveAlignment(*oldStyle, child->styleRef(), ItemPositionStretch);
|
| - if (previousAlignment == ItemPositionStretch && previousAlignment != ComputedStyle::resolveAlignment(styleRef(), child->styleRef(), ItemPositionStretch))
|
| + ItemPosition previousAlignment = oldStyle->alignSelfPosition() == ItemPositionAuto ? ItemPositionStretch : oldStyle->alignSelfPosition();
|
| + if (previousAlignment == ItemPositionStretch && previousAlignment != ComputedStyle::resolvedAlignSelfPosition(styleRef(), child->styleRef(), ItemPositionStretch))
|
| child->setChildNeedsLayout(MarkOnlyThis);
|
| }
|
| }
|
| @@ -1050,7 +1050,7 @@ void LayoutFlexibleBox::prepareChildForPositionedLayout(LayoutBox& child, Layout
|
|
|
| ItemPosition LayoutFlexibleBox::alignmentForChild(LayoutBox& child) const
|
| {
|
| - ItemPosition align = ComputedStyle::resolveAlignment(styleRef(), child.styleRef(), ItemPositionStretch);
|
| + ItemPosition align = ComputedStyle::resolvedAlignSelfPosition(styleRef(), child.styleRef(), ItemPositionStretch);
|
|
|
| if (align == ItemPositionBaseline && hasOrthogonalFlow(child))
|
| align = ItemPositionFlexStart;
|
| @@ -1118,10 +1118,13 @@ void LayoutFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons
|
| {
|
| ASSERT(childSizes.size() == children.size());
|
|
|
| + ContentPosition position = style()->resolvedJustifyContentPosition();
|
| + ContentDistributionType distribution = style()->resolvedJustifyContentDistribution();
|
| +
|
| size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(children);
|
| LayoutUnit autoMarginOffset = autoMarginOffsetInMainAxis(children, availableFreeSpace);
|
| LayoutUnit mainAxisOffset = flowAwareBorderStart() + flowAwarePaddingStart();
|
| - mainAxisOffset += initialJustifyContentOffset(availableFreeSpace, style()->justifyContentPosition(), style()->justifyContentDistribution(), numberOfChildrenForJustifyContent);
|
| + mainAxisOffset += initialJustifyContentOffset(availableFreeSpace, position, distribution, numberOfChildrenForJustifyContent);
|
| if (style()->flexDirection() == FlowRowReverse)
|
| mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() : horizontalScrollbarHeight();
|
|
|
| @@ -1186,7 +1189,7 @@ void LayoutFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons
|
|
|
| ++seenInFlowPositionedChildren;
|
| if (seenInFlowPositionedChildren < numberOfChildrenForJustifyContent)
|
| - mainAxisOffset += justifyContentSpaceBetweenChildren(availableFreeSpace, style()->justifyContentDistribution(), numberOfChildrenForJustifyContent);
|
| + mainAxisOffset += justifyContentSpaceBetweenChildren(availableFreeSpace, distribution, numberOfChildrenForJustifyContent);
|
| }
|
|
|
| if (isColumnFlow())
|
| @@ -1207,12 +1210,15 @@ void LayoutFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons
|
|
|
| void LayoutFlexibleBox::layoutColumnReverse(const OrderedFlexItemList& children, LayoutUnit crossAxisOffset, LayoutUnit availableFreeSpace)
|
| {
|
| + ContentPosition position = style()->resolvedJustifyContentPosition();
|
| + ContentDistributionType distribution = style()->resolvedJustifyContentDistribution();
|
| +
|
| // This is similar to the logic in layoutAndPlaceChildren, except we place the children
|
| // starting from the end of the flexbox. We also don't need to layout anything since we're
|
| // just moving the children to a new position.
|
| size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(children);
|
| LayoutUnit mainAxisOffset = logicalHeight() - flowAwareBorderEnd() - flowAwarePaddingEnd();
|
| - mainAxisOffset -= initialJustifyContentOffset(availableFreeSpace, style()->justifyContentPosition(), style()->justifyContentDistribution(), numberOfChildrenForJustifyContent);
|
| + mainAxisOffset -= initialJustifyContentOffset(availableFreeSpace, position, distribution, numberOfChildrenForJustifyContent);
|
| mainAxisOffset -= isHorizontalFlow() ? verticalScrollbarWidth() : horizontalScrollbarHeight();
|
|
|
| size_t seenInFlowPositionedChildren = 0;
|
| @@ -1231,7 +1237,7 @@ void LayoutFlexibleBox::layoutColumnReverse(const OrderedFlexItemList& children,
|
|
|
| ++seenInFlowPositionedChildren;
|
| if (seenInFlowPositionedChildren < numberOfChildrenForJustifyContent)
|
| - mainAxisOffset -= justifyContentSpaceBetweenChildren(availableFreeSpace, style()->justifyContentDistribution(), numberOfChildrenForJustifyContent);
|
| + mainAxisOffset -= justifyContentSpaceBetweenChildren(availableFreeSpace, distribution, numberOfChildrenForJustifyContent);
|
| }
|
| }
|
|
|
| @@ -1273,7 +1279,10 @@ void LayoutFlexibleBox::alignFlexLines(Vector<LineContext>& lineContexts)
|
| return;
|
| }
|
|
|
| - if (style()->alignContentPosition() == ContentPositionFlexStart)
|
| + ContentPosition position = style()->resolvedAlignContentPosition();
|
| + ContentDistributionType distribution = style()->resolvedAlignContentDistribution();
|
| +
|
| + if (position == ContentPositionFlexStart)
|
| return;
|
|
|
| LayoutUnit availableCrossAxisSpace = crossAxisContentExtent();
|
| @@ -1281,16 +1290,16 @@ void LayoutFlexibleBox::alignFlexLines(Vector<LineContext>& lineContexts)
|
| availableCrossAxisSpace -= lineContexts[i].crossAxisExtent;
|
|
|
| LayoutBox* child = m_orderIterator.first();
|
| - LayoutUnit lineOffset = initialAlignContentOffset(availableCrossAxisSpace, style()->alignContentPosition(), style()->alignContentDistribution(), lineContexts.size());
|
| + LayoutUnit lineOffset = initialAlignContentOffset(availableCrossAxisSpace, position, distribution, lineContexts.size());
|
| for (unsigned lineNumber = 0; lineNumber < lineContexts.size(); ++lineNumber) {
|
| lineContexts[lineNumber].crossAxisOffset += lineOffset;
|
| for (size_t childNumber = 0; childNumber < lineContexts[lineNumber].numberOfChildren; ++childNumber, child = m_orderIterator.next())
|
| adjustAlignmentForChild(*child, lineOffset);
|
|
|
| - if (style()->alignContentDistribution() == ContentDistributionStretch && availableCrossAxisSpace > 0)
|
| + if (distribution == ContentDistributionStretch && availableCrossAxisSpace > 0)
|
| lineContexts[lineNumber].crossAxisExtent += availableCrossAxisSpace / static_cast<unsigned>(lineContexts.size());
|
|
|
| - lineOffset += alignContentSpaceBetweenChildren(availableCrossAxisSpace, style()->alignContentDistribution(), lineContexts.size());
|
| + lineOffset += alignContentSpaceBetweenChildren(availableCrossAxisSpace, distribution, lineContexts.size());
|
| }
|
| }
|
|
|
|
|