Index: Source/core/layout/LayoutBlock.cpp |
diff --git a/Source/core/layout/LayoutBlock.cpp b/Source/core/layout/LayoutBlock.cpp |
index f9b493b9844ca95fb63757a302ec7634069e2145..7f11f8bf907c283542259916abd9a8c94bbe7c5a 100644 |
--- a/Source/core/layout/LayoutBlock.cpp |
+++ b/Source/core/layout/LayoutBlock.cpp |
@@ -154,6 +154,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. |
@@ -3063,12 +3064,7 @@ void LayoutBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth |
margin = marginStart + marginEnd; |
LayoutUnit childMinPreferredLogicalWidth, childMaxPreferredLogicalWidth; |
- if (child->isBox() && child->isHorizontalWritingMode() != isHorizontalWritingMode()) { |
- childMinPreferredLogicalWidth = childMaxPreferredLogicalWidth = toLayoutBox(child)->computeLogicalHeightWithoutLayout(); |
- } else { |
- childMinPreferredLogicalWidth = child->minPreferredLogicalWidth(); |
- childMaxPreferredLogicalWidth = child->maxPreferredLogicalWidth(); |
- } |
+ minMaxPreferredLogicalWidthOfChild(*child, childMinPreferredLogicalWidth, childMaxPreferredLogicalWidth); |
LayoutUnit w = childMinPreferredLogicalWidth + margin; |
minLogicalWidth = std::max(w, minLogicalWidth); |
@@ -3116,6 +3112,30 @@ void LayoutBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth |
maxLogicalWidth = std::max(floatLeftWidth + floatRightWidth, maxLogicalWidth); |
} |
+void LayoutBlock::minMaxPreferredLogicalWidthOfChild(LayoutObject& child, LayoutUnit& minPreferredLogicalWidth, LayoutUnit& maxPreferredLogicalWidth) const |
+{ |
+ ASSERT(child.parent() == this); |
+ |
+ if (!(child.isBox() && toLayoutBox(child).isWritingModeOrthogonalToParent())) { |
+ minPreferredLogicalWidth = child.minPreferredLogicalWidth(); |
+ maxPreferredLogicalWidth = child.maxPreferredLogicalWidth(); |
+ return; |
+ } |
+ |
+#ifdef CRBUG410320_APPROACH_1 |
+ child.layoutIfNeeded(); |
+#else |
+ // 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).computeLogicalHeightWithoutLayout(); |
+ m_needsRecalcLogicalWidthAfterLayoutChildren = true; |
+ return; |
+ } |
+#endif |
+ minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child).logicalHeight(); |
+} |
+ |
bool LayoutBlock::hasLineIfEmpty() const |
{ |
if (!node()) |