| OLD | NEW |
| (Empty) |
| 1 <!doctype html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../../resources/js-test.js"></script> | |
| 5 <script src="../resources/helper.js"></script> | |
| 6 <style> | |
| 7 html { -webkit-writing-mode: horizontal-bt; } | |
| 8 body { font-family: monospace; } | |
| 9 #article { -webkit-flow-into: flow; } | |
| 10 #region { -webkit-flow-from: flow; width: 250px; height: 50px; } | |
| 11 #region2 { -webkit-flow-from: flow; width: 250px; height: 50px; } | |
| 12 #region3 { -webkit-flow-from: flow; width: 250px; height: 50px; } | |
| 13 | |
| 14 #article2 { -webkit-flow-into: flow2; } | |
| 15 #region4 { -webkit-flow-from: flow2; width: 250px; height: 50px; } | |
| 16 #region5 { -webkit-flow-from: flow2; width: 250px; height: 50px; } | |
| 17 | |
| 18 .noRegion { -webkit-flow-from: none; } | |
| 19 </style> | |
| 20 </head> | |
| 21 <body> | |
| 22 <!-- some tests with inline elements --> | |
| 23 <div id="article"> | |
| 24 <span id="spanNode">Text inside span.</span> | |
| 25 Text outside span. Text outside span. Text outside span. | |
| 26 <span id="spanNode2">Text inside span2.</span> | |
| 27 <span id="spanNode3">Text inside span3</span> | |
| 28 </div> | |
| 29 <div id="region"></div> | |
| 30 <div id="region2"></div> | |
| 31 | |
| 32 <!-- some tests with block elements --> | |
| 33 <div id="article2"> | |
| 34 <p id="p1">Text inside paragraph p1.</p> | |
| 35 </div> | |
| 36 <div id="region4"></region> | |
| 37 <script> | |
| 38 if (window.testRunner) | |
| 39 window.testRunner.dumpAsText(); | |
| 40 description("Test for 90759: [CSSRegions] Rename NamedFlow::getRegio
nsByContentNode to NamedFlow::getRegionsByContent"); | |
| 41 var namedFlow = getFlowByName("flow"); | |
| 42 | |
| 43 function hideRegions() | |
| 44 { | |
| 45 document.getElementById("article").style.visibility = "hidden"; | |
| 46 document.getElementById("article2").style.visibility = "hidden"; | |
| 47 document.getElementById("region").style.visibility = "hidden"; | |
| 48 document.getElementById("region2").style.visibility = "hidden"; | |
| 49 document.getElementById("region3").style.visibility = "hidden"; | |
| 50 document.getElementById("region4").style.visibility = "hidden"; | |
| 51 document.getElementById("region5").style.visibility = "hidden"; | |
| 52 } | |
| 53 | |
| 54 var regionListArticle = namedFlow.getRegionsByContent(document.getEl
ementById("article")); | |
| 55 shouldBeNonNull("regionListArticle"); | |
| 56 shouldEvaluateTo("regionListArticle.length", 2); | |
| 57 shouldBeEqualToString("regionListArticle.item(0).id", "region"); | |
| 58 shouldBeEqualToString("regionListArticle.item(1).id", "region2"); | |
| 59 | |
| 60 var spanNode = document.getElementById("spanNode"); | |
| 61 var regionListSpan = namedFlow.getRegionsByContent(spanNode); | |
| 62 shouldBeNonNull("regionListSpan"); | |
| 63 shouldEvaluateTo("regionListSpan.length", 1); | |
| 64 shouldBeEqualToString("regionListSpan.item(0).id", "region"); | |
| 65 | |
| 66 var spanNode2 = document.getElementById("spanNode2"); | |
| 67 var regionListSpan2 = namedFlow.getRegionsByContent(spanNode2); | |
| 68 shouldBeNonNull("regionListSpan2"); | |
| 69 shouldEvaluateTo("regionListSpan2.length", 2); | |
| 70 | |
| 71 var spanNode3 = document.getElementById("spanNode3"); | |
| 72 var regionListSpan3 = namedFlow.getRegionsByContent(spanNode3); | |
| 73 shouldBeNonNull("regionListSpan3"); | |
| 74 shouldEvaluateTo("regionListSpan3.length", 1); | |
| 75 shouldBeEqualToString("regionListSpan3.item(0).id", "region2"); | |
| 76 | |
| 77 var textNode = document.createTextNode("Text node. Text node. Text n
ode. Text node. Text node. Text node. Text node. "); | |
| 78 document.getElementById("article").appendChild(textNode); | |
| 79 var regionListTextNode = namedFlow.getRegionsByContent(textNode); | |
| 80 shouldBeNonNull("regionListTextNode"); | |
| 81 shouldEvaluateTo("regionListTextNode.length", 1); | |
| 82 shouldBeEqualToString("regionListTextNode.item(0).id", "region2"); | |
| 83 | |
| 84 // Add another text node that will overflow the region2. | |
| 85 var textNode2 = document.createTextNode("Text node2."); | |
| 86 document.getElementById("article").appendChild(textNode2); | |
| 87 var regionListTextNode2 = namedFlow.getRegionsByContent(textNode2); | |
| 88 shouldBeNonNull("regionListTextNode2"); | |
| 89 shouldEvaluateTo("regionListTextNode2.length", 1); | |
| 90 shouldBeEqualToString("regionListTextNode2.item(0).id", "region2"); | |
| 91 | |
| 92 // Add another text node that is in the overflow of the last region. | |
| 93 var textNode3 = document.createTextNode("Text node3."); | |
| 94 document.getElementById("article").appendChild(textNode3); | |
| 95 var regionListTextNode3 = namedFlow.getRegionsByContent(textNode3); | |
| 96 shouldBeNonNull("regionListTextNode3"); | |
| 97 shouldEvaluateTo("regionListTextNode3.length", 1); | |
| 98 shouldBeEqualToString("regionListTextNode3.item(0).id", "region2"); | |
| 99 | |
| 100 // Add another region to take the overflowing elements from second r
egion. | |
| 101 var region3 = document.createElement("div"); | |
| 102 region3.id = "region3"; | |
| 103 document.body.appendChild(region3); | |
| 104 | |
| 105 var regionListTextNode2 = namedFlow.getRegionsByContent(textNode); | |
| 106 shouldEvaluateTo("regionListTextNode2.length", 2); | |
| 107 shouldBeEqualToString("regionListTextNode2.item(0).id", "region2"); | |
| 108 shouldBeEqualToString("regionListTextNode2.item(1).id", "region3"); | |
| 109 | |
| 110 var regionListTextNode32 = namedFlow.getRegionsByContent(textNode3); | |
| 111 shouldEvaluateTo("regionListTextNode32.length", 1); | |
| 112 shouldBeEqualToString("regionListTextNode32.item(0).id", "region3"); | |
| 113 | |
| 114 var namedFlow2 = getFlowByName("flow2"); | |
| 115 var regionListP1 = namedFlow2.getRegionsByContent(document.getElemen
tById("p1")); | |
| 116 shouldBeNonNull("regionListP1"); | |
| 117 shouldEvaluateTo("regionListP1.length", 1); | |
| 118 shouldBeEqualToString("regionListP1.item(0).id", "region4"); | |
| 119 | |
| 120 var p2 = document.createElement("p"); | |
| 121 p2.id = "p2"; | |
| 122 p2.appendChild(document.createTextNode("Text inside paragraph p2."))
; | |
| 123 document.getElementById("article2").appendChild(p2); | |
| 124 var regionListP2 = namedFlow2.getRegionsByContent(p2); | |
| 125 shouldBeNonNull("regionListP2"); | |
| 126 shouldEvaluateTo("regionListP2.length", 1); | |
| 127 shouldBeEqualToString("regionListP2.item(0).id", "region4"); | |
| 128 | |
| 129 // add another element p, in the overflow part of the region4 | |
| 130 var p3 = document.createElement("p"); | |
| 131 p3.id = "p3"; | |
| 132 p3.appendChild(document.createTextNode("Text inside paragraph p3."))
; | |
| 133 document.getElementById("article2").appendChild(p3); | |
| 134 var regionListP3 = namedFlow2.getRegionsByContent(p3); | |
| 135 shouldBeNonNull("regionListP3"); | |
| 136 shouldEvaluateTo("regionListP3.length", 1); | |
| 137 shouldBeEqualToString("regionListP3.item(0).id", "region4"); | |
| 138 | |
| 139 // add another region to flow2, p2 and p3 go to region5 | |
| 140 var region5 = document.createElement("div"); | |
| 141 region5.id = "region5"; | |
| 142 document.body.appendChild(region5); | |
| 143 | |
| 144 var regionListP22 = namedFlow2.getRegionsByContent(p2); | |
| 145 shouldEvaluateTo("regionListP22.length", 1); | |
| 146 shouldBeEqualToString("regionListP22.item(0).id", "region5"); | |
| 147 | |
| 148 hideRegions(); | |
| 149 </script> | |
| 150 </body> | |
| 151 </html> | |
| OLD | NEW |