WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements.
bug-9526-20100202170647.patch (text/plain), 7.72 KB, created by
Yuzo Fujishima
on 2010-02-02 00:06:48 PST
(
hide
)
Description:
When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements.
Filename:
MIME Type:
Creator:
Yuzo Fujishima
Created:
2010-02-02 00:06:48 PST
Size:
7.72 KB
patch
obsolete
>diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 0b3a3a3..3e56496 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,16 @@ >+2010-02-02 Yuzo Fujishima <yuzo@google.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When page-break-{after,before} is set to always, force page breaks even for tables, floated, positioned, and/or overflow-specified elements. >+ http://dev.w3.org/csswg/css3-page/#forced-pg-brk mandates that. >+ 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-01 Shinichiro Hamaji <hamaji@chromium.org> > > Reviewed by Eric Seidel. >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..274ec09 >--- /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('test0') is 1 >+PASS layoutTestController.pageNumberForElementById('test1') is 2 >+PASS layoutTestController.pageNumberForElementById('test2') is 3 >+PASS layoutTestController.pageNumberForElementById('test3') is 4 >+PASS layoutTestController.pageNumberForElementById('test4') is 4 >+PASS layoutTestController.pageNumberForElementById('test5') is 5 >+PASS layoutTestController.pageNumberForElementById('test6') is 6 >+PASS layoutTestController.pageNumberForElementById('test7') is 7 >+PASS layoutTestController.pageNumberForElementById('test8') 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..786c731 >--- /dev/null >+++ b/LayoutTests/printing/script-tests/page-break-always-for-overflow.js >@@ -0,0 +1,30 @@ >+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 testNumber = 0; >+var testHtml = ""; >+for (var position = 0; position < pageBreakPositions.length; position++) { >+ for (var value = 0; value < overflowValues.length; value++, testNumber++) { >+ var overflowStyle = "overflow:" + overflowValues[value]; >+ var pageBreakStyle = pageBreakPositions[position] + ":always"; >+ testHtml += '<div style="' + overflowStyle + '"><p id="test' + testNumber + '" style="' + pageBreakStyle + '">' + overflowStyle + ', ' + pageBreakStyle + '</p></div>\n'; >+ } >+} >+testHtml += '<p id="test' + testNumber + '">end</p>'; >+document.getElementById("sandbox").innerHTML = testHtml; >+ >+var expectedPages = [1, 2, 3, 4, 4, 5, 6, 7, 8]; >+ >+if (layoutTestController) >+{ >+ for (var i = 0; i < expectedPages.length; i++) >+ { >+ shouldBe("layoutTestController.pageNumberForElementById('test" + i + "')", "" + expectedPages[i]); >+ } >+} >+ >+document.body.removeChild(document.getElementById("sandbox")); >+ >+var successfullyParsed = true; >diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog >index 5c63d80..b25c778 100644 >--- a/WebCore/ChangeLog >+++ b/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2010-02-02 Yuzo Fujishima <yuzo@google.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When page-break-{after,before} is set to always, force page breaks even for tables, floated, positioned, and/or overflow-specified elements. >+ http://dev.w3.org/csswg/css3-page/#forced-pg-brk mandates that. >+ 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-01 Shinichiro Hamaji <hamaji@chromium.org> > > Reviewed by Eric Seidel. >diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp >index 1bea8e3..b727af6 100644 >--- a/WebCore/rendering/RenderBlock.cpp >+++ b/WebCore/rendering/RenderBlock.cpp >@@ -1658,7 +1658,7 @@ 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.y() && > (ty + child->y()) < paintInfo.rect.bottom()) { > view()->setBestTruncatedAt(ty + child->y(), this, true); > return; >@@ -1669,7 +1669,7 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int 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.y() && > (ty + child->y() + child->height()) < paintInfo.rect.bottom()) { > view()->setBestTruncatedAt(ty + child->y() + child->height() + max(0, child->collapsedMarginBottom()), this, true); > return; >@@ -4674,17 +4674,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 d7259ce..46ca510 100644 >--- a/WebCore/rendering/RenderBlock.h >+++ b/WebCore/rendering/RenderBlock.h >@@ -313,7 +313,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;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 9526
:
8940
|
46811
|
47910
|
48316
|
48327