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

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

Issue 1360753002: Only block container children support pagination struts. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: code review Created 5 years, 3 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
Index: Source/core/layout/LayoutBlockFlow.cpp
diff --git a/Source/core/layout/LayoutBlockFlow.cpp b/Source/core/layout/LayoutBlockFlow.cpp
index a4cb56f6fa16a237ad5bf135bd997928c4bebbdc..73f871ac2150440e2ac332a2bf69cdc872a8ffe3 100644
--- a/Source/core/layout/LayoutBlockFlow.cpp
+++ b/Source/core/layout/LayoutBlockFlow.cpp
@@ -781,9 +781,16 @@ static inline bool shouldSetStrutOnBlock(const LayoutBlockFlow& block, const Roo
if (totalLogicalHeight < pageLogicalHeightAtNewOffset)
wantsStrutOnBlock = true;
}
- // If we want to break before the block, one final check is needed, since some block object
- // types cannot handle struts.
- return wantsStrutOnBlock && !block.isOutOfFlowPositioned() && !block.isTableCell();
+ // The block needs to be contained by a LayoutBlockFlow (and not by e.g. a flexbox or a table
+ // (which would be the case for table cell or table caption)). The reason for this limitation is
+ // simply that LayoutBlockFlow child layout code is the only place where we pick up the struts
+ // and handle them. We handle floats and regular in-flow children, and that's all. We could
+ // handle this in other layout modes as well (and even for out-of-flow children), but currently
+ // we don't.
+ if (!wantsStrutOnBlock || block.isOutOfFlowPositioned())
+ return false;
+ LayoutBlock* containingBlock = block.containingBlock();
+ return containingBlock && containingBlock->isLayoutBlockFlow();
}
void LayoutBlockFlow::adjustLinePositionForPagination(RootInlineBox& lineBox, LayoutUnit& delta)
« no previous file with comments | « LayoutTests/fast/multicol/table-caption-and-cells-fixed-width-expected.html ('k') | Source/core/layout/LayoutTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698