| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <meta charset="utf-8"> | |
| 5 <script src="../../../resources/js-test.js"></script> | |
| 6 <script src="../resources/helper.js"></script> | |
| 7 <style> | |
| 8 #article { | |
| 9 -webkit-flow-into: article; | |
| 10 border: 2px solid black; | |
| 11 } | |
| 12 #region_1, #region_2{ | |
| 13 -webkit-flow-from: no_article; | |
| 14 overflow: hidden; | |
| 15 display: inline-block; | |
| 16 vertical-align: top; | |
| 17 margin: 10px; | |
| 18 } | |
| 19 .block { | |
| 20 display: block; | |
| 21 } | |
| 22 #region_1, #region_2 { height:110px; width:200px; border: 1px solid red;} | |
| 23 </style> | |
| 24 </head> | |
| 25 <body> | |
| 26 <div id="article"> | |
| 27 <div> | |
| 28 <div id="content" style="height: 200px; background-color: green;"></div> | |
| 29 </div> | |
| 30 </div> | |
| 31 | |
| 32 <div id="region_1"></div> | |
| 33 <div id="region_2"></div> | |
| 34 | |
| 35 <script> | |
| 36 | |
| 37 description("Tests the the NamedFlow object behavior as an EventTarget"); | |
| 38 | |
| 39 if (window.testRunner) { | |
| 40 testRunner.dumpAsText(); | |
| 41 testRunner.waitUntilDone(); | |
| 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 function makeFlowNull() { | |
| 52 shouldBeNonNull('getFlowByName("article")'); | |
| 53 | |
| 54 var el = document.getElementById("region_1"); | |
| 55 el.style.webkitFlowFrom = "no_article"; | |
| 56 el = document.getElementById("region_2"); | |
| 57 el.style.webkitFlowFrom = "no_article"; | |
| 58 el = document.getElementById("article"); | |
| 59 el.style.webkitFlowInto = "no_article"; | |
| 60 } | |
| 61 | |
| 62 var recreated = false; | |
| 63 function makeFlowCreated() { | |
| 64 shouldBeNull('getFlowByName("article")'); | |
| 65 gc(); | |
| 66 | |
| 67 var el = document.getElementById("region_1"); | |
| 68 el.style.webkitFlowFrom = "article"; | |
| 69 el = document.getElementById("region_2"); | |
| 70 el.style.webkitFlowFrom = "article"; | |
| 71 el = document.getElementById("article"); | |
| 72 el.style.webkitFlowInto = "article"; | |
| 73 | |
| 74 recreated = true; | |
| 75 } | |
| 76 | |
| 77 var updatedCount = 0; | |
| 78 function finishTest() { | |
| 79 shouldBe("updatedCount", "2"); | |
| 80 finishJSTest(); | |
| 81 } | |
| 82 | |
| 83 function flowThreadUpdated(event) { | |
| 84 ++updatedCount; | |
| 85 shouldBeEqualToString("event.target.name", "article"); | |
| 86 | |
| 87 if (updatedCount == 2) { | |
| 88 shouldBeTrue("recreated"); | |
| 89 event.target.removeEventListener("webkitregionoversetchange", flowThread
Updated); | |
| 90 makeFlowNull(); | |
| 91 setTimeout("finishTest()", 200); | |
| 92 return; | |
| 93 } | |
| 94 | |
| 95 makeFlowNull(); | |
| 96 shouldBeFalse("recreated"); | |
| 97 | |
| 98 // Set a timeout so the event reference to the target is discarded | |
| 99 setTimeout(makeFlowCreated, 10); | |
| 100 } | |
| 101 | |
| 102 function startTest() { | |
| 103 var flowThread = getFlowByName("article"); | |
| 104 flowThread.addEventListener("webkitregionoversetchange", flowThreadUpdated); | |
| 105 | |
| 106 debug("Flow content"); | |
| 107 flowContent("article"); | |
| 108 } | |
| 109 | |
| 110 window.addEventListener("load", startTest); | |
| 111 </script> | |
| 112 </body> | |
| 113 </html> | |
| OLD | NEW |