summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/regions/get-region-flow-ranges-text.html
blob: 51f1cb32d62984ef554e6306ad8eb7c5abf226c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../js/resources/js-test-pre.js"></script>
<script src="resources/helper.js"></script>
<style>
    body { font-family: monospace; }
    #wrapper { font-size: 50px; }
    .border { border: 1px solid red; }
    #box { -webkit-flow-into: flow1;}
    #region1 { -webkit-flow-from: flow1; width: 250px; height: 70px; left: 20px; top: 250px;}
    #region2 { -webkit-flow-from: flow1; width: 250px; height: 60px; left: 20px; top: 300px;}
</style>
</head>
<body>
  <div id="description"></div>
  <div id="wrapper"><div id="box">Text node.</div></div>
  <div id="region1" class="border"></div>
  <div id="region2" class="border"></div>
  <div id="console"></div>
<script>
    if (window.layoutTestController)
        layoutTestController.dumpAsText();

    description("[CSSRegions] Test for Region::getRegionFlowRanges. Text breaks in two regions");
    var region1 = document.getElementById("region1");
    var region2 = document.getElementById("region2");

    debug("Flow test");
    range1 = region1.webkitGetRegionFlowRanges();
    shouldEvaluateTo("range1.length", 1);
    compareArrays(getRangeAt(range1, 0), ["wrapper", 0, "#text", 4]);
    range2 = region2.webkitGetRegionFlowRanges();
    shouldEvaluateTo("range2.length", 1);
    compareArrays(getRangeAt(range2, 0), ["#text", 5, "wrapper", 1]);

function hideRegionsAndFlows() {
    document.getElementById("region1").style.visibility = "hidden";
    document.getElementById("region2").style.visibility = "hidden";
}

  hideRegionsAndFlows();
</script>
</body>
</html>