[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

hyatt at apple.com hyatt at apple.com
Fri Jan 21 14:52:21 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 4ff438988a433a68a67a6467f09223f9722c69f2
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 3 18:55:03 2011 +0000

    https://bugs.webkit.org/show_bug.cgi?id=51328
    
    Reviewed by Simon Fraser.
    
    WebCore:
    
    Printing on a page with body { height: 100% } clips out the overflow contents.  This happened
    because the computePageRects function was never correct.  It was using the layer's width and height
    for the document's width and height, and the layer no longer includes overflow in its width and
    height.  It was also incorrectly assuming the first page would begin at (0,0), and this is an invalid
    assumption in RTL or vertical text environments.
    
    Added printing/page-count-percentage-height.html
    
    * page/PrintContext.cpp:
    (WebCore::PrintContext::computePageRects):
    (WebCore::PrintContext::computePageRectsWithPageSizeInternal):
    
    LayoutTests:
    
    Add layout test for printing clipping bug.
    
    * printing/page-count-percentage-height-expected.txt: Added.
    * printing/page-count-percentage-height.html: Added.
    * printing/script-tests/page-count-percentage-height.js: Added.
    (test):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74908 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7d58e34..f7c7238 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2011-01-03  David Hyatt  <hyatt at apple.com>
+
+        Reviewed by Simon Fraser.
+
+        https://bugs.webkit.org/show_bug.cgi?id=51328
+
+        Add layout test for printing clipping bug.
+
+        * printing/page-count-percentage-height-expected.txt: Added.
+        * printing/page-count-percentage-height.html: Added.
+        * printing/script-tests/page-count-percentage-height.js: Added.
+        (test):
+
 2011-01-03  Csaba Osztrogonác  <ossy at webkit.org>
 
         Unreviewed, rolling out unnecessary r74905.
diff --git a/LayoutTests/printing/page-count-percentage-height-expected.txt b/LayoutTests/printing/page-count-percentage-height-expected.txt
new file mode 100644
index 0000000..7fde3da
--- /dev/null
+++ b/LayoutTests/printing/page-count-percentage-height-expected.txt
@@ -0,0 +1,15 @@
+Test to make sure 2nd page is printed.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS: page number of "page1" is 0
+PASS: page number of "page2" is 1
+PASS: number of pages is 2
+All tests passed
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/printing/page-count-percentage-height.html b/LayoutTests/printing/page-count-percentage-height.html
new file mode 100644
index 0000000..215aecc
--- /dev/null
+++ b/LayoutTests/printing/page-count-percentage-height.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
+<script src="../fast/js/resources/js-test-pre.js"></script>
+<script src="resources/paged-media-test-utils.js"></script>
+<style>
+body { height: 100% }
+</style>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="sandbox"></div>
+<script src="script-tests/page-count-percentage-height.js"></script>
+<script>runPrintingTest(test);</script>
+<script src="../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/printing/script-tests/page-count-percentage-height.js b/LayoutTests/printing/script-tests/page-count-percentage-height.js
new file mode 100644
index 0000000..f9ef4f0
--- /dev/null
+++ b/LayoutTests/printing/script-tests/page-count-percentage-height.js
@@ -0,0 +1,16 @@
+description("Test to make sure 2nd page is printed.");
+
+function test()
+{
+    createBlockWithRatioToPageHeight("page1", 1);
+    createBlockWithRatioToPageHeight("page2", 0.5);
+
+    pageNumberForElementShouldBe("page1", 0);
+    pageNumberForElementShouldBe("page2", 1);
+    
+    numberOfPagesShouldBe(2);
+
+    document.body.removeChild(document.getElementById("sandbox"));
+}
+
+var successfullyParsed = true;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9c8b73d..db3efe3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2011-01-03  David Hyatt  <hyatt at apple.com>
+
+        Reviewed by Simon Fraser.
+
+        https://bugs.webkit.org/show_bug.cgi?id=51328
+
+        Printing on a page with body { height: 100% } clips out the overflow contents.  This happened
+        because the computePageRects function was never correct.  It was using the layer's width and height
+        for the document's width and height, and the layer no longer includes overflow in its width and
+        height.  It was also incorrectly assuming the first page would begin at (0,0), and this is an invalid
+        assumption in RTL or vertical text environments.
+
+        Added printing/page-count-percentage-height.html
+
+        * page/PrintContext.cpp:
+        (WebCore::PrintContext::computePageRects):
+        (WebCore::PrintContext::computePageRectsWithPageSizeInternal):
+
 2011-01-03  Csaba Osztrogonác  <ossy at webkit.org>
 
         [Qt] Unreviewed buildfix for --minimal build after r74895.
diff --git a/WebCore/page/PrintContext.cpp b/WebCore/page/PrintContext.cpp
index 7acca96..f051ead 100644
--- a/WebCore/page/PrintContext.cpp
+++ b/WebCore/page/PrintContext.cpp
@@ -68,11 +68,11 @@ void PrintContext::computePageRects(const FloatRect& printRect, float headerHeig
         return;
     }
 
-    RenderView* root = toRenderView(m_frame->document()->renderer());
+    RenderView* view = toRenderView(m_frame->document()->renderer());
 
     float ratio = printRect.height() / printRect.width();
 
-    float pageWidth  = (float)root->rightLayoutOverflow();
+    float pageWidth  = view->docWidth();
     float pageHeight = pageWidth * ratio;
     outPageHeight = pageHeight; // this is the height of the page adjusted by margins
     pageHeight -= headerHeight + footerHeight;
@@ -96,20 +96,20 @@ void PrintContext::computePageRectsWithPageSizeInternal(const FloatSize& pageSiz
     if (!m_frame->document() || !m_frame->view() || !m_frame->document()->renderer())
         return;
 
-    RenderView* root = toRenderView(m_frame->document()->renderer());
+    RenderView* view = toRenderView(m_frame->document()->renderer());
+
+    IntRect docRect = view->documentRect();
 
-    int docWidth = root->layer()->width();
-    int docHeight = root->layer()->height();
     int pageWidth = pageSizeInPixels.width();
     int pageHeight = pageSizeInPixels.height();
 
-    unsigned pageCount = ceilf((float)docHeight / pageHeight);
+    unsigned pageCount = ceilf((float)docRect.height() / pageHeight);
     for (unsigned i = 0; i < pageCount; ++i) {
         if (allowHorizontalMultiPages) {
-            for (int currWidth = 0; currWidth < docWidth; currWidth += pageWidth)
-                m_pageRects.append(IntRect(currWidth, i * pageHeight, pageWidth, pageHeight));
+            for (int currentX = docRect.x(); currentX < docRect.right(); currentX += pageWidth)
+                m_pageRects.append(IntRect(currentX, docRect.y() + i * pageHeight, pageWidth, pageHeight));
         } else
-            m_pageRects.append(IntRect(0, i * pageHeight, pageWidth, pageHeight));
+            m_pageRects.append(IntRect(docRect.x(), docRect.y() + i * pageHeight, pageWidth, pageHeight));
     }
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list