| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../fast/js/resources/js-test-pre.js"></script> | 3 <script src="../../fast/js/resources/js-test-pre.js"></script> |
| 4 <script src="resources/helper.js"></script> | 4 <script src="resources/helper.js"></script> |
| 5 <style> | 5 <style> |
| 6 #article { | 6 #article { |
| 7 -webkit-flow-into: article; | 7 -webkit-flow-into: article; |
| 8 border: 2px solid black; | 8 border: 2px solid black; |
| 9 } | 9 } |
| 10 #region_1, #region_2{ | 10 #region_1, #region_2{ |
| 11 -webkit-flow-from: no_article; | 11 -webkit-flow-from: no_article; |
| 12 overflow:hidden; | 12 overflow:hidden; |
| 13 display:inline-block; | 13 display:inline-block; |
| 14 vertical-align:top; | 14 vertical-align:top; |
| 15 margin:10px; | 15 margin:10px; |
| 16 } | 16 } |
| 17 .block { | 17 .block { |
| 18 display:block; | 18 display:block; |
| 19 } | 19 } |
| 20 #region_1, #region_2 { height:110px; width:200px; margin: 5px;} | 20 #region_1, #region_2 { height:110px; width:200px; margin: 5px; border: 1px solid
red;} |
| 21 </style> | 21 </style> |
| 22 </head> | 22 </head> |
| 23 <body> | 23 <body> |
| 24 <div id="description" class="block"></div> | 24 <div id="description" class="block"></div> |
| 25 <div id="article"> | 25 <div id="article"> |
| 26 <div> | 26 <div> |
| 27 <div id="content" style="height: 200px; background-color: green;"></div> | 27 <div id="content" style="height: 200px; background-color: green;"></div> |
| 28 </div> | 28 </div> |
| 29 </div> | 29 </div> |
| 30 | 30 |
| 31 <div id="region_1"></div> | 31 <div id="region_1"></div> |
| 32 <div id="container2"> | 32 <div id="container2"> |
| 33 <div id="region_2"></div> | 33 <div id="region_2"></div> |
| 34 </div> | 34 </div> |
| 35 | 35 |
| 36 <div id="console" class="block"></div> | 36 <div id="console" class="block"></div> |
| 37 | 37 |
| 38 <script> | 38 <script> |
| 39 description("Tests regionLayoutEvent") | 39 description("Tests regionOversetChange event") |
| 40 if (window.testRunner) { | 40 if (window.testRunner) { |
| 41 testRunner.dumpAsText(); | 41 testRunner.dumpAsText(); |
| 42 testRunner.waitUntilDone(); | 42 testRunner.waitUntilDone(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 window.jsTestIsAsync = true; | 45 window.jsTestIsAsync = true; |
| 46 function flowContent(flowName) { | 46 function flowContent(flowName) { |
| 47 var r = document.getElementById("region_1"); | 47 var r = document.getElementById("region_1"); |
| 48 r.style.webkitFlowFrom = flowName; | 48 r.style.webkitFlowFrom = flowName; |
| 49 r = document.getElementById("region_2"); | 49 r = document.getElementById("region_2"); |
| 50 r.style.webkitFlowFrom = flowName; | 50 r.style.webkitFlowFrom = flowName; |
| 51 } | 51 } |
| 52 | 52 |
| 53 var count = 0; | 53 var eventCount = 0; |
| 54 function regionLayoutUpdated(event) { | 54 function finishTest() { |
| 55 shouldBe("eventCount", "2"); |
| 56 finishJSTest(); |
| 57 } |
| 58 |
| 59 function regionOversetChanged(event) { |
| 55 shouldBeEqualToString("event.target.name", "article"); | 60 shouldBeEqualToString("event.target.name", "article"); |
| 56 if (++count > 1) { | 61 if (++eventCount > 1) { |
| 57 event.target.removeEventListener("webkitregionlayoutupdate", regionLa
youtUpdated); | 62 event.target.removeEventListener("webkitregionoversetchange", regionO
versetChanged); |
| 58 // this should be reached after region_2 is removed from DOM | 63 // this should be reached after region_2 is removed from DOM |
| 59 finishJSTest(); | 64 finishTest(); |
| 60 return; | 65 return; |
| 61 } | 66 } |
| 62 | 67 |
| 63 var c2 = document.getElementById("container2"); | 68 var c2 = document.getElementById("container2"); |
| 64 debug("Removing region_2 from DOM"); | 69 debug("Removing region_2 from DOM"); |
| 65 c2.innerHTML = ""; // this will trigger a new round of events due to lay
out | 70 c2.innerHTML = ""; // this will trigger a new round of events due to lay
out |
| 66 } | 71 } |
| 67 | 72 |
| 68 function startTest() { | 73 function startTest() { |
| 69 var flow = getFlowByName("article"); | 74 var flow = getFlowByName("article"); |
| 70 flow.addEventListener("webkitregionlayoutupdate", regionLayoutUpdated); | 75 flow.addEventListener("webkitregionoversetchange", regionOversetChanged)
; |
| 71 | 76 |
| 72 debug("Flow content"); | 77 debug("Flow content"); |
| 73 flowContent("article"); | 78 flowContent("article"); |
| 74 } | 79 } |
| 75 window.addEventListener("load", startTest); | 80 window.addEventListener("load", startTest); |
| 76 </script> | 81 </script> |
| 77 <script src="../../fast/js/resources/js-test-post.js"></script> | 82 <script src="../../fast/js/resources/js-test-post.js"></script> |
| 78 </body> | 83 </body> |
| 79 </html> | 84 </html> |
| OLD | NEW |