Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1014)

Unified Diff: Source/core/layout/LayoutBlock.cpp

Issue 1121173002: Fix shrink-to-fit when children's writing-mode is orthogonal (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/LayoutBlock.h ('k') | Source/core/layout/LayoutBlockFlow.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/core/layout/LayoutBlock.h ('k') | Source/core/layout/LayoutBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698