1 description("Test for orphans and widows");
6 createBlockWithNumberOfLines("page1-1", 10).style.pageBreakBefore = "always";
7 // 10 lines lines are available in the current page.
8 block = createBlockWithNumberOfLines("page1-2", 9);
9 block.style.orphans = 10;
10 block.style.widows = 20;
11 // block 'page1-2' can be placed on the current page.
12 createBlockWithRatioToPageHeight("page1-3", 0.01);
14 createBlockWithNumberOfLines("page2", 10).style.pageBreakBefore = "always";
15 // 10 lines lines are available in the current page.
16 block = createBlockWithNumberOfLines("page3", 12);
17 block.style.orphans = 15;
18 block.style.widows = 2;
19 // block 'page3' must move as a block to the next page because of 'orphans'.
21 createBlockWithNumberOfLines("page4", 10).style.pageBreakBefore = "always";
22 // 10 lines lines are available in the current page.
23 block = createBlockWithNumberOfLines("page5", 12);
24 block.style.orphans = 2;
25 block.style.widows = 15;
26 // block 'page5' must move as a block to the next page because of 'widows'.
28 createBlockWithNumberOfLines("page6-1", 10).style.pageBreakBefore = "always";
29 // 10 lines lines are available in the current page.
30 block = createBlockWithNumberOfLines("page6-2", 12);
31 block.style.orphans = 6;
32 block.style.widows = 6;
33 // block 'page6' must be splitted.
34 createBlockWithRatioToPageHeight("page7", 0.01);
36 createBlockWithNumberOfLines("page8", 10).style.pageBreakBefore = "always";
37 // 10 lines lines are available in the current page.
38 block = createBlockWithNumberOfLines("page9", 12);
39 block.style.orphans = 10;
40 block.style.widows = 10;
41 // block 'page9' must move as a block to the next page because we cannot satisfy
42 // both 'orphans' and 'widows' at the same time.
44 pageNumberForElementShouldBe("page1-1", 1);
45 pageNumberForElementShouldBe("page1-2", 1);
46 pageNumberForElementShouldBe("page1-3", 1);
48 pageNumberForElementShouldBe("page2", 2);
49 pageNumberForElementShouldBe("page3", 3);
51 pageNumberForElementShouldBe("page4", 4);
52 pageNumberForElementShouldBe("page5", 5);
54 pageNumberForElementShouldBe("page6-1", 6);
55 pageNumberForElementShouldBe("page6-2", 6);
56 pageNumberForElementShouldBe("page7", 7);
58 pageNumberForElementShouldBe("page8", 8);
59 pageNumberForElementShouldBe("page9", 9);
61 document.body.removeChild(document.getElementById("sandbox"));
64 var successfullyParsed = true;