forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbreak-avoid.html
51 lines (43 loc) · 1.71 KB
/
break-avoid.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/paged-media-test-utils.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<div id="sandbox"></div>
<script>
description("Test for combined page-break-{before,after,inside}:avoid");
function test()
{
var block;
createBlockWithRatioToPageHeight("page1-1", 0.4).style.breakBefore = "page";
// A block 'page2-1' must move to the next page because we cannot find any
// allowed page breaks till the end of block page2-8.
createBlockWithRatioToPageHeight("page2-1", 0.1).style.breakAfter = "avoid";
createBlockWithRatioToPageHeight("page2-2", 0.1);
createBlockWithRatioToPageHeight("page2-3", 0.1).style.breakBefore = "avoid";
createBlockWithRatioToPageHeight("page2-4", 0.1).style.breakBefore = "avoid";
block = createBlockWithRatioToPageHeight("page2-5", 0.1);
block.style.breakBefore = "avoid";
block.style.breakAfter = "avoid";
createBlockWithRatioToPageHeight("page2-6", 0.1);
block = createBlockWithNumberOfLines("page2-7", 4);
block.style.breakBefore = "avoid";
block.style.breakAfter = "avoid";
block.style.breakInside = "avoid";
createBlockWithRatioToPageHeight("page2-8", 0.1).style.breakBefore = "avoid";
pageNumberForElementShouldBe("page1-1", 1);
pageNumberForElementShouldBe("page2-1", 2);
// Omit tests for intermediate blocks.
pageNumberForElementShouldBe("page2-8", 2);
document.body.removeChild(document.getElementById("sandbox"));
}
var successfullyParsed = true;
</script>
<script>runPrintingTest(test);</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>