| OLD | NEW |
| (Empty) |
| 1 <!doctype html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../../resources/js-test.js"></script> | |
| 5 <script src="../resources/helper.js"></script> | |
| 6 <style> | |
| 7 .notVisible { visibility: hidden; } | |
| 8 .flow { -webkit-flow-into: flow; } | |
| 9 #article { width: 50px; height: 50px; background-color: green; } | |
| 10 #region { -webkit-flow-from: flow; } | |
| 11 </style> | |
| 12 </head> | |
| 13 <body> | |
| 14 <div id="eventCount"></div> | |
| 15 <div id="article"></div> | |
| 16 <div id="region"></div> | |
| 17 <script> | |
| 18 description("Test for WebKitBug 102101 [CSS Regions] regionlayoutupd
ate event fires continuously"); | |
| 19 | |
| 20 if (window.testRunner) { | |
| 21 window.testRunner.dumpAsText(); | |
| 22 window.testRunner.waitUntilDone(); | |
| 23 } | |
| 24 | |
| 25 window.jsTestIsAsync = true; | |
| 26 | |
| 27 var eventDispatchCount = 0; | |
| 28 var timeoutID; | |
| 29 | |
| 30 function flowThreadUpdated(event) { | |
| 31 if (++eventDispatchCount > 1) { | |
| 32 endTest(); | |
| 33 return; | |
| 34 } | |
| 35 | |
| 36 // Updating the content of eventCount element should not trigger
a layout | |
| 37 // on the auto-height region. | |
| 38 document.getElementById("eventCount").textContent = eventDispatc
hCount; | |
| 39 } | |
| 40 | |
| 41 function startTest() { | |
| 42 getFlowByName("flow").addEventListener("webkitregionlayoutupdate
", flowThreadUpdated); | |
| 43 document.getElementById("article").className = "flow"; | |
| 44 timeoutID = window.setTimeout(endTest, 500); | |
| 45 } | |
| 46 | |
| 47 function endTest() { | |
| 48 window.clearTimeout(timeoutID); | |
| 49 getFlowByName("flow").removeEventListener("webkitregionlayoutupd
ate", flowThreadUpdated); | |
| 50 | |
| 51 document.getElementById("eventCount").className = "notVisible"; | |
| 52 document.getElementById("region").className = "notVisible"; | |
| 53 | |
| 54 if (eventDispatchCount > 1) | |
| 55 debug("FAIL The regionlayoutupdate event fired twice instead
of once.") | |
| 56 else | |
| 57 debug("PASS The regionlayoutupdate fired only once."); | |
| 58 finishJSTest(); | |
| 59 } | |
| 60 | |
| 61 window.addEventListener("load", startTest); | |
| 62 </script> | |
| 63 </body> | |
| 64 </html> | |
| OLD | NEW |