Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / regions / cssom / webkit-named-flow-event-add-to-flow.html
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 {
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     window.jsTestIsAsync = true;
43     function flowContent(region, flowName) {
44         var r = document.getElementById(region);
45         r.style.webkitFlowFrom = flowName;
46     }
47
48     var eventCount = 0;
49     function finishTest() {
50         shouldBe("eventCount", "2");
51         finishJSTest();
52     }
53
54     function regionOversetChanged(event) {
55         shouldBeEqualToString("event.target.name", "article");
56         
57         if (++eventCount > 1) {
58             // this should be reached after region_2 is added to flow
59             finishTest();
60             return;
61         }
62         
63         flowContent("region_2", "article"); // this will trigger a new round of events due to layout
64     }
65
66     function startTest() {
67         var flow = getFlowByName("article");
68         flow.addEventListener("webkitregionoversetchange", regionOversetChanged);
69         
70         debug("Flow content");
71         flowContent("region_1", "article");
72     }
73     window.addEventListener("load", startTest);
74 </script>
75 </body>
76 </html>