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

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

Issue 2360253002: Content that starts before the first fragmentainer should stay where it is. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fragmentation/content-preceding-first-fragmentainer.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
index 5fbf5297154be2d5a76a7906402f87f0535bce1a..b30e1616ce0df0824d3faa1fcc16b1708d203423 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -980,6 +980,7 @@ void LayoutBlockFlow::adjustLinePositionForPagination(RootInlineBox& lineBox, La
return;
}
+ LayoutUnit strutToPropagate;
if (remainingLogicalHeight == pageLogicalHeight) {
// We're at the very top of a page or column.
if (lineBox != firstRootBox())
@@ -988,10 +989,8 @@ void LayoutBlockFlow::adjustLinePositionForPagination(RootInlineBox& lineBox, La
// case it's a float) margin, we may want to set a strut on the block, so that everything
// ends up in the next column or page. Setting a strut on the block is also important when
// it comes to satisfying orphan requirements.
- if (shouldSetStrutOnBlock(*this, lineBox, logicalOffset, lineIndex, pageLogicalHeight)) {
- LayoutUnit strut = logicalOffset + marginBeforeIfFloating();
- setPaginationStrutPropagatedFromChild(strut);
- }
+ if (shouldSetStrutOnBlock(*this, lineBox, logicalOffset, lineIndex, pageLogicalHeight))
+ strutToPropagate = logicalOffset + marginBeforeIfFloating();
} else if (lineBox == firstRootBox() && allowsPaginationStrut()) {
// This is the first line in the block. The block may still start in the previous column or
// page, and if that's the case, attempt to pull it over to where this line is, so that we
@@ -1003,10 +1002,18 @@ void LayoutBlockFlow::adjustLinePositionForPagination(RootInlineBox& lineBox, La
// room for the top border, padding and (if it's a float) margin and the line in one
// column or page.
if (totalLogicalOffset + lineHeight <= pageLogicalHeight)
- setPaginationStrutPropagatedFromChild(strut);
+ strutToPropagate = strut;
}
}
+ // If we found that some preceding content (lines, border and padding) belongs together with
+ // this line, we should pull the entire block with us to the fragmentainer we're currently
+ // in. We need to avoid this when the block precedes the first fragmentainer, though. We
+ // shouldn't fragment content there, but rather let it appear in the overflow area before the
+ // first fragmentainer.
+ if (strutToPropagate && offsetFromLogicalTopOfFirstPage() > LayoutUnit())
+ setPaginationStrutPropagatedFromChild(strutToPropagate);
+
paginatedContentWasLaidOut(logicalOffset + lineHeight);
}
« no previous file with comments | « third_party/WebKit/LayoutTests/fragmentation/content-preceding-first-fragmentainer.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698