Diff
Modified: trunk/LayoutTests/ChangeLog (88555 => 88556)
--- trunk/LayoutTests/ChangeLog 2011-06-10 19:43:23 UTC (rev 88555)
+++ trunk/LayoutTests/ChangeLog 2011-06-10 19:44:39 UTC (rev 88556)
@@ -1,3 +1,16 @@
+2011-06-10 Emil A Eklund <[email protected]>
+
+ Reviewed by Eric Seidel.
+
+ Regression r85573: Blank pages appear at the end of some wikipedia documents.
+ https://bugs.webkit.org/show_bug.cgi?id=62343
+
+ Fix regression caused by r85573. Cached document size not updated after layout.
+
+ * platform/chromium-linux/printing/page-count-relayout-shrink-expected.txt: Added.
+ * platform/mac/printing/page-count-relayout-shrink-expected.txt: Added.
+ * printing/page-count-relayout-shrink.html: Added.
+
2011-06-10 Rob Buis <[email protected]>
Reviewed by Nikolas Zimmermann.
Added: trunk/LayoutTests/platform/chromium-linux/printing/page-count-relayout-shrink-expected.txt (0 => 88556)
--- trunk/LayoutTests/platform/chromium-linux/printing/page-count-relayout-shrink-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/chromium-linux/printing/page-count-relayout-shrink-expected.txt 2011-06-10 19:44:39 UTC (rev 88556)
@@ -0,0 +1 @@
+Document has 36 pages.
Added: trunk/LayoutTests/platform/mac/printing/page-count-relayout-shrink-expected.txt (0 => 88556)
--- trunk/LayoutTests/platform/mac/printing/page-count-relayout-shrink-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/printing/page-count-relayout-shrink-expected.txt 2011-06-10 19:44:39 UTC (rev 88556)
@@ -0,0 +1 @@
+Document has 31 pages.
Added: trunk/LayoutTests/printing/page-count-relayout-shrink.html (0 => 88556)
--- trunk/LayoutTests/printing/page-count-relayout-shrink.html (rev 0)
+++ trunk/LayoutTests/printing/page-count-relayout-shrink.html 2011-06-10 19:44:39 UTC (rev 88556)
@@ -0,0 +1,42 @@
+<html>
+<head>
+<style type="text/css">
+ div {
+ white-space: pre;
+ }
+</style>
+<script type="text/_javascript_">
+
+function runTest()
+{
+ if (!window.layoutTestController)
+ return;
+
+ var block = document.getElementById('test');
+ for (var i = 0; i < 100; i++)
+ document.body.appendChild(block.cloneNode(true));
+
+ layoutTestController.dumpAsText();
+ var pages = layoutTestController.numberOfPages();
+ document.body.textContent = 'Document has ' + pages + ' pages.';
+}
+
+</script>
+<head>
+<body _onload_="runTest()">
+ This test verifies that the page count is correctly updated when the document is scaled to fit.
+ <div id="test" style="clear: both;">
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus scelerisque volutpat.
+ Suspendisse potenti. Donec tristique ligula ut nisl fermentum ac venenatis libero tempus.
+ Aenean laoreet tristique ultrices. In hendrerit varius velit, a hendrerit diam gravida eu.
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut iaculis imperdiet nulla ac imperdiet.
+ Nunc rhoncus feugiat libero, et porttitor metus molestie at.
+ Aenean faucibus urna ac arcu viverra tristique.
+ Aliquam sodales, urna eget tempor convallis, arcu arcu imperdiet massa, nec gravida purus metus et dui.
+ Quisque dignissim nibh placerat mi viverra dignissim. Sed hendrerit, lectus nec auctor imperdiet, velit dolor aliquam magna, vel euismod mi odio vel velit.
+ Nunc dui sem, dignissim et iaculis a, imperdiet sit amet nibh. Curabitur at quam nibh, at tristique nibh. Suspendisse tincidunt nibh augue.
+ Donec tortor libero, pulvinar dapibus volutpat eu, luctus vel lectus.
+ Aenean tincidunt interdum arcu sed mollis. Morbi tellus felis, tincidunt in venenatis eu, ultricies in felis.
+ </div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (88555 => 88556)
--- trunk/Source/WebCore/ChangeLog 2011-06-10 19:43:23 UTC (rev 88555)
+++ trunk/Source/WebCore/ChangeLog 2011-06-10 19:44:39 UTC (rev 88556)
@@ -1,3 +1,17 @@
+2011-06-10 Emil A Eklund <[email protected]>
+
+ Reviewed by Eric Seidel.
+
+ Regression r85573: Blank pages appear at the end of some wikipedia documents.
+ https://bugs.webkit.org/show_bug.cgi?id=62343
+
+ Fix regression caused by r85573. Cached document size not updated after layout.
+
+ Test: printing/page-count-relayout-shrink.html
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::forceLayoutForPagination):
+
2011-06-10 Rob Buis <[email protected]>
Reviewed by Nikolas Zimmermann.
Modified: trunk/Source/WebCore/page/FrameView.cpp (88555 => 88556)
--- trunk/Source/WebCore/page/FrameView.cpp 2011-06-10 19:43:23 UTC (rev 88555)
+++ trunk/Source/WebCore/page/FrameView.cpp 2011-06-10 19:44:39 UTC (rev 88556)
@@ -2604,9 +2604,8 @@
// page width when shrunk, we will lay out at maximum shrink and clip extra content.
// FIXME: We are assuming a shrink-to-fit printing implementation. A cropping
// implementation should not do this!
- const IntRect& documentRect = root->documentRect();
bool horizontalWritingMode = root->style()->isHorizontalWritingMode();
- int docLogicalWidth = horizontalWritingMode ? documentRect.width() : documentRect.height();
+ int docLogicalWidth = horizontalWritingMode ? root->documentRect().width() : root->documentRect().height();
if (docLogicalWidth > pageLogicalWidth) {
flooredPageLogicalWidth = std::min<int>(docLogicalWidth, pageLogicalWidth * maximumShrinkFactor);
if (pageLogicalHeight)
@@ -2614,6 +2613,7 @@
root->setLogicalWidth(flooredPageLogicalWidth);
root->setNeedsLayoutAndPrefWidthsRecalc();
forceLayout();
+ const IntRect& documentRect = root->documentRect();
int docLogicalHeight = horizontalWritingMode ? documentRect.height() : documentRect.width();
int docLogicalTop = horizontalWritingMode ? documentRect.y() : documentRect.x();
int docLogicalRight = horizontalWritingMode ? documentRect.maxX() : documentRect.maxY();