OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <meta charset="utf-8"> | 4 <meta charset="utf-8"> |
5 <script src="../js/resources/js-test-pre.js"></script> | 5 <script src="../js/resources/js-test-pre.js"></script> |
6 <script src="resources/helper.js"></script> | 6 <script src="resources/helper.js"></script> |
7 <style> | 7 <style> |
8 #article { | 8 #article { |
9 -webkit-flow-into: article; | 9 -webkit-flow-into: article; |
10 border: 2px solid black; | 10 border: 2px solid black; |
(...skipping 18 matching lines...) Expand all Loading... |
29 </div> | 29 </div> |
30 </div> | 30 </div> |
31 | 31 |
32 <div id="region_1"></div> | 32 <div id="region_1"></div> |
33 <div id="container2"> | 33 <div id="container2"> |
34 <div id="region_2"></div> | 34 <div id="region_2"></div> |
35 </div> | 35 </div> |
36 | 36 |
37 <script> | 37 <script> |
38 | 38 |
39 description("Tests regionLayoutEvent being dispatched when the content is remove
d"); | 39 description("Tests regionOversetChange event being dispatched when the content i
s removed"); |
40 | 40 |
41 if (window.testRunner) { | 41 if (window.testRunner) { |
42 testRunner.dumpAsText(); | 42 testRunner.dumpAsText(); |
43 testRunner.waitUntilDone(); | 43 testRunner.waitUntilDone(); |
44 } | 44 } |
45 | 45 |
46 window.jsTestIsAsync = true; | 46 window.jsTestIsAsync = true; |
47 function flowContent(flowName) { | 47 function flowContent(flowName) { |
48 var r = document.getElementById("region_1"); | 48 var r = document.getElementById("region_1"); |
49 r.style.webkitFlowFrom = flowName; | 49 r.style.webkitFlowFrom = flowName; |
50 r = document.getElementById("region_2"); | 50 r = document.getElementById("region_2"); |
51 r.style.webkitFlowFrom = flowName; | 51 r.style.webkitFlowFrom = flowName; |
52 } | 52 } |
53 | 53 |
54 var count = 0; | 54 var count = 0; |
55 var layoutUpdateDispatchedForNullFlow = false; | 55 var regionOversetDispatchedForNullFlow = false; |
56 function regionLayoutUpdated(event) { | 56 function regionOversetChanged(event) { |
57 shouldBeEqualToString("event.target.name", "article"); | 57 shouldBeEqualToString("event.target.name", "article"); |
58 if (++count > 1) { | 58 if (++count > 1) { |
59 event.target.removeEventListener("webkitregionlayoutupdate", regionLa
youtUpdated); | 59 event.target.removeEventListener("webkitregionoversetchange", regionO
versetChanged); |
60 layoutUpdateDispatchedForNullFlow = true; | 60 regionOversetDispatchedForNullFlow = true; |
61 return; | 61 return; |
62 } | 62 } |
63 | 63 |
64 var el = document.getElementById("region_2"); | 64 var el = document.getElementById("region_2"); |
65 debug("Removing region_2 from flow"); | 65 debug("Removing region_2 from flow"); |
66 el.style.webkitFlowFrom = "none"; | 66 el.style.webkitFlowFrom = "none"; |
67 el = document.getElementById("region_1"); | 67 el = document.getElementById("region_1"); |
68 debug("Removing region_1 from flow"); | 68 debug("Removing region_1 from flow"); |
69 el.style.webkitFlowFrom = "none"; | 69 el.style.webkitFlowFrom = "none"; |
70 el = document.getElementById("article"); | 70 el = document.getElementById("article"); |
71 debug("Removing article from flow"); | 71 debug("Removing article from flow"); |
72 el.style.webkitFlowInto = "none"; | 72 el.style.webkitFlowInto = "none"; |
73 | 73 |
74 setTimeout(checkIfEventDispatched, 500); | 74 setTimeout(checkIfEventDispatched, 200); |
75 } | 75 } |
76 | 76 |
77 function checkIfEventDispatched() { | 77 function checkIfEventDispatched() { |
78 shouldBeFalse("layoutUpdateDispatchedForNullFlow"); | 78 shouldBeFalse("regionOversetDispatchedForNullFlow"); |
79 finishJSTest(); | 79 finishJSTest(); |
80 } | 80 } |
81 | 81 |
82 function startTest() { | 82 function startTest() { |
83 var flow = getFlowByName("article"); | 83 var flow = getFlowByName("article"); |
84 flow.addEventListener("webkitregionlayoutupdate", regionLayoutUpdated); | 84 flow.addEventListener("webkitregionoversetchange", regionOversetChanged)
; |
85 | 85 |
86 debug("Flow content"); | 86 debug("Flow content"); |
87 flowContent("article"); | 87 flowContent("article"); |
88 } | 88 } |
89 window.addEventListener("load", startTest); | 89 window.addEventListener("load", startTest); |
90 </script> | 90 </script> |
91 <script src="../js/resources/js-test-post.js"></script> | 91 <script src="../js/resources/js-test-post.js"></script> |
92 </body> | 92 </body> |
93 </html> | 93 </html> |
OLD | NEW |