Changeset 116986 in webkit


Ignore:
Timestamp:
May 14, 2012 1:04:37 PM (12 years ago)
Author:
mitz@apple.com
Message:

Pagination splits lines that could fit on a single page if it were not for their top leading
https://bugs.webkit.org/show_bug.cgi?id=86388

Reviewed by Darin Adler.

Source/WebCore:

Test: fast/multicol/split-in-top-margin.html

When a line’s visible content fits on a page, but adding the top leading makes it taller than
a page, instead of giving up and splitting the line in an arbitrary position, add a strut
to push it downwards so that the split occurs in the top leading, and the visible content is
fully contained on a single page.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::adjustLinePositionForPagination):

LayoutTests:

  • fast/multicol/split-in-top-margin-expected.html: Added.
  • fast/multicol/split-in-top-margin.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r116985 r116986  
     12012-05-14  Dan Bernstein  <mitz@apple.com>
     2
     3        Pagination splits lines that could fit on a single page if it were not for their top leading
     4        https://bugs.webkit.org/show_bug.cgi?id=86388
     5
     6        Reviewed by Darin Adler.
     7
     8        * fast/multicol/split-in-top-margin-expected.html: Added.
     9        * fast/multicol/split-in-top-margin.html: Added.
     10
    1112012-05-14  Joshua Bell  <jsbell@chromium.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r116983 r116986  
     12012-05-14  Dan Bernstein  <mitz@apple.com>
     2
     3        Pagination splits lines that could fit on a single page if it were not for their top leading
     4        https://bugs.webkit.org/show_bug.cgi?id=86388
     5
     6        Reviewed by Darin Adler.
     7
     8        Test: fast/multicol/split-in-top-margin.html
     9
     10        When a line’s visible content fits on a page, but adding the top leading makes it taller than
     11        a page, instead of giving up and splitting the line in an arbitrary position, add a strut
     12        to push it downwards so that the split occurs in the top leading, and the visible content is
     13        fully contained on a single page.
     14
     15        * rendering/RenderBlock.cpp:
     16        (WebCore::RenderBlock::adjustLinePositionForPagination):
     17
    1182012-05-14  Terry Anderson  <tdanderson@chromium.org>
    219
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r116798 r116986  
    67746774    LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
    67756775    bool hasUniformPageLogicalHeight = !inRenderFlowThread() || enclosingRenderFlowThread()->regionsHaveUniformLogicalHeight();
    6776     if (!pageLogicalHeight || (hasUniformPageLogicalHeight && lineHeight > pageLogicalHeight)
     6776    // If lineHeight is greater than pageLogicalHeight, but logicalVisualOverflow.height() still fits, we are
     6777    // still going to add a strut, so that the visible overflow fits on a single page.
     6778    if (!pageLogicalHeight || (hasUniformPageLogicalHeight && logicalVisualOverflow.height() > pageLogicalHeight)
    67776779        || !hasNextPage(logicalOffset))
    67786780        return;
     
    67826784        if (!hasUniformPageLogicalHeight && !pushToNextPageWithMinimumLogicalHeight(remainingLogicalHeight, logicalOffset, lineHeight))
    67836785            return;
     6786        if (lineHeight > pageLogicalHeight) {
     6787            // Split the top margin in order to avoid splitting the visible part of the line.
     6788            remainingLogicalHeight -= min(lineHeight - pageLogicalHeight, max(ZERO_LAYOUT_UNIT, logicalVisualOverflow.y() - lineBox->lineTopWithLeading()));
     6789        }
    67846790        LayoutUnit totalLogicalHeight = lineHeight + max(ZERO_LAYOUT_UNIT, logicalOffset);
    67856791        LayoutUnit pageLogicalHeightAtNewOffset = hasUniformPageLogicalHeight ? pageLogicalHeight : pageLogicalHeightForOffset(logicalOffset + remainingLogicalHeight);
Note: See TracChangeset for help on using the changeset viewer.