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