2011-06-13  Kentaro Hara  <haraken@google.com>

        Reviewed by Alexey Proskuryakov.

        Add a new test for checking rounding error in printing codes
        https://bugs.webkit.org/show_bug.cgi?id=61256

        Add a new test (printing/page-count-with-one-word.html). This test
        checks if only one page is printed for an HTML page with one word for
        various paper sizes around A4 portrait size, i.e. [530px, 560px) for
        width and [730px, 760px) for height.

        * printing/page-count-with-one-word-expected.txt: Added.
        * printing/page-count-with-one-word.html: Added.
2011-06-13  Kentaro Hara  <haraken@google.com>

        Reviewed by Alexey Proskuryakov.

        Add resizePageRectsKeepingRatio(), which expands/shrinks a page, keeping the ratio of the original page
        https://bugs.webkit.org/show_bug.cgi?id=61256

        In order to prevent rounding error caused by expanding/shrinking a page
        using different calculation here and there, I added a common calculation
        method, resizePageRectsKeepingRatio(), which expands/shrinks a page,
        keeping the ratio of width and height of the original page.
        PrintContext::computePageRects() and PrintContext::begin()
        use resizePageRectsKeepingRatio() to expand/shrink a page.

        Test: printing/page-count-with-one-word.html

        * WebCore.exp.in:
        * page/Frame.cpp:
        (WebCore::Frame::resizePageRectsKeepingRatio):
        * page/Frame.h:
        * page/PrintContext.cpp:
        (WebCore::PrintContext::computePageRects):
        (WebCore::PrintContext::begin):
2011-06-13  Kentaro Hara  <haraken@google.com>

        Reviewed by Alexey Proskuryakov.

        Add resizePageRectsKeepingRatio(), which expands/shrinks a page, keeping the ratio of the original page
        https://bugs.webkit.org/show_bug.cgi?id=61256

        In order to prevent rounding error caused by expanding/shrinking a page
        using different calculation here and there, I added a common calculation
        method, resizePageRectsKeepingRatio(), which expands/shrinks a page,
        keeping the ratio of width and height of the original page.
        [WebHTMLView _beginPrintModeWithPageWidth:height:shrinkToFit:]
        and [WebHTMLView _beginScreenPaginationModeWithPageSize:shrinkToFit:]
        use resizePageRectsKeepingRatio() to expand/shrink a page.

        Test: printing/page-count-with-one-word.html

        * WebView/WebHTMLView.mm:
        (-[WebHTMLView _web_setPrintingModeRecursive]):
        (-[WebHTMLView _web_clearPrintingModeRecursive]):
        (-[WebHTMLView _web_setPrintingModeRecursiveAndAdjustViewSize]):
        (-[WebHTMLView _beginPrintModeWithMinimumPageWidth:height:maximumShrinkRatio:]):
        (-[WebHTMLView _beginPrintModeWithPageWidth:height:shrinkToFit:]):
        (-[WebHTMLView _endPrintMode]):
        (-[WebHTMLView _beginScreenPaginationModeWithPageSize:shrinkToFit:]):
        (-[WebHTMLView _endScreenPaginationMode]):
        (-[WebHTMLView layoutToMinimumPageWidth:height:maximumShrinkRatio:adjustingViewSize:]):
        (-[WebHTMLView layout]):
        (-[WebHTMLView _setPrinting:minimumPageLogicalWidth:logicalHeight:maximumShrinkRatio:adjustViewSize:paginateScreenContent:]):
        (-[WebHTMLView adjustPageHeightNew:top:bottom:limit:]):
        (-[WebHTMLView setPageWidthForPrinting:]):
2011-06-13  Kentaro Hara  <haraken@google.com>

        Reviewed by Alexey Proskuryakov.

        Add resizePageRectsKeepingRatio(), which expands/shrinks a page, keeping the ratio of the original page
        https://bugs.webkit.org/show_bug.cgi?id=61256

        In order to prevent rounding error caused by expanding/shrinking a page
        using different calculation here and there, I added a common calculation
        method, resizePageRectsKeepingRatio(), which expands/shrinks a page,
        keeping the ratio of width and height of the original page.
        WebFrame::setInPrintingMode() uses resizePageRectsKeepingRatio() to
        expand/shrink a page.

        Test: printing/page-count-with-one-word.html

        * WebFrame.cpp:
        (WebFrame::setPrinting):
        (WebFrame::setInPrintingMode):
        * WebFrame.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@88737 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed