haikuwebkit/LayoutTests/printing/stretch-to-view-height-expe...

16 lines
366 B
Plaintext
Raw Permalink Normal View History

<rdar://problem/8257783> Short documents may print a second blank page https://bugs.webkit.org/show_bug.cgi?id=43271 Reviewed by Darin Adler. WebCore: Test: printing/stretch-to-view-height.html * WebCore.exp.in: Export Frame::forceLayoutForPagination(), replacing forceLayoutWithPageWidthRange(). * page/Frame.cpp: (WebCore::Frame::setPrinting): Now takes a page width and height and a maximum shrink factor and passes them down to forceLayoutForPagination(). * page/Frame.h: (WebCore::Frame::): * page/FrameView.cpp: (WebCore::FrameView::reset): Initialize m_pageHeight. (WebCore::FrameView::forceLayoutForPagination): Renamed forceLayoutWithPageWidthRange() to this and changed it to take a page width and height and a maximum shrink factor. Sets m_pageHeight, which is queried by RenderBox::calcHeight() during layout. If the given pageHeight is 0, m_pageHeight is set to the visible height, retaining the behavior before this change. * page/FrameView.h: (WebCore::FrameView::pageHeight): Added this accessor. * page/PrintContext.cpp: (WebCore::PrintContext::begin): Added a height parameter, used when calling setPrinting(). (WebCore::PrintContext::end): Updated for setPrinting() changes. (WebCore::PrintContext::pageNumberForElement): Account for shrink-to-fit. (WebCore::PrintContext::pageProperty): Pass 0 for the height, retaining current behavior. (WebCore::PrintContext::numberOfPages): Account for shrink-to-fit. (WebCore::PrintContext::spoolAllPagesWithBoundaries): Pass the page width to begin(). * page/PrintContext.h: * rendering/RenderBox.cpp: (WebCore::RenderBox::calcHeight): When printing, use FrameView::pageHeight() as the basis for viewport-relative heights. WebKit/mac: * WebView/WebHTMLView.mm: (-[WebHTMLView _web_setPrintingModeRecursive]): Updated for additional height parameter to _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:. (-[WebHTMLView _web_clearPrintingModeRecursive]): Ditto. (-[WebHTMLView _web_setPrintingModeRecursiveAndAdjustViewSize]): Ditto. (-[WebHTMLView _beginPrintModeWithPageWidth:height:shrinkToFit:]): Added height parameter, which is scaled and passed on to _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:. (-[WebHTMLView _endPrintMode]): Updated for additional height parameter to _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:. (-[WebHTMLView layoutToMinimumPageWidth:height:maximumPageWidth:adjustingViewSize:]): Added height parameter, which is passed on to FrameView::forceLayoutForPagination(). (-[WebHTMLView layout]): Updated for additional height parameter. (-[WebHTMLView _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:]): Added height parameter, which is passed on to -layoutToMinimumPageWidth:height:maximumPageWidth:adjustViewSize:. (-[WebHTMLView adjustPageHeightNew:top:bottom:limit:]): Updated for additional height parameter. (-[WebHTMLView setPageWidthForPrinting:]): Ditto. (-[WebHTMLView knowsPageRange:]): Pass the available height on the page on to _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize. * WebView/WebHTMLViewPrivate.h: WebKit/win: * WebFrame.cpp: (WebFrame::setPrinting): Updated for changes to Frame::setPrinting(). Passing 0 for the page height, which maintains existing behavior. LayoutTests: * platform/mac/printing/media-queries-print-expected.txt: * printing/page-break-margin-collapsed-expected.txt: * printing/resources/paged-media-test-utils.js: (ratioToPageHeightToPixels): Changed to reflect the default shrink factor of 1.25. * printing/script-tests/stretch-to-view-height.js: Added. (test): * printing/stretch-to-view-height-expected.txt: Added. * printing/stretch-to-view-height.html: Added. Canonical link: https://commits.webkit.org/55231@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64409 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-31 05:59:02 +00:00
Test that the height of elements whose height depends on the viewport height is computed relative to the page height when printing.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS: number of pages is 1
PASS: number of pages is 1
PASS: number of pages is 1
All tests passed
PASS successfullyParsed is true
TEST COMPLETE