Skip to content
  • haraken@google.com's avatar
    A single line must not be split into two pages. · 89fcc858
    haraken@google.com authored
    https://bugs.webkit.org/show_bug.cgi?id=65005
    
    Reviewed by David Hyatt.
    
    When the document width of a page is overflowed, the last line of the page can be
    split into the next page. This is the regression caused by r88737. r88737 tried to
    fix rounding errors in rendering calculations by expanding and shrinking a page
    using one common method, resizePageRectsKeepingRatio(), but overlooked the case where
    a document width gets overflowed.
    
    Source/WebCore:
    
    This patch fixes the problem by also using resizePageRectsKeepingRatio() for the case
    where the document width gets overflowed.
    
    Test: printing/single-line-must-not-be-split-into-two-pages.html
    
    * WebCore.exp.in: Updated the signature of forceLayoutForPagination().
    * page/Frame.cpp:
    (WebCore::Frame::setPrinting): Added a new argument |originalPageSize|, which is an original page size before being expanded or shrunk.
    * page/Frame.h:
    * page/FrameView.cpp:
    (WebCore::FrameView::forceLayoutForPagination): Uses resizePageRectsKeepingRatio() in the case where the document width gets overflowed.
    * page/FrameView.h:
    * page/PrintContext.cpp:
    (WebCore::PrintContext::begin): Passes an original page size to setPrinting().
    (WebCore::PrintContext::end): Ditto.
    
    Source/WebKit/mac:
    
    Test: printing/single-line-must-not-be-split-into-two-pages.html
    
    * WebView/WebHTMLView.mm:
    (-[WebHTMLView _web_setPrintingModeRecursive]): Passes an original page size to setPrinting().
    (-[WebHTMLView _web_clearPrintingModeRecursive]): Ditto.
    (-[WebHTMLView _web_setPrintingModeRecursiveAndAdjustViewSize]): Ditto.
    (-[WebHTMLView _beginPrintModeWithMinimumPageWidth:height:maximumPageWidth:]): Ditto.
    (-[WebHTMLView _beginPrintModeWithPageWidth:height:shrinkToFit:]): Ditto.
    (-[WebHTMLView _endPrintMode]): Ditto.
    (-[WebHTMLView _beginScreenPaginationModeWithPageSize:shrinkToFit:]): Ditto.
    (-[WebHTMLView _endScreenPaginationMode]): Ditto.
    (-[WebHTMLView layoutToMinimumPageWidth:height:originalPageWidth:originalPageHeight:maximumShrinkRatio:adjustingViewSize:]): Ditto.
    (-[WebHTMLView layout]): Ditto.
    (-[WebHTMLView _setPrinting:minimumPageLogicalWidth:logicalHeight:originalPageWidth:originalPageHeight:maximumShrinkRatio:adjustViewSize:paginateScreenContent:]): Ditto.
    (-[WebHTMLView adjustPageHeightNew:top:bottom:limit:]): Ditto.
    (-[WebHTMLView setPageWidthForPrinting:]): Ditto.
    
    Source/WebKit/win:
    
    Test: printing/single-line-must-not-be-split-into-two-pages.html
    
    * WebFrame.cpp:
    (WebFrame::setPrinting): Passes an original page size to setPrinting().
    (WebFrame::setInPrintingMode): Ditto.
    * WebFrame.h:
    
    LayoutTests:
    
    The added test checks if the last line does not split across pages.
    
    * platform/chromium/test_expectations.txt: Skipped the added test since setPrinting() is not yet implemented.
    * platform/gtk/Skipped: Ditto.
    * platform/mac/printing/single-line-must-not-be-split-into-two-pages-expected.txt: Added.
    * platform/qt/Skipped: Ditto.
    * platform/win/Skipped: Ditto.
    * platform/wk2/Skipped: Ditto.
    * printing/single-line-must-not-be-split-into-two-pages.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@95249 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    89fcc858