Modified: trunk/LayoutTests/ChangeLog (262362 => 262363)
--- trunk/LayoutTests/ChangeLog 2020-05-31 14:56:06 UTC (rev 262362)
+++ trunk/LayoutTests/ChangeLog 2020-05-31 18:02:42 UTC (rev 262363)
@@ -1,3 +1,14 @@
+2020-05-31 Zalan Bujtas <[email protected]>
+
+ [iBooks] Empty pages appear in book
+ https://bugs.webkit.org/show_bug.cgi?id=212573
+ <rdar://problem/62912623>
+
+ Reviewed by Antti Koivisto.
+
+ * fast/multicol/orphans-ignored-expected.html: Added.
+ * fast/multicol/orphans-ignored.html: Added.
+
2020-05-31 Rob Buis <[email protected]>
Implement named item condition for images
Added: trunk/LayoutTests/fast/multicol/orphans-ignored-expected.html (0 => 262363)
--- trunk/LayoutTests/fast/multicol/orphans-ignored-expected.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/orphans-ignored-expected.html 2020-05-31 18:02:42 UTC (rev 262363)
@@ -0,0 +1,32 @@
+<script>
+ if (window.internals) {
+ internals.setPagination("LeftToRightPaginated", 0);
+ internals.settings.setSimpleLineLayoutEnabled(false);
+ }
+</script>
+<body>
+<div style="font: 40px ahem; orphans: 2;">
+<p>
+size<br>
+the<br>
+window<br>
+to<br>
+have<br>
+only<br>
+one<br>
+orphan<br>
+line<br>
+in<br>
+this<br>
+column<br>
+from<br>
+the<br>
+next<br>
+paragraph<br>
+</p>
+<p>
+this line should be left orphan<br>
+though<br>
+style says 2.<br>
+</p>
+</div>
Added: trunk/LayoutTests/fast/multicol/orphans-ignored.html (0 => 262363)
--- trunk/LayoutTests/fast/multicol/orphans-ignored.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/orphans-ignored.html 2020-05-31 18:02:42 UTC (rev 262363)
@@ -0,0 +1,32 @@
+<script>
+ if (window.internals) {
+ internals.setPagination("LeftToRightPaginated", 0);
+ internals.settings.setSimpleLineLayoutEnabled(true);
+ }
+</script>
+<body>
+<div style="font: 40px ahem; orphans: 2;">
+<p>
+size<br>
+the<br>
+window<br>
+to<br>
+have<br>
+only<br>
+one<br>
+orphan<br>
+line<br>
+in<br>
+this<br>
+column<br>
+from<br>
+the<br>
+next<br>
+paragraph<br>
+</p>
+<p>
+this line should be left orphan<br>
+though<br>
+style says 2.<br>
+</p>
+</div>
Modified: trunk/Source/WebCore/ChangeLog (262362 => 262363)
--- trunk/Source/WebCore/ChangeLog 2020-05-31 14:56:06 UTC (rev 262362)
+++ trunk/Source/WebCore/ChangeLog 2020-05-31 18:02:42 UTC (rev 262363)
@@ -1,3 +1,19 @@
+2020-05-31 Zalan Bujtas <[email protected]>
+
+ [iBooks] Empty pages appear in book
+ https://bugs.webkit.org/show_bug.cgi?id=212573
+ <rdar://problem/62912623>
+
+ Reviewed by Antti Koivisto.
+
+ Do not add a page break for orphan content unless the line does not fit anymore.
+
+ Test: fast/multicol/orphans-ignored.html
+
+ * rendering/SimpleLineLayoutPagination.cpp:
+ (WebCore::SimpleLineLayout::setPageBreakForLine):
+ (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
+
2020-05-31 Rob Buis <[email protected]>
Implement named item condition for images
Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutPagination.cpp (262362 => 262363)
--- trunk/Source/WebCore/rendering/SimpleLineLayoutPagination.cpp 2020-05-31 14:56:06 UTC (rev 262362)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutPagination.cpp 2020-05-31 18:02:42 UTC (rev 262363)
@@ -95,14 +95,14 @@
}
static void setPageBreakForLine(unsigned lineBreakIndex, PaginatedLines& lines, RenderBlockFlow& flow, Layout::SimpleLineStruts& struts,
- bool atTheTopOfColumnOrPage)
+ bool atTheTopOfColumnOrPage, bool lineDoesNotFit)
{
auto line = lines.at(lineBreakIndex);
auto remainingLogicalHeight = flow.pageRemainingLogicalHeightForOffset(line.top, RenderBlockFlow::ExcludePageBoundary);
auto& style = flow.style();
auto firstLineDoesNotFit = !lineBreakIndex && line.height < flow.pageLogicalHeightForOffset(line.top);
- auto orphanDoesNotFit = !style.hasAutoOrphans() && style.orphans() > (short)lineBreakIndex;
- if (firstLineDoesNotFit || orphanDoesNotFit) {
+ auto moveOrphanToNextColumn = lineDoesNotFit && !style.hasAutoOrphans() && style.orphans() > (short)lineBreakIndex;
+ if (firstLineDoesNotFit || moveOrphanToNextColumn) {
auto firstLine = lines.first();
auto firstLineOverflowRect = computeOverflow(flow, LayoutRect(0_lu, firstLine.top, 0_lu, firstLine.height));
auto firstLineUpperOverhang = std::max(LayoutUnit(-firstLineOverflowRect.y()), 0_lu);
@@ -146,11 +146,12 @@
lines.append(line);
auto remainingHeight = flow.pageRemainingLogicalHeightForOffset(line.top, RenderBlockFlow::ExcludePageBoundary);
auto atTheTopOfColumnOrPage = flow.pageLogicalHeightForOffset(line.top) == remainingHeight;
- if (line.height > remainingHeight || (atTheTopOfColumnOrPage && lineIndex)) {
+ auto lineDoesNotFit = line.height > remainingHeight;
+ if (lineDoesNotFit || (atTheTopOfColumnOrPage && lineIndex)) {
auto lineBreakIndex = computeLineBreakIndex(lineIndex, lineCount, orphans, widows, struts);
// Are we still at the top of the column/page?
atTheTopOfColumnOrPage = atTheTopOfColumnOrPage ? lineIndex == lineBreakIndex : false;
- setPageBreakForLine(lineBreakIndex, lines, flow, struts, atTheTopOfColumnOrPage);
+ setPageBreakForLine(lineBreakIndex, lines, flow, struts, atTheTopOfColumnOrPage, lineDoesNotFit);
// Recompute line positions that we already visited but widow break pushed them to a new page.
for (auto i = lineBreakIndex; i < lines.size(); ++i)
lines.at(i) = computeLineTopAndBottomWithOverflow(flow, i, struts);