Changeset 262363 in webkit


Ignore:
Timestamp:
May 31, 2020 11:02:42 AM (4 years ago)
Author:
Alan Bujtas
Message:

[iBooks] Empty pages appear in book
https://bugs.webkit.org/show_bug.cgi?id=212573
<rdar://problem/62912623>

Reviewed by Antti Koivisto.

Source/WebCore:

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):

LayoutTests:

  • fast/multicol/orphans-ignored-expected.html: Added.
  • fast/multicol/orphans-ignored.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r262360 r262363  
     12020-05-31  Zalan Bujtas  <zalan@apple.com>
     2
     3        [iBooks] Empty pages appear in book
     4        https://bugs.webkit.org/show_bug.cgi?id=212573
     5        <rdar://problem/62912623>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        * fast/multicol/orphans-ignored-expected.html: Added.
     10        * fast/multicol/orphans-ignored.html: Added.
     11
    1122020-05-31  Rob Buis  <rbuis@igalia.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r262360 r262363  
     12020-05-31  Zalan Bujtas  <zalan@apple.com>
     2
     3        [iBooks] Empty pages appear in book
     4        https://bugs.webkit.org/show_bug.cgi?id=212573
     5        <rdar://problem/62912623>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Do not add a page break for orphan content unless the line does not fit anymore.
     10
     11        Test: fast/multicol/orphans-ignored.html
     12
     13        * rendering/SimpleLineLayoutPagination.cpp:
     14        (WebCore::SimpleLineLayout::setPageBreakForLine):
     15        (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
     16
    1172020-05-31  Rob Buis  <rbuis@igalia.com>
    218
  • trunk/Source/WebCore/rendering/SimpleLineLayoutPagination.cpp

    r245543 r262363  
    9696
    9797static void setPageBreakForLine(unsigned lineBreakIndex, PaginatedLines& lines, RenderBlockFlow& flow, Layout::SimpleLineStruts& struts,
    98     bool atTheTopOfColumnOrPage)
     98    bool atTheTopOfColumnOrPage, bool lineDoesNotFit)
    9999{
    100100    auto line = lines.at(lineBreakIndex);
     
    102102    auto& style = flow.style();
    103103    auto firstLineDoesNotFit = !lineBreakIndex && line.height < flow.pageLogicalHeightForOffset(line.top);
    104     auto orphanDoesNotFit = !style.hasAutoOrphans() && style.orphans() > (short)lineBreakIndex;
    105     if (firstLineDoesNotFit || orphanDoesNotFit) {
     104    auto moveOrphanToNextColumn = lineDoesNotFit && !style.hasAutoOrphans() && style.orphans() > (short)lineBreakIndex;
     105    if (firstLineDoesNotFit || moveOrphanToNextColumn) {
    106106        auto firstLine = lines.first();
    107107        auto firstLineOverflowRect = computeOverflow(flow, LayoutRect(0_lu, firstLine.top, 0_lu, firstLine.height));
     
    147147        auto remainingHeight = flow.pageRemainingLogicalHeightForOffset(line.top, RenderBlockFlow::ExcludePageBoundary);
    148148        auto atTheTopOfColumnOrPage = flow.pageLogicalHeightForOffset(line.top) == remainingHeight;
    149         if (line.height > remainingHeight || (atTheTopOfColumnOrPage && lineIndex)) {
     149        auto lineDoesNotFit = line.height > remainingHeight;
     150        if (lineDoesNotFit || (atTheTopOfColumnOrPage && lineIndex)) {
    150151            auto lineBreakIndex = computeLineBreakIndex(lineIndex, lineCount, orphans, widows, struts);
    151152            // Are we still at the top of the column/page?
    152153            atTheTopOfColumnOrPage = atTheTopOfColumnOrPage ? lineIndex == lineBreakIndex : false;
    153             setPageBreakForLine(lineBreakIndex, lines, flow, struts, atTheTopOfColumnOrPage);
     154            setPageBreakForLine(lineBreakIndex, lines, flow, struts, atTheTopOfColumnOrPage, lineDoesNotFit);
    154155            // Recompute line positions that we already visited but widow break pushed them to a new page.
    155156            for (auto i = lineBreakIndex; i < lines.size(); ++i)
Note: See TracChangeset for help on using the changeset viewer.