Revision control

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 break-after:avoid");
13
14
function test()
15
{
16
createBlockWithRatioToPageHeight("page1", 0.5).style.breakBefore = "page";
17
// A block 'page2-1' must move to the next page because it has 'page-break-after:avoid'
18
// and both 'page2-1' and 'page2-2' cannot be placed in the current page at the same time.
19
createBlockWithRatioToPageHeight("page2-1", 0.3).style.breakAfter = "avoid";
20
createBlockWithRatioToPageHeight("page2-2", 0.3);
21
22
createBlockWithRatioToPageHeight("page3-1", 0.5).style.breakBefore = "page";
23
// A page break can occur inside of 'page3-3' block because it has child elements.
24
createBlockWithRatioToPageHeight("page3-2", 0.3).style.breakAfter = "avoid";
25
createBlockWithNumberOfLines("page3-3", 10);
26
27
createBlockWithRatioToPageHeight("page5", 0.5).style.breakBefore = "page";
28
// It seems unrealistic, but block 'page6-1' must move to the next page.
29
createBlockWithRatioToPageHeight("page6-1", 0.1).style.breakAfter = "avoid";
30
createBlockWithRatioToPageHeight("page6-2", 0.1).style.breakAfter = "avoid";
31
createBlockWithRatioToPageHeight("page6-3", 0.1).style.breakAfter = "avoid";
32
createBlockWithRatioToPageHeight("page6-4", 0.1).style.breakAfter = "avoid";
33
createBlockWithRatioToPageHeight("page6-5", 0.1).style.breakAfter = "avoid";
34
createBlockWithRatioToPageHeight("page6-6", 0.1).style.breakAfter = "avoid";
35
createBlockWithRatioToPageHeight("page6-7", 0.1);
36
37
38
pageNumberForElementShouldBe("page1", 1);
39
pageNumberForElementShouldBe("page2-1", 2);
40
pageNumberForElementShouldBe("page2-2", 2);
41
42
pageNumberForElementShouldBe("page3-1", 3);
43
pageNumberForElementShouldBe("page3-2", 3);
44
pageNumberForElementShouldBe("page3-3", 3);
45
46
pageNumberForElementShouldBe("page5", 5);
47
pageNumberForElementShouldBe("page6-1", 6);
48
// Omit tests for intermediate blocks.
49
pageNumberForElementShouldBe("page6-7", 6);
50
51
document.body.removeChild(document.getElementById("sandbox"));
52
}
53
54
var successfullyParsed = true;
55
</script>
56
<script>runPrintingTest(test);</script>
57
<script src="../resources/js-test-post.js"></script>
58
</body>
59
</html>