Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp |
| index 7731d3cd45876fd98dfce9b163df1b9a6a62a3e1..1ac87b19afd905f773903aa4c717cc8fe8d3a846 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp |
| @@ -181,7 +181,7 @@ int LayoutFlexibleBox::baselinePosition(FontBaseline, bool, LineDirectionMode di |
| return beforeMarginInLineDirection(direction) + baseline; |
| } |
| -static const StyleContentAlignmentData& normalValueBehavior() |
| +static const StyleContentAlignmentData& contentAlignmentNormalBehavior() |
| { |
| // The justify-content property applies along the main axis, but since flexing |
| // in the main axis is controlled by flex, stretch behaves as flex-start (ignoring |
| @@ -305,21 +305,6 @@ void LayoutFlexibleBox::removeChild(LayoutObject* child) |
| m_intrinsicSizeAlongMainAxis.remove(child); |
| } |
| -void LayoutFlexibleBox::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle) |
| -{ |
| - LayoutBlock::styleDidChange(diff, oldStyle); |
| - |
| - if (oldStyle && oldStyle->alignItemsPosition() == ItemPositionStretch && 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)) |
| - child->setChildNeedsLayout(MarkOnlyThis); |
| - } |
| - } |
| -} |
| - |
| void LayoutFlexibleBox::layoutBlock(bool relayoutChildren) |
| { |
| ASSERT(needsLayout()); |
| @@ -1331,6 +1316,7 @@ static LayoutUnit alignmentOffset(LayoutUnit availableFreeSpace, ItemPosition po |
| { |
| switch (position) { |
| case ItemPositionAuto: |
| + case ItemPositionNormal: |
| ASSERT_NOT_REACHED(); |
| break; |
| case ItemPositionStretch: |
| @@ -1379,8 +1365,8 @@ LayoutUnit LayoutFlexibleBox::staticMainAxisPositionForPositionedChild(const Lay |
| { |
| const LayoutUnit availableSpace = mainAxisContentExtent(contentLogicalHeight()) - mainAxisExtentForChild(child); |
| - ContentPosition position = styleRef().resolvedJustifyContentPosition(normalValueBehavior()); |
| - ContentDistributionType distribution = styleRef().resolvedJustifyContentDistribution(normalValueBehavior()); |
| + ContentPosition position = styleRef().resolvedJustifyContentPosition(contentAlignmentNormalBehavior()); |
| + ContentDistributionType distribution = styleRef().resolvedJustifyContentDistribution(contentAlignmentNormalBehavior()); |
| LayoutUnit offset = initialJustifyContentOffset(availableSpace, position, distribution, 1); |
| if (styleRef().flexDirection() == FlowRowReverse || styleRef().flexDirection() == FlowColumnReverse) |
| offset = availableSpace - offset; |
| @@ -1452,7 +1438,11 @@ void LayoutFlexibleBox::prepareChildForPositionedLayout(LayoutBox& child) |
| ItemPosition LayoutFlexibleBox::alignmentForChild(const LayoutBox& child) const |
| { |
| - ItemPosition align = ComputedStyle::resolveAlignment(styleRef(), child.styleRef(), ItemPositionStretch); |
| + // TODO (lajava) We should only need to resolve 'auto' values again in case of an anonymous |
| + // Flex item, however, LayoutFullScreen inserts an Anonymous box between Flex container and |
| + // its childnre, expecting to propagate its align-items property's value to the Flex items. |
|
Timothy Loh
2016/06/29 02:00:32
typo childnre
jfernandez
2016/06/29 19:55:47
Actually, this TODO is not needed anymore, since w
|
| + ItemPosition align = child.styleRef().resolvedAlignSelf(selfAlignmentNormalBehavior(), child.isAnonymous() ? style() : nullptr).position(); |
| + DCHECK(align != ItemPositionAuto && align != ItemPositionNormal); |
| if (align == ItemPositionBaseline && hasOrthogonalFlow(child)) |
| align = ItemPositionFlexStart; |
| @@ -1545,8 +1535,8 @@ void LayoutFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons |
| { |
| ASSERT(childSizes.size() == children.size()); |
| - ContentPosition position = styleRef().resolvedJustifyContentPosition(normalValueBehavior()); |
| - ContentDistributionType distribution = styleRef().resolvedJustifyContentDistribution(normalValueBehavior()); |
| + ContentPosition position = styleRef().resolvedJustifyContentPosition(contentAlignmentNormalBehavior()); |
| + ContentDistributionType distribution = styleRef().resolvedJustifyContentDistribution(contentAlignmentNormalBehavior()); |
| size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(children); |
| LayoutUnit autoMarginOffset = autoMarginOffsetInMainAxis(children, availableFreeSpace); |
| @@ -1647,8 +1637,8 @@ void LayoutFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons |
| void LayoutFlexibleBox::layoutColumnReverse(const OrderedFlexItemList& children, LayoutUnit crossAxisOffset, LayoutUnit availableFreeSpace) |
| { |
| - ContentPosition position = styleRef().resolvedJustifyContentPosition(normalValueBehavior()); |
| - ContentDistributionType distribution = styleRef().resolvedJustifyContentDistribution(normalValueBehavior()); |
| + ContentPosition position = styleRef().resolvedJustifyContentPosition(contentAlignmentNormalBehavior()); |
| + ContentDistributionType distribution = styleRef().resolvedJustifyContentDistribution(contentAlignmentNormalBehavior()); |
| // 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 |
| @@ -1707,8 +1697,8 @@ static LayoutUnit alignContentSpaceBetweenChildren(LayoutUnit availableFreeSpace |
| void LayoutFlexibleBox::alignFlexLines(Vector<LineContext>& lineContexts) |
| { |
| - ContentPosition position = styleRef().resolvedAlignContentPosition(normalValueBehavior()); |
| - ContentDistributionType distribution = styleRef().resolvedAlignContentDistribution(normalValueBehavior()); |
| + ContentPosition position = styleRef().resolvedAlignContentPosition(contentAlignmentNormalBehavior()); |
| + ContentDistributionType distribution = styleRef().resolvedAlignContentDistribution(contentAlignmentNormalBehavior()); |
| // If we have a single line flexbox or a multiline line flexbox with only one flex line, |
| // the line height is all the available space. |