RESOLVED FIXED Bug 9526
CSS page-break properties quirk
https://bugs.webkit.org/show_bug.cgi?id=9526
Summary CSS page-break properties quirk
Arjen
Reported 2006-06-21 02:14:41 PDT
In Safari(2.03) a page-break-before enclosed in an element that has an overflow other than ‘visible’ (which is the default) will not render a page-break when printed.
Attachments
Test case from web site (4.34 KB, text/html)
2006-06-21 03:46 PDT, David Kilzer (:ddkilzer)
no flags
When page-break-{after,before} is set to always, force page breaks even for tables, floated, positioned, and/or overflow-specified elements. (3.29 KB, patch)
2010-01-18 04:11 PST, Yuzo Fujishima
eric: commit-queue-
When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements. (7.72 KB, patch)
2010-02-02 00:06 PST, Yuzo Fujishima
no flags
When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements. (9.48 KB, patch)
2010-02-07 22:20 PST, Yuzo Fujishima
no flags
When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements. (9.49 KB, patch)
2010-02-08 02:28 PST, Yuzo Fujishima
eric: review+
commit-queue: commit-queue-
David Kilzer (:ddkilzer)
Comment 1 2006-06-21 03:44:42 PDT
Confirmed in WebKit r14934 as well. Changing component to Printing since that seems to match up better with the issue. Steps to reproduce: 1. Load the URL: http://devel.thebluebus.nl/pages/20/Overflow_page-break-before_quirk.html 2. Hit Cmd-P to print. 3. Click the Preview button. Expected results: The web page should be printed on five pages. Actual results: The web page is printed on two pages; only the last style is applied when printing.
David Kilzer (:ddkilzer)
Comment 2 2006-06-21 03:46:26 PDT
Created attachment 8940 [details] Test case from web site
Pam Greene (IRC:pamg)
Comment 3 2009-01-06 14:18:43 PST
Possibly related, the following also doesn't apply the page break. (Granted that a <div> isn't allowed within a <span>, so it might not be worth spending too much time on this; but it may provide a clue to the problem above.) <span class="printonly"> <hr> Blah blah <div style="page-break-after: always;"></div> </span>
Yuzo Fujishima
Comment 4 2010-01-18 04:11:16 PST
Created attachment 46811 [details] When page-break-{after,before} is set to always, force page breaks even for tables, floated, positioned, and/or overflow-specified elements.
WebKit Review Bot
Comment 5 2010-01-18 04:16:58 PST
Attachment 46811 [details] did not pass style-queue: Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1 WebCore/rendering/RenderBlock.cpp:1650: Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side. [whitespace/operators] [4] WebCore/rendering/RenderBlock.cpp:1661: Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side. [whitespace/operators] [4] Total errors found: 2 If any of these errors are false positives, please file a bug against check-webkit-style.
Eric Seidel (no email)
Comment 6 2010-01-26 14:16:00 PST
Comment on attachment 46811 [details] When page-break-{after,before} is set to always, force page breaks even for tables, floated, positioned, and/or overflow-specified elements. We need tests for this. I believe you added some automated testing in another bug. This would be an easy r+ if it had tests.
Yuzo Fujishima
Comment 7 2010-01-26 18:15:51 PST
Hi, Eric, Thank you for the review. I'll add tests once the patch for https://bugs.webkit.org/show_bug.cgi?id=33840 is landed. Yuzo
Yuzo Fujishima
Comment 8 2010-02-02 00:06:48 PST
Created attachment 47910 [details] When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements.
WebKit Review Bot
Comment 9 2010-02-02 00:12:33 PST
Attachment 47910 [details] did not pass style-queue: Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1 WebCore/rendering/RenderBlock.cpp:1661: Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side. [whitespace/operators] [4] WebCore/rendering/RenderBlock.cpp:1672: Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side. [whitespace/operators] [4] Total errors found: 2 If any of these errors are false positives, please file a bug against check-webkit-style.
Yuzo Fujishima
Comment 10 2010-02-02 00:19:38 PST
Hi, Eric, I've added tests for overflow:*. (This patch alone is not enough to fix page break behavior for tables and floats. So I haven't added tests for them.) Yuzo
Eric Seidel (no email)
Comment 11 2010-02-04 16:02:20 PST
It's always OK to add failing tests that we will fix later. :) Makes the later fixing easier.
Eric Seidel (no email)
Comment 12 2010-02-04 16:35:07 PST
Comment on attachment 47910 [details] When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements. Style: if (layoutTestController) 21 { 22 for (var i = 0; i < expectedPages.length; i++) 23 { (Yes, I know we don't have an official JS style for WebKit, but I think most people follow the c++ rules more or less.) OK, so obviously you are asserting that inRootBlockContext is wrong, but you don't explain why in the ChangeLog. I belive you that this is the right pathc. I'm just don't quite understand why someone (clearly intentionally) coded this "wrong" before. Can you please explain (ideally in the ChangeLog)?
Shinichiro Hamaji
Comment 13 2010-02-04 22:58:44 PST
Comment on attachment 47910 [details] When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements. Adding a comment about the test. > +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'; I'd use test-visible-page-break-before, test-visible-page-braek-after, ... instead of test0, test1, ... as their ID. In this way we can see the failing test easily. > +var expectedPages = [1, 2, 3, 4, 4, 5, 6, 7, 8]; It would be better to add comments for this expectations. Also, please fix the style issue the bot is saying.
Yuzo Fujishima
Comment 14 2010-02-07 22:20:13 PST
Created attachment 48316 [details] When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements.
Yuzo Fujishima
Comment 15 2010-02-07 22:26:08 PST
Hi, reviewers, can you take another look? Eric, - Fixed the JavaScript style. - Explained in the change log why inRootBlockContext should be removed. Shinichiro, - Rewrote the test such that the test IDs and the expected values are self descriptive. - Fixed the style lint error. Yuzo
Shinichiro Hamaji
Comment 16 2010-02-08 02:09:35 PST
Comment on attachment 48316 [details] When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements. The change for test looks good except for one nitpick. > +if (layoutTestController) { This would raise an exception when layoutTestController is not defined. Please use window.layoutTestController instead.
Yuzo Fujishima
Comment 17 2010-02-08 02:28:03 PST
Created attachment 48327 [details] When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements.
Yuzo Fujishima
Comment 18 2010-02-08 02:29:57 PST
Thank you for the review. Fixed as: if (window.layoutTestController) {
Yuzo Fujishima
Comment 19 2010-02-15 23:57:34 PST
Ping?
Eric Seidel (no email)
Comment 20 2010-02-17 14:30:43 PST
Comment on attachment 48327 [details] When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements. So how has our behavior changed when no page breaks are specified by CSS?
Yuzo Fujishima
Comment 21 2010-02-17 17:05:11 PST
The WebKit behaves the same way unless page-break-{after,before}:always is specified. The patch doesn't take effect if child->style()->pageBreakBefore() == PBALWAYS is false.
Eric Seidel (no email)
Comment 22 2010-02-19 12:33:13 PST
Comment on attachment 48327 [details] When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements. OK.
WebKit Commit Bot
Comment 23 2010-02-19 12:46:22 PST
Comment on attachment 48327 [details] When page-break-{after,before} is set to always, force page breaks even for overflow-specified elements. Rejecting patch 48327 from commit-queue. Failed to run "['WebKitTools/Scripts/build-webkit', '--debug']" exit_code: 1 Last 500 characters of output: Queue/WebCore/rendering/SVGRootInlineBox.cpp -o /Users/eseidel/Projects/CommitQueue/WebKitBuild/WebCore.build/Debug/WebCore.build/Objects-normal/i386/SVGRootInlineBox.o ** BUILD FAILED ** The following build commands failed: WebCore: Distributed-CompileC /Users/eseidel/Projects/CommitQueue/WebKitBuild/WebCore.build/Debug/WebCore.build/Objects-normal/i386/RenderBlock.o /Users/eseidel/Projects/CommitQueue/WebCore/rendering/RenderBlock.cpp normal i386 c++ com.apple.compilers.gcc.4_2 (1 failure) Full output: http://webkit-commit-queue.appspot.com/results/288802
Eric Seidel (no email)
Comment 24 2010-02-19 16:22:44 PST
Attachment 48327 [details] was posted by a committer and has review+, assigning to Yuzo Fujishima for commit.
Yuzo Fujishima
Comment 25 2010-02-21 20:13:03 PST
Note You need to log in before you can comment on or make changes to this bug.