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 page-break-inside:avoid");
13
14
function test()
15
{
16
createBlockWithRatioToPageHeight("page1-1", 0.5).style.pageBreakBefore = "always";
17
// block 'page1-2' should be splitted.
18
createBlockWithNumberOfLines("page1-2", 20);
19
createBlockWithRatioToPageHeight("page2", 0.1);
20
21
createBlockWithRatioToPageHeight("page3", 0.5).style.pageBreakBefore = "always";
22
// We should place block 'page4' in the next page because of 'page-break-inside: avoid'.
23
createBlockWithNumberOfLines("page4", 20).style.pageBreakInside = "avoid";
24
25
createBlockWithRatioToPageHeight("page5", 0.8).style.pageBreakBefore = "always";
26
// block 'page5-2' is a very large block, occupying more than 2 pages.
27
// We don't define from where this large block starts. Maybe from the next page.
28
createBlockWithNumberOfLines("page5or6", 20 * 2 + 10).style.pageBreakInside = "avoid";
29
createBlockWithRatioToPageHeight("page8", 0.1);
30
31
createBlockWithRatioToPageHeight("page9-1", 0.1).style.pageBreakBefore = "always";
32
createBlockWithRatioToPageHeight("page9-2", 0.1).style.pageBreakAfter = "always";
33
// Make sure page-break only happens once, not twice.
34
createBlockWithNumberOfLines("page10", 20).style.pageBreakInside = "avoid";
35
36
pageNumberForElementShouldBe('page1-1', 1);
37
pageNumberForElementShouldBe('page1-2', 1);
38
pageNumberForElementShouldBe('page2', 2);
39
40
pageNumberForElementShouldBe('page3', 3);
41
pageNumberForElementShouldBe('page4', 4);
42
43
pageNumberForElementShouldBe('page5', 5);
44
pageNumberForElementShouldBe('page8', 8);
45
46
pageNumberForElementShouldBe('page9-1', 9);
47
pageNumberForElementShouldBe('page9-2', 9);
48
pageNumberForElementShouldBe('page10', 10);
49
50
document.body.removeChild(document.getElementById("sandbox"));
51
}
52
53
var successfullyParsed = true;
54
</script>
55
<script>runPrintingTest(test);</script>
56
<script src="../resources/js-test-post.js"></script>
57
</body>
58
</html>