[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756

yuzo at google.com yuzo at google.com
Fri Feb 26 22:26:48 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 120d85bf6c7c79629c58f6af52cefbd45fae9ad2
Author: yuzo at google.com <yuzo at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Feb 22 04:12:46 2010 +0000

    2010-02-07  Yuzo Fujishima  <yuzo at google.com>
    
            Reviewed by Eric Seidel.
    
            When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements.
            RenderBlock::inRootBlockContext() was introduced by Changeset 5611. Although it is a reasonable criteria for choosing an optional page break location, it is not for a mandatory page break as specified by http://dev.w3.org/csswg/css3-page/#forced-pg-brk. The method is removed because it is not used anywhere else.
            Note: this patch makes page break work for overflow-specified elements. For tables and floated elements, more work is needed.
            https://bugs.webkit.org/show_bug.cgi?id=9526
    
            * printing/page-break-always-for-overflow-expected.txt: Added.
            * printing/page-break-always-for-overflow.html: Added.
            * printing/script-tests/page-break-always-for-overflow.js: Added.
    2010-02-07  Yuzo Fujishima  <yuzo at google.com>
    
            Reviewed by Eric Seidel.
    
            When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements.
            RenderBlock::inRootBlockContext() was introduced by Changeset 5611. Although it is a reasonable criteria for choosing an optional page break location, it is not for a mandatory page break as specified by http://dev.w3.org/csswg/css3-page/#forced-pg-brk. The method is removed because it is not used anywhere else.
            Note: this patch makes page break work for overflow-specified elements. For tables and floated elements, more work is needed.
            https://bugs.webkit.org/show_bug.cgi?id=9526
    
            Test: printing/page-break-always-for-overflow.html
    
            * rendering/RenderBlock.cpp:
            (WebCore::RenderBlock::paintChildren):
            * rendering/RenderBlock.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55067 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index de968e3..2b594c4 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-02-07  Yuzo Fujishima  <yuzo at google.com>
+
+        Reviewed by Eric Seidel.
+
+        When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements.
+        RenderBlock::inRootBlockContext() was introduced by Changeset 5611. Although it is a reasonable criteria for choosing an optional page break location, it is not for a mandatory page break as specified by http://dev.w3.org/csswg/css3-page/#forced-pg-brk. The method is removed because it is not used anywhere else.
+        Note: this patch makes page break work for overflow-specified elements. For tables and floated elements, more work is needed.
+        https://bugs.webkit.org/show_bug.cgi?id=9526
+
+        * printing/page-break-always-for-overflow-expected.txt: Added.
+        * printing/page-break-always-for-overflow.html: Added.
+        * printing/script-tests/page-break-always-for-overflow.js: Added.
+
 2010-02-19  Eric Seidel  <eric at webkit.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/LayoutTests/printing/page-break-always-for-overflow-expected.txt b/LayoutTests/printing/page-break-always-for-overflow-expected.txt
new file mode 100644
index 0000000..97efad2
--- /dev/null
+++ b/LayoutTests/printing/page-break-always-for-overflow-expected.txt
@@ -0,0 +1,18 @@
+Test page-break-{before,after}:always for overflow:{visible,hidden,scroll,auto} elements.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS layoutTestController.pageNumberForElementById('test-page-break-before:always-for-overflow:visible') is 1
+PASS layoutTestController.pageNumberForElementById('test-page-break-before:always-for-overflow:hidden') is 2
+PASS layoutTestController.pageNumberForElementById('test-page-break-before:always-for-overflow:scroll') is 3
+PASS layoutTestController.pageNumberForElementById('test-page-break-before:always-for-overflow:auto') is 4
+PASS layoutTestController.pageNumberForElementById('test-page-break-after:always-for-overflow:visible') is 4
+PASS layoutTestController.pageNumberForElementById('test-page-break-after:always-for-overflow:hidden') is 5
+PASS layoutTestController.pageNumberForElementById('test-page-break-after:always-for-overflow:scroll') is 6
+PASS layoutTestController.pageNumberForElementById('test-page-break-after:always-for-overflow:auto') is 7
+PASS layoutTestController.pageNumberForElementById('test-last-page') is 8
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/printing/page-break-always-for-overflow.html b/LayoutTests/printing/page-break-always-for-overflow.html
new file mode 100644
index 0000000..eeab6ef
--- /dev/null
+++ b/LayoutTests/printing/page-break-always-for-overflow.html
@@ -0,0 +1,14 @@
+<!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>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="sandbox"></div>
+<script src="script-tests/page-break-always-for-overflow.js"></script>
+<script src="../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/printing/script-tests/page-break-always-for-overflow.js b/LayoutTests/printing/script-tests/page-break-always-for-overflow.js
new file mode 100644
index 0000000..da10a44
--- /dev/null
+++ b/LayoutTests/printing/script-tests/page-break-always-for-overflow.js
@@ -0,0 +1,39 @@
+description("Test page-break-{before,after}:always for overflow:{visible,hidden,scroll,auto} elements.");
+
+var overflowValues = ["visible", "hidden", "scroll", "auto"];
+var pageBreakPositions = ["page-break-before", "page-break-after"];
+
+var testHtml = "";
+for (var position = 0; position < pageBreakPositions.length; position++) {
+    for (var value = 0; value < overflowValues.length; value++) {
+        var overflowStyle = "overflow:" + overflowValues[value];
+        var pageBreakStyle = pageBreakPositions[position] + ":always";
+        var testId = 'test-' + pageBreakStyle + '-for-' + overflowStyle;
+        testHtml += '<div style="' + overflowStyle + '"><p id="' + testId + '" style="' + pageBreakStyle + '">' + overflowStyle + ', ' + pageBreakStyle + '</p></div>\n';
+    }
+}
+testHtml += '<p id="test-last-page">end</p>';
+document.getElementById("sandbox").innerHTML = testHtml;
+
+var expectedValues = [
+    // page-break-{before,after}:always should take effect regardless of overflow value.
+    ['test-page-break-before:always-for-overflow:visible', 1],
+    ['test-page-break-before:always-for-overflow:hidden', 2],
+    ['test-page-break-before:always-for-overflow:scroll', 3],
+    ['test-page-break-before:always-for-overflow:auto', 4],
+    ['test-page-break-after:always-for-overflow:visible', 4],
+    ['test-page-break-after:always-for-overflow:hidden', 5],
+    ['test-page-break-after:always-for-overflow:scroll', 6],
+    ['test-page-break-after:always-for-overflow:auto', 7],
+    ['test-last-page', 8]
+];
+
+if (window.layoutTestController) {
+    for (var i = 0; i < expectedValues.length; i++) {
+        shouldBe("layoutTestController.pageNumberForElementById('" + expectedValues[i][0] + "')", "" + expectedValues[i][1]);
+    }
+}
+
+document.body.removeChild(document.getElementById("sandbox"));
+
+var successfullyParsed = true;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 668748c..8ff957e 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-02-07  Yuzo Fujishima  <yuzo at google.com>
+
+        Reviewed by Eric Seidel.
+
+        When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements.
+        RenderBlock::inRootBlockContext() was introduced by Changeset 5611. Although it is a reasonable criteria for choosing an optional page break location, it is not for a mandatory page break as specified by http://dev.w3.org/csswg/css3-page/#forced-pg-brk. The method is removed because it is not used anywhere else.
+        Note: this patch makes page break work for overflow-specified elements. For tables and floated elements, more work is needed.
+        https://bugs.webkit.org/show_bug.cgi?id=9526
+
+        Test: printing/page-break-always-for-overflow.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paintChildren):
+        * rendering/RenderBlock.h:
+
 2010-02-21  Julien Chaffraix  <jchaffraix at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index e9bd8ea..1e4831c 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -1657,16 +1657,15 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty)
 
     for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {        
         // Check for page-break-before: always, and if it's set, break and bail.
-        if (isPrinting && !childrenInline() && child->style()->pageBreakBefore() == PBALWAYS &&
-            inRootBlockContext() && (ty + child->y()) > paintInfo.rect.y() && 
-            (ty + child->y()) < paintInfo.rect.bottom()) {
+        if (isPrinting && !childrenInline() && child->style()->pageBreakBefore() == PBALWAYS
+            && (ty + child->y()) > paintInfo.rect.y()
+            && (ty + child->y()) < paintInfo.rect.bottom()) {
             view()->setBestTruncatedAt(ty + child->y(), this, true);
             return;
         }
 
         // Check for page-break-inside: avoid, and it it's set, break and bail.
         if (isPrinting && !childrenInline() && child->style()->pageBreakInside() == PBAVOID
-            && inRootBlockContext()
             && ty + child->y() > paintInfo.rect.y()
             && ty + child->y() < paintInfo.rect.bottom()
             && ty + child->y() + child->height() > paintInfo.rect.bottom()) {
@@ -1678,9 +1677,9 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty)
             child->paint(info, tx, ty);
 
         // Check for page-break-after: always, and if it's set, break and bail.
-        if (isPrinting && !childrenInline() && child->style()->pageBreakAfter() == PBALWAYS && 
-            inRootBlockContext() && (ty + child->y() + child->height()) > paintInfo.rect.y() && 
-            (ty + child->y() + child->height()) < paintInfo.rect.bottom()) {
+        if (isPrinting && !childrenInline() && child->style()->pageBreakAfter() == PBALWAYS
+            && (ty + child->y() + child->height()) > paintInfo.rect.y()
+            && (ty + child->y() + child->height()) < paintInfo.rect.bottom()) {
             view()->setBestTruncatedAt(ty + child->y() + child->height() + max(0, child->collapsedMarginBottom()), this, true);
             return;
         }
@@ -4710,17 +4709,6 @@ void RenderBlock::updateFirstLetter()
     }
 }
 
-bool RenderBlock::inRootBlockContext() const
-{
-    if (isTableCell() || isFloatingOrPositioned() || hasOverflowClip())
-        return false;
-    
-    if (isRoot() || isRenderView())
-        return true;
-    
-    return containingBlock()->inRootBlockContext();
-}
-
 // Helper methods for obtaining the last line, computing line counts and heights for line counts
 // (crawling into blocks).
 static bool shouldCheckLines(RenderObject* obj)
diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h
index fa6224d..2a02b76 100644
--- a/WebCore/rendering/RenderBlock.h
+++ b/WebCore/rendering/RenderBlock.h
@@ -317,7 +317,6 @@ private:
     // Obtains the nearest enclosing block (including this block) that contributes a first-line style to our inline
     // children.
     virtual RenderBlock* firstLineBlock() const;
-    bool inRootBlockContext() const;
 
     virtual IntRect rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, int outlineWidth);
     virtual RenderStyle* outlineStyleForRepaint() const;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list