Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: LayoutTests/fast/regions/regions-widows-and-orphans.html

Issue 159933010: Remove everything region-specific from LayoutTests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/regions/regions-widows-and-orphans.html
diff --git a/LayoutTests/fast/regions/regions-widows-and-orphans.html b/LayoutTests/fast/regions/regions-widows-and-orphans.html
deleted file mode 100644
index b54afa535f9dc1c25a2ddf8556d70717d99b66f3..0000000000000000000000000000000000000000
--- a/LayoutTests/fast/regions/regions-widows-and-orphans.html
+++ /dev/null
@@ -1,210 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title>Testing Widows and Orphans</title>
-<script src="../../resources/js-test.js"></script>
-<style>
-body.hide-containers .container, body.hide-containers h3 {
- display: none;
-}
-
-.region {
- height: 200px;
- -webkit-region-fragment: break;
- display: inline-block;
-}
-
-.region0 {
- width: 150px;
-}
-
-.region1 {
- width: 200px;
-}
-
-.region2 {
- width: 150px;
-}
-
-.container {
- width: 600px;
- height: 200px;
- line-height: 20px; /* 10 lines per page */
- font-size: 16px;
- margin: 0 0 20px 0;
- padding: 0;
- overflow: hidden;
-}
-
-.block {
- margin: 0 0 15px 0;
- padding: 0;
-}
-
-.top {
- color: red;
-}
-
-.bottom {
- color: green;
-}
-</style>
-<script>
-
-description("Testing widows and orphans. Any green lines should be at the bottom of regions, and any red lines should be at the top of regions.");
-
-if (window.testRunner)
- testRunner.dumpAsText();
-
-function createRegions(id, container)
-{
- for (var i = 0; i < 3; ++i) {
- var element = document.createElement("div");
- element.className = "region region" + i;
- element.style.webkitFlowFrom = id;
-
- container.appendChild(element);
- }
-}
-
-function createTestContainer(id, description, blocks)
-{
- var label = document.createElement("h3");
- label.textContent = id + " - " + description;
- document.body.appendChild(label);
- var element = document.createElement("div");
- element.className = "container";
- element.id = id;
-
- createRegions(id, element);
-
- for (var i = 1; i <= blocks.length; ++i) {
- var block = document.createElement("div");
- block.className = "block";
- var numLines = blocks[i-1];
- for (var j = 1; j <= numLines; ++j) {
- var line = document.createElement("span");
- line.id = id + "-block-" + i + "-line-" + j;
- line.textContent = "Block " + i + " Line " + j;
- block.appendChild(line);
- block.appendChild(document.createElement("br"));
- }
- block.style.webkitFlowInto = id;
- element.appendChild(block);
- }
- document.body.appendChild(element);
- return element;
-}
-
-function markTopLine(containerId, blockNumber, lineNumber)
-{
- var element = document.getElementById(containerId + "-block-" + blockNumber + "-line-" + lineNumber);
- element.className = "top";
-}
-
-function markBottomLine(containerId, blockNumber, lineNumber)
-{
- var element = document.getElementById(containerId + "-block-" + blockNumber + "-line-" + lineNumber);
- element.className = "bottom";
-}
-
-function testIsFirstInRegion(containerId, blockNumber, lineNumber)
-{
- var topOfContainer = document.getElementById(containerId).getBoundingClientRect().top;
- var topOfLine = document.getElementById(containerId + "-block-" + blockNumber + "-line-" + lineNumber).getBoundingClientRect().top;
-
- if (Math.abs(topOfContainer - topOfLine) < 5) // Give 5 pixels to account for subpixel layout.
- testPassed(containerId + " Block " + blockNumber + " Line " + lineNumber + " is correct.");
- else
- testFailed(containerId + " Block " + blockNumber + " Line " + lineNumber + " wasn't at the top of the region.");
-}
-
-function runTest()
-{
- var container;
-
- createTestContainer("test1", "Normal breaking", [5, 6, 5, 5]);
-
- markTopLine("test1", 1, 1);
- markBottomLine("test1", 2, 4);
- markTopLine("test1", 2, 5);
- markBottomLine("test1", 4, 1);
- markTopLine("test1", 4, 2);
-
- testIsFirstInRegion("test1", 1, 1);
- testIsFirstInRegion("test1", 2, 5);
- testIsFirstInRegion("test1", 4, 2);
-
- container = createTestContainer("test2", "Basic Orphan", [8, 6]);
- container.style.orphans = 2;
-
- markTopLine("test2", 1, 1);
- markBottomLine("test2", 1, 8); // Orphan break happens here.
- markTopLine("test2", 2, 1);
-
- testIsFirstInRegion("test2", 1, 1);
- testIsFirstInRegion("test2", 2, 1);
-
- container = createTestContainer("test3", "Basic Widow", [4, 6, 3]);
- container.style.widows = 2;
-
- markTopLine("test3", 1, 1);
- markBottomLine("test3", 2, 4); // Widow break happens here.
- markTopLine("test3", 2, 5);
-
- testIsFirstInRegion("test3", 1, 1);
- testIsFirstInRegion("test3", 2, 5);
-
- container = createTestContainer("test4", "Orphans causing Widows", [8, 6, 4, 4]);
- container.style.orphans = 2;
- container.style.widows = 2;
-
- markTopLine("test4", 1, 1);
- markBottomLine("test4", 1, 8); // Orphan break happens here.
- markTopLine("test4", 2, 1);
- markBottomLine("test4", 3, 2); // And that creates a widow forcing a break here.
- markTopLine("test4", 3, 3);
-
- testIsFirstInRegion("test4", 1, 1);
- testIsFirstInRegion("test4", 2, 1);
- testIsFirstInRegion("test4", 3, 3);
-
- container = createTestContainer("test5", "Widows blocked by Orphan rule", [7, 3, 4]);
- container.style.orphans = 2;
- container.style.widows = 2;
-
- markTopLine("test5", 1, 1);
- markBottomLine("test5", 2, 2); // This line should not move - protected by orphaning.
- markTopLine("test5", 2, 3); // This line won't be un-widowed - blocked by orphaning.
-
- testIsFirstInRegion("test5", 1, 1);
- testIsFirstInRegion("test5", 2, 3);
-
- container = createTestContainer("test6", "Ridiculous values", [7, 7, 7, 7]);
- container.style.orphans = 100;
- container.style.widows = 100;
-
- markTopLine("test6", 1, 1);
- markBottomLine("test6", 1, 7); // Orphan break happens here.
- markTopLine("test6", 2, 1); // Adopted.
- markBottomLine("test6", 2, 7); // Orphan break.
- markTopLine("test6", 3, 1); // Adopted.
-
- testIsFirstInRegion("test6", 1, 1);
- testIsFirstInRegion("test6", 2, 1);
- testIsFirstInRegion("test6", 3, 1);
-
- if (window.testRunner) {
- // Hide all the containers and leave just the test results for text output.
- document.body.className = "hide-containers";
- }
-
- isSuccessfullyParsed();
-}
-
-window.addEventListener("load", runTest, false);
-</script>
-</head>
-<body>
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698