haikuwebkit/LayoutTests/printing/allowed-breaks.html

43 lines
1.5 KiB
HTML

<!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 allowed page breaks");
function test()
{
// See CSS3: Paged Media 9.4. Allowed page breaks.
// http://dev.w3.org/csswg/css3-page/#allowed-pg-brk
createBlockWithRatioToPageHeight("page1", 0.8).style.breakBefore = "page";
// We shoud break a page between block 'page1' and block 'page2' instead of
// breaking inside block 'page2' because there is no allowed page break points
// inside block 'page2'. Breaking at non-allowed position should be a last resort.
createBlockWithRatioToPageHeight("page2", 0.8);
createBlockWithRatioToPageHeight("page3-1", 0.6).style.breakBefore = "page";
// We can break inside block 'page3-2' because page breaks may occur between
// line boxes inside a block box.
createBlockWithNumberOfLines("page3-2", 20);
pageNumberForElementShouldBe("page1", 1);
pageNumberForElementShouldBe("page2", 2);
pageNumberForElementShouldBe("page3-1", 3);
pageNumberForElementShouldBe("page3-2", 3);
document.body.removeChild(document.getElementById("sandbox"));
}
var successfullyParsed = true;
</script>
<script>runPrintingTest(test);</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>