<!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 orphans");

function test()
{
    createBlockWithRatioToPageHeight("page1-1", 0.5).style.pageBreakBefore = "always";
    // Here about 10 lines are avaliable at the bottom of the current page.
    createBlockWithNumberOfLines("page1-2", 15).style.orphans = 8;

    createBlockWithRatioToPageHeight("page3", 0.5).style.pageBreakBefore = "always";
    // we should put 'page4' block in the next page because of orphans.
    createBlockWithNumberOfLines("page4", 15).style.orphans = 12;

    createBlockWithRatioToPageHeight("page5-1", 0.5).style.pageBreakBefore = "always";
    // '-1' is acceptable as a value of orphans. But it should have no effect.
    createBlockWithNumberOfLines("page5-2", 20).style.orphans = -1;

    pageNumberForElementShouldBe("page1-1", 1);
    pageNumberForElementShouldBe("page1-2", 1);

    pageNumberForElementShouldBe("page3", 3);
    pageNumberForElementShouldBe("page4", 4);

    pageNumberForElementShouldBe("page5-1", 5);
    pageNumberForElementShouldBe("page5-2", 5);

    document.body.removeChild(document.getElementById("sandbox"));
}

var successfullyParsed = true;
</script>
<script>runPrintingTest(test);</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>
