Synchronous media query evaluation could destroy current Frame/FrameView.
[WebKit-https.git] / LayoutTests / printing / break-avoid-page.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../resources/js-test-pre.js"></script>
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>
11 <script>
12 description("Test for combined page-break-{before,after,inside}:avoid");
13
14 function test()
15 {
16     var block;
17     createBlockWithRatioToPageHeight("page1-1", 0.4).style.breakBefore = "page";
18     // A block 'page2-1' must move to the next page because we cannot find any
19     // allowed page breaks till the end of block page2-8.
20     createBlockWithRatioToPageHeight("page2-1", 0.1).style.breakAfter = "avoid-page";
21     createBlockWithRatioToPageHeight("page2-2", 0.1);
22     createBlockWithRatioToPageHeight("page2-3", 0.1).style.breakBefore = "avoid-page";
23     createBlockWithRatioToPageHeight("page2-4", 0.1).style.breakBefore = "avoid-page";
24
25     block = createBlockWithRatioToPageHeight("page2-5", 0.1);
26     block.style.breakBefore = "avoid-page";
27     block.style.breakAfter = "avoid-page";
28
29     createBlockWithRatioToPageHeight("page2-6", 0.1);
30
31     block = createBlockWithNumberOfLines("page2-7", 4);
32     block.style.breakBefore = "avoid-page";
33     block.style.breakAfter = "avoid-page";
34     block.style.breakInside = "avoid-page";
35
36     createBlockWithRatioToPageHeight("page2-8", 0.1).style.breakBefore = "avoid-page";
37
38     pageNumberForElementShouldBe("page1-1", 1);
39     pageNumberForElementShouldBe("page2-1", 2);
40     // Omit tests for intermediate blocks.
41     pageNumberForElementShouldBe("page2-8", 2);
42
43     document.body.removeChild(document.getElementById("sandbox"));
44 }
45
46 var successfullyParsed = true;
47 </script>
48 <script>runPrintingTest(test);</script>
49 <script src="../resources/js-test-post.js"></script>
50 </body>
51 </html>