Index: Source/core/layout/LayoutBlock.cpp |
diff --git a/Source/core/layout/LayoutBlock.cpp b/Source/core/layout/LayoutBlock.cpp |
index 91be6d0f4b26b67c3b5905da41a38bce88c36bae..98eda75df1fdbe17ff306ef0d896851358aee99f 100644 |
--- a/Source/core/layout/LayoutBlock.cpp |
+++ b/Source/core/layout/LayoutBlock.cpp |
@@ -106,6 +106,7 @@ LayoutBlock::LayoutBlock(ContainerNode* node) |
, m_widthAvailableToChildrenChanged(false) |
, m_hasOnlySelfCollapsingChildren(false) |
, m_descendantsWithFloatsMarkedForLayout(false) |
+ , m_needsRecalcLogicalWidthAfterLayoutChildren(false) |
{ |
// LayoutBlockFlow calls setChildrenInline(true). |
// By default, subclasses do not have inline children. |
@@ -2149,11 +2150,20 @@ void LayoutBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth |
void LayoutBlock::computeChildPreferredLogicalWidths(LayoutObject& child, LayoutUnit& minPreferredLogicalWidth, LayoutUnit& maxPreferredLogicalWidth) const |
{ |
if (child.isBox() && child.isHorizontalWritingMode() != isHorizontalWritingMode()) { |
+ // If the child is an orthogonal flow, child's height determines the width, but the height is not available until layout. |
+ // http://dev.w3.org/csswg/css-writing-modes-3/#orthogonal-shrink-to-fit |
+ if (!child.needsLayout()) { |
+ minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child).logicalHeight(); |
+ return; |
+ } |
+ m_needsRecalcLogicalWidthAfterLayoutChildren = true; |
minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child).computeLogicalHeightWithoutLayout(); |
return; |
} |
minPreferredLogicalWidth = child.minPreferredLogicalWidth(); |
maxPreferredLogicalWidth = child.maxPreferredLogicalWidth(); |
+ if (child.isLayoutBlock() && toLayoutBlock(child).needsRecalcLogicalWidthAfterLayoutChildren()) |
+ m_needsRecalcLogicalWidthAfterLayoutChildren = true; |
} |
bool LayoutBlock::hasLineIfEmpty() const |