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="region_2"></div> | 32 <div id="region_2"></div> |
33 | 33 |
34 <div id="console" class="block"></div> | 34 <div id="console" class="block"></div> |
35 | 35 |
36 <script> | 36 <script> |
37 description("Tests regionLayoutEvent") | 37 description("Tests regionOversetChange event") |
38 if (window.testRunner) { | 38 if (window.testRunner) { |
39 testRunner.dumpAsText(); | 39 testRunner.dumpAsText(); |
40 testRunner.waitUntilDone(); | 40 testRunner.waitUntilDone(); |
41 } | 41 } |
42 | 42 |
43 window.jsTestIsAsync = true; | 43 window.jsTestIsAsync = true; |
44 function flowContent(flowName) { | 44 function flowContent(flowName) { |
45 var r = document.getElementById("region_1"); | 45 var r = document.getElementById("region_1"); |
46 r.style.webkitFlowFrom = flowName; | 46 r.style.webkitFlowFrom = flowName; |
47 r = document.getElementById("region_2"); | 47 r = document.getElementById("region_2"); |
48 r.style.webkitFlowFrom = flowName; | 48 r.style.webkitFlowFrom = flowName; |
49 } | 49 } |
50 | 50 |
51 var count = 0; | 51 var eventCount = 0; |
52 function regionLayoutUpdated(event) { | 52 function finishTest() { |
| 53 shouldBe("eventCount", "2"); |
| 54 finishJSTest(); |
| 55 } |
| 56 |
| 57 function regionOversetChanged(event) { |
53 shouldBeEqualToString("event.target.name", "article"); | 58 shouldBeEqualToString("event.target.name", "article"); |
54 if (++count > 1) { | 59 if (++eventCount > 1) { |
55 event.target.removeEventListener("webkitregionlayoutupdate", regionLa
youtUpdated); | 60 // this should be reached after region_2 is removed from DOM |
56 // this should be reached after region_2 is removed from DOM | 61 setTimeout("finishTest()", 200); |
57 finishJSTest(); | |
58 return; | 62 return; |
59 } | 63 } |
60 | 64 |
61 var r2 = document.getElementById("region_2"); | 65 var r2 = document.getElementById("region_2"); |
62 debug("Removing region_2 from flow"); | 66 debug("Removing region_2 from flow"); |
63 r2.style.webkitFlowFrom = "none"; // this will trigger a new round of ev
ents due to layout | 67 r2.style.webkitFlowFrom = "none"; // this will trigger a new round of ev
ents due to layout |
64 } | 68 } |
65 | 69 |
66 function startTest() { | 70 function startTest() { |
67 var flow = getFlowByName("article"); | 71 var flow = getFlowByName("article"); |
68 flow.addEventListener("webkitregionlayoutupdate", regionLayoutUpdated); | 72 flow.addEventListener("webkitregionoversetchange", regionOversetChanged)
; |
69 | 73 |
70 debug("Flow content"); | 74 debug("Flow content"); |
71 flowContent("article"); | 75 flowContent("article"); |
72 } | 76 } |
73 window.addEventListener("load", startTest); | 77 window.addEventListener("load", startTest); |
74 </script> | 78 </script> |
75 <script src="../../fast/js/resources/js-test-post.js"></script> | 79 <script src="../../fast/js/resources/js-test-post.js"></script> |
76 </body> | 80 </body> |
77 </html> | 81 </html> |
OLD | NEW |