eric@webkit.org | cb11503 | 2010-06-21 07:06:41 +0000 | [diff] [blame] | 1 | <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 | <html> |
| 3 | <head> |
mark.lam@apple.com | 44b4166 | 2013-09-08 04:22:45 +0000 | [diff] [blame] | 4 | <script src="../resources/js-test-pre.js"></script> |
eric@webkit.org | cb11503 | 2010-06-21 07:06:41 +0000 | [diff] [blame] | 5 | <script src="resources/paged-media-test-utils.js"></script> |
| 6 | </head> |
| 7 | <body> |
| 8 | <p id="description"></p> |
| 9 | <div id="console"></div> |
| 10 | <div id="sandbox"></div> |
ap@apple.com | 92352d0 | 2017-05-24 22:53:00 +0000 | [diff] [blame] | 11 | <script> |
| 12 | description("Test for allowed page breaks"); |
| 13 | |
| 14 | function test() |
| 15 | { |
| 16 | // See CSS3: Paged Media 9.4. Allowed page breaks. |
| 17 | // http://dev.w3.org/csswg/css3-page/#allowed-pg-brk |
| 18 | createBlockWithRatioToPageHeight("page1", 0.8).style.pageBreakBefore = "always"; |
| 19 | // We shoud break a page between block 'page1' and block 'page2' instead of |
| 20 | // breaking inside block 'page2' because there is no allowed page break points |
| 21 | // inside block 'page2'. Breaking at non-allowed position should be a last resort. |
| 22 | createBlockWithRatioToPageHeight("page2", 0.8); |
| 23 | |
| 24 | createBlockWithRatioToPageHeight("page3-1", 0.6).style.pageBreakBefore = "always"; |
| 25 | // We can break inside block 'page3-2' because page breaks may occur between |
| 26 | // line boxes inside a block box. |
| 27 | createBlockWithNumberOfLines("page3-2", 20); |
| 28 | |
| 29 | pageNumberForElementShouldBe("page1", 1); |
| 30 | pageNumberForElementShouldBe("page2", 2); |
| 31 | pageNumberForElementShouldBe("page3-1", 3); |
| 32 | pageNumberForElementShouldBe("page3-2", 3); |
| 33 | |
| 34 | document.body.removeChild(document.getElementById("sandbox")); |
| 35 | } |
| 36 | |
| 37 | var successfullyParsed = true; |
| 38 | </script> |
eric@webkit.org | cb11503 | 2010-06-21 07:06:41 +0000 | [diff] [blame] | 39 | <script>runPrintingTest(test);</script> |
mark.lam@apple.com | 44b4166 | 2013-09-08 04:22:45 +0000 | [diff] [blame] | 40 | <script src="../resources/js-test-post.js"></script> |
eric@webkit.org | cb11503 | 2010-06-21 07:06:41 +0000 | [diff] [blame] | 41 | </body> |
| 42 | </html> |