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 { | 10 #region_1 { |
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 window.jsTestIsAsync = true; | 42 window.jsTestIsAsync = true; |
43 function flowContent(region, flowName) { | 43 function flowContent(region, flowName) { |
44 var r = document.getElementById(region); | 44 var r = document.getElementById(region); |
45 r.style.webkitFlowFrom = flowName; | 45 r.style.webkitFlowFrom = flowName; |
46 } | 46 } |
47 | 47 |
48 var count = 0; | 48 var eventCount = 0; |
49 function regionLayoutUpdated(event) { | 49 function finishTest() { |
| 50 shouldBe("eventCount", "2"); |
| 51 finishJSTest(); |
| 52 } |
| 53 |
| 54 function regionOversetChanged(event) { |
50 shouldBeEqualToString("event.target.name", "article"); | 55 shouldBeEqualToString("event.target.name", "article"); |
51 | 56 |
52 if (++count > 1) { | 57 if (++eventCount > 1) { |
53 event.target.removeEventListener("webkitregionlayoutupdate", regionL
ayoutUpdated); | |
54 | |
55 // this should be reached after region_2 is added to flow | 58 // this should be reached after region_2 is added to flow |
56 finishJSTest(); | 59 finishTest(); |
57 return; | 60 return; |
58 } | 61 } |
59 | 62 |
60 flowContent("region_2", "article"); // this will trigger a new round of
events due to layout | 63 flowContent("region_2", "article"); // this will trigger a new round of
events due to layout |
61 } | 64 } |
62 | 65 |
63 function startTest() { | 66 function startTest() { |
64 var flow = getFlowByName("article"); | 67 var flow = getFlowByName("article"); |
65 flow.addEventListener("webkitregionlayoutupdate", regionLayoutUpdated); | 68 flow.addEventListener("webkitregionoversetchange", regionOversetChanged)
; |
66 | 69 |
67 debug("Flow content"); | 70 debug("Flow content"); |
68 flowContent("region_1", "article"); | 71 flowContent("region_1", "article"); |
69 } | 72 } |
70 window.addEventListener("load", startTest); | 73 window.addEventListener("load", startTest); |
71 </script> | 74 </script> |
72 <script src="../../fast/js/resources/js-test-post.js"></script> | 75 <script src="../../fast/js/resources/js-test-post.js"></script> |
73 </body> | 76 </body> |
74 </html> | 77 </html> |
OLD | NEW |