Chromium Code Reviews| Index: Source/core/layout/LayoutFlexibleBox.cpp |
| diff --git a/Source/core/layout/LayoutFlexibleBox.cpp b/Source/core/layout/LayoutFlexibleBox.cpp |
| index e1f9fede5c8486e6d1330b4978243dbf0ff78813..2f0d0d2d171db9215ecccdb272cfb77ee1168e33 100644 |
| --- a/Source/core/layout/LayoutFlexibleBox.cpp |
| +++ b/Source/core/layout/LayoutFlexibleBox.cpp |
| @@ -411,8 +411,8 @@ LayoutUnit LayoutFlexibleBox::computeMainAxisExtentForChild(LayoutBox& child, Si |
| // Otherwise we need the logical height. |
| if (isHorizontalFlow() != child.styleRef().isHorizontalWritingMode()) { |
| // We don't have to check for "auto" here - computeContentLogicalHeight will just return -1 for that case anyway. |
| - if (size.isIntrinsic()) |
| - child.layoutIfNeeded(); |
| + // It's safe to access scrollbarLogicalHeight here because computeNextFlexLine will have already |
| + // forced layout on the child. |
| return child.computeContentLogicalHeight(sizeType, size, child.logicalHeight() - child.borderAndPaddingLogicalHeight()) + child.scrollbarLogicalHeight(); |
| } |
| return child.computeLogicalWidthUsing(sizeType, size, contentLogicalWidth(), this) - child.borderAndPaddingLogicalWidth(); |
| @@ -605,7 +605,8 @@ bool LayoutFlexibleBox::mainAxisLengthIsDefinite(LayoutBox& child, const Length& |
| bool LayoutFlexibleBox::childFlexBaseSizeRequiresLayout(LayoutBox& child) const |
| { |
| - return !mainAxisLengthIsDefinite(child, flexBasisForChild(child)) && hasOrthogonalFlow(child); |
| + return !mainAxisLengthIsDefinite(child, flexBasisForChild(child)) && ( |
| + hasOrthogonalFlow(child) || crossAxisOverflowForChild(child) == OAUTO); |
| } |
| LayoutUnit LayoutFlexibleBox::computeInnerFlexBaseSizeForChild(LayoutBox& child, ChildLayoutType childLayoutType) |
| @@ -618,14 +619,14 @@ LayoutUnit LayoutFlexibleBox::computeInnerFlexBaseSizeForChild(LayoutBox& child, |
| Length flexBasis = flexBasisForChild(child); |
| if (!mainAxisLengthIsDefinite(child, flexBasis)) { |
| LayoutUnit mainAxisExtent; |
| - if (hasOrthogonalFlow(child)) { |
| + if (childFlexBaseSizeRequiresLayout(child)) { |
| if (childLayoutType == NeverLayout) |
| return LayoutUnit(); |
| if (child.needsLayout() || childLayoutType == ForceLayout || !m_intrinsicSizeAlongMainAxis.contains(&child)) { |
| m_intrinsicSizeAlongMainAxis.remove(&child); |
| child.forceChildLayout(); |
| - m_intrinsicSizeAlongMainAxis.set(&child, child.logicalHeight()); |
| + m_intrinsicSizeAlongMainAxis.set(&child, hasOrthogonalFlow(child) ? child.logicalHeight() : child.logicalWidth()); |
| } |
| mainAxisExtent = m_intrinsicSizeAlongMainAxis.get(&child); |
| } else { |
| @@ -898,6 +899,18 @@ bool LayoutFlexibleBox::computeNextFlexLine(OrderedFlexItemList& orderedChildren |
| continue; |
| } |
| + // If this condition is true, then computeMainAxisExtentForChild will call |
|
leviw_travelin_and_unemployed
2015/08/20 18:53:06
Extract into a named function?
szager1
2015/08/20 21:53:29
Done.
|
| + // child.contentLogicalHeight() and child.scrollbarLogicalHeight(), so... |
| + if (isHorizontalFlow() != child->styleRef().isHorizontalWritingMode()) { |
| + // ... if the child has intrinsic min/max/preferred size, run layout on it now to make |
| + // sure its logical height and scroll bars are up-to-date. |
| + Length childFlexBasis = flexBasisForChild(*child); |
| + Length childMinSize = isHorizontalFlow() ? child->style()->minWidth() : child->style()->minHeight(); |
| + Length childMaxSize = isHorizontalFlow() ? child->style()->maxWidth() : child->style()->maxHeight(); |
| + if (childFlexBasis.isIntrinsic() || childMinSize.isIntrinsic() || childMaxSize.isIntrinsic()) |
| + child->layoutIfNeeded(); |
| + } |
| + |
| LayoutUnit childInnerFlexBaseSize = computeInnerFlexBaseSizeForChild(*child, relayoutChildren ? ForceLayout : LayoutIfNeeded); |
| LayoutUnit childMainAxisMarginBorderPadding = mainAxisBorderAndPaddingExtentForChild(*child) |
| + (isHorizontalFlow() ? child->marginWidth() : child->marginHeight()); |
| @@ -1102,6 +1115,12 @@ EOverflow LayoutFlexibleBox::mainAxisOverflowForChild(LayoutBox& child) const |
| return child.styleRef().overflowY(); |
| } |
| +EOverflow LayoutFlexibleBox::crossAxisOverflowForChild(LayoutBox& child) const |
| +{ |
| + if (isHorizontalFlow()) |
| + return child.styleRef().overflowY(); |
| + return child.styleRef().overflowX(); |
| +} |
| void LayoutFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, const OrderedFlexItemList& children, const Vector<LayoutUnit, 16>& childSizes, LayoutUnit availableFreeSpace, bool relayoutChildren, SubtreeLayoutScope& layoutScope, Vector<LineContext>& lineContexts) |
| { |
| ASSERT(childSizes.size() == children.size()); |