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

eric at webkit.org eric at webkit.org
Fri Feb 26 22:23:42 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit be74e5fb3a925a7e2399612433bd3efe9660dd6b
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Feb 18 05:55:17 2010 +0000

    2010-02-17  Hayato Ito  <hayato at chromium.org>
    
            Reviewed by Eric Seidel.
    
            Support CSS page-break-inside with a value of 'avoid'.
    
            https://bugs.webkit.org/show_bug.cgi?id=34080
    
            * printing/page-break-inside-expected.txt: Added.
            * printing/page-break-inside.html: Added.
            * printing/script-tests/page-break-inside.js: Added.
            (createParagraph):
            (pageNumber):
    2010-02-17  Hayato Ito  <hayato at chromium.org>
    
            Reviewed by Eric Seidel.
    
            Support CSS page-break-inside with a value of 'avoid'.
    
            https://bugs.webkit.org/show_bug.cgi?id=34080
    
            Test: printing/page-break-inside.html
    
            * rendering/RenderBlock.cpp:
            (WebCore::RenderBlock::paintChildren):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54929 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 6b5adf1..0935dd0 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-02-17  Hayato Ito  <hayato at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Support CSS page-break-inside with a value of 'avoid'.
+
+        https://bugs.webkit.org/show_bug.cgi?id=34080
+
+        * printing/page-break-inside-expected.txt: Added.
+        * printing/page-break-inside.html: Added.
+        * printing/script-tests/page-break-inside.js: Added.
+        (createParagraph):
+        (pageNumber):
+
 2010-02-17  Fumitoshi Ukai  <ukai at chromium.org>
 
         Reviewed by Alexey Proskuryakov.
diff --git a/LayoutTests/printing/page-break-inside-expected.txt b/LayoutTests/printing/page-break-inside-expected.txt
new file mode 100644
index 0000000..0dc561f
--- /dev/null
+++ b/LayoutTests/printing/page-break-inside-expected.txt
@@ -0,0 +1,21 @@
+Test for page-break-inside:avoid
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS pageNumber('page1') is 1
+PASS pageNumber('page2') is 2
+PASS pageNumber('page3-1') is 3
+PASS pageNumber('page3-2') is 3
+PASS pageNumber('page4') is 4
+PASS pageNumber('page5') is 5
+PASS pageNumber('page6') is 6
+PASS pageNumber('page7') is 7
+PASS pageNumber('page9') is 9
+PASS pageNumber('page10-1') is 10
+PASS pageNumber('page10-2') is 10
+PASS pageNumber('page11') is 11
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/printing/page-break-inside.html b/LayoutTests/printing/page-break-inside.html
new file mode 100644
index 0000000..aeec6af
--- /dev/null
+++ b/LayoutTests/printing/page-break-inside.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-inside.js"></script>
+<script src="../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/printing/script-tests/page-break-inside.js b/LayoutTests/printing/script-tests/page-break-inside.js
new file mode 100644
index 0000000..28a8181
--- /dev/null
+++ b/LayoutTests/printing/script-tests/page-break-inside.js
@@ -0,0 +1,62 @@
+description("Test for page-break-inside:avoid");
+
+function createParagraph(id, height)
+{
+    var element = document.createElement("div");
+    element.id = id;
+    element.style.height = height;
+    element.appendChild(document.createTextNode("foobar"));
+    document.getElementById("sandbox").appendChild(element);
+    return element;
+}
+
+var pageHeightInPixels = 1000;
+
+function pageNumber(id) {
+  return layoutTestController.pageNumberForElementById(id, 1000, pageHeightInPixels);
+}
+
+createParagraph("page1", 900).style.pageBreakBefore = "always";
+createParagraph("page2", 900).style.pageBreakInside = "avoid";
+
+createParagraph("page3-1", 900).style.pageBreakBefore = "always";
+createParagraph("page3-2", 100).style.pageBreakInside = "avoid";
+
+createParagraph("page4", 900).style.pageBreakBefore = "always";
+createParagraph("page5", 101).style.pageBreakInside = "avoid";
+
+createParagraph("page6", 100).style.pageBreakBefore = "always";
+createParagraph("page7", 2100).style.pageBreakInside = "avoid";
+createParagraph("page9", 100);
+
+createParagraph("page10-1", 100).style.pageBreakBefore = "always";
+createParagraph("page10-2", 100).style.pageBreakAfter = "always";
+// Make sure page-break only happens once, not twice.
+createParagraph("page11", 900).style.pageBreakInside = "avoid";
+
+// Before calling "shouldBe" tests, sets "display: none" style to |console| element so that the results of pageNumber should not be affected.
+// FIXME: Use functions defined in printing/resources/paged-media-test-utils.js instead of this hack.
+document.getElementById("console").style.display = 'none';
+
+shouldBe("pageNumber('page1')", "1");
+shouldBe("pageNumber('page2')", "2");
+
+shouldBe("pageNumber('page3-1')", "3");
+shouldBe("pageNumber('page3-2')", "3");
+
+shouldBe("pageNumber('page4')", "4");
+shouldBe("pageNumber('page5')", "5");
+
+shouldBe("pageNumber('page6')", "6");
+shouldBe("pageNumber('page7')", "7");
+shouldBe("pageNumber('page9')", "9");
+
+shouldBe("pageNumber('page10-1')", "10");
+shouldBe("pageNumber('page10-2')", "10");
+shouldBe("pageNumber('page11')", "11");
+
+document.getElementById("console").style.display = 'block';
+
+document.body.removeChild(document.getElementById("sandbox"));
+
+var successfullyParsed = true;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 064d0c6..1df3fc5 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2010-02-17  Hayato Ito  <hayato at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Support CSS page-break-inside with a value of 'avoid'.
+
+        https://bugs.webkit.org/show_bug.cgi?id=34080
+
+        Test: printing/page-break-inside.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paintChildren):
+
 2010-02-17  Fumitoshi Ukai  <ukai at chromium.org>
 
         Reviewed by Alexey Proskuryakov.
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index 143781c..1bb8401 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -1664,6 +1664,16 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty)
             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()) {
+            view()->setBestTruncatedAt(ty + child->y(), this, true);
+            return;
+        }
+
         if (!child->hasSelfPaintingLayer() && !child->isFloating())
             child->paint(info, tx, ty);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list