OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 | 4 |
5 var logDiv; | 5 var logDiv; |
6 | 6 |
7 function log(msg, success) | 7 function log(msg, success) |
8 { | 8 { |
9 logDiv.appendChild(document.createElement('div')).textContent = msg + ': ' +
(success ? 'PASS' : 'FAIL'); | 9 logDiv.appendChild(document.createElement('div')).textContent = msg + ': ' +
(success ? 'PASS' : 'FAIL'); |
10 } | 10 } |
11 | 11 |
12 function clickOn(element) | 12 function moveOver(element) |
13 { | 13 { |
14 if (!window.eventSender) | 14 if (!window.eventSender) |
15 return; | 15 return; |
16 | 16 |
17 var x = element.offsetLeft + element.offsetWidth / 2; | 17 var x = element.offsetLeft + element.offsetWidth / 2; |
18 var y = element.offsetTop + element.offsetHeight / 2; | 18 var y = element.offsetTop + element.offsetHeight / 2; |
19 eventSender.mouseMoveTo(x, y); | 19 eventSender.mouseMoveTo(x, y); |
| 20 } |
| 21 |
| 22 function clickOn(element) |
| 23 { |
| 24 moveOver(element); |
20 eventSender.mouseDown(); | 25 eventSender.mouseDown(); |
21 eventSender.mouseUp(); | 26 eventSender.mouseUp(); |
22 } | 27 } |
23 | 28 |
24 function clickOnLeftQuarterOf(element) | 29 function clickOnLeftQuarterOf(element) |
25 { | 30 { |
26 if (!window.eventSender) | 31 if (!window.eventSender) |
27 return; | 32 return; |
28 | 33 |
29 var x = element.offsetLeft + element.offsetWidth / 4; | 34 var x = element.offsetLeft + element.offsetWidth / 4; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 var counter = function() | 98 var counter = function() |
94 { | 99 { |
95 count++; | 100 count++; |
96 } | 101 } |
97 document.body.addEventListener('DOMActivate', counter, false); | 102 document.body.addEventListener('DOMActivate', counter, false); |
98 clickOnLeftQuarterOf(fileInput); | 103 clickOnLeftQuarterOf(fileInput); |
99 log("Events for default event handler should not be retargeted", count =
= 1); | 104 log("Events for default event handler should not be retargeted", count =
= 1); |
100 document.body.removeEventListener('DOMActivate', counter, false); | 105 document.body.removeEventListener('DOMActivate', counter, false); |
101 fileInput.parentNode.removeChild(fileInput); | 106 fileInput.parentNode.removeChild(fileInput); |
102 }, | 107 }, |
| 108 relatedTargetRetargeting: function() |
| 109 { |
| 110 var count = 0; |
| 111 var textInput = document.body.appendChild(document.createElement('input'
)); |
| 112 var counter = function(evt) |
| 113 { |
| 114 if (evt.relatedTarget && !evt.relatedTarget.parentNode) |
| 115 count++; |
| 116 } |
| 117 moveOver(textInput); |
| 118 document.body.addEventListener("mouseover", counter, false); |
| 119 moveOver(document.body); |
| 120 document.body.removeEventListener("mouseover", counter, false); |
| 121 log("Event's relatedTarget should be retargeted", count == 0); |
| 122 textInput.parentNode.removeChild(textInput); |
| 123 }, |
103 eventInProgress: function() | 124 eventInProgress: function() |
104 { | 125 { |
105 var textInput = document.body.appendChild(document.createElement('input'
)); | 126 var textInput = document.body.appendChild(document.createElement('input'
)); |
106 textInput.addEventListener('click', function(e) | 127 textInput.addEventListener('click', function(e) |
107 { | 128 { |
108 log('Other events should be retargeted', e.target == textInput); | 129 log('Other events should be retargeted', e.target == textInput); |
109 }, false); | 130 }, false); |
110 clickOn(textInput); | 131 clickOn(textInput); |
111 textInput.parentNode.removeChild(textInput); | 132 textInput.parentNode.removeChild(textInput); |
112 }, | 133 }, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 172 } |
152 | 173 |
153 </script> | 174 </script> |
154 </head> | 175 </head> |
155 <body onload="runTest()"> | 176 <body onload="runTest()"> |
156 <p>Tests to ensure that shadow DOM boundary is not crossed during event prop
agation. Can only run within DRT. | 177 <p>Tests to ensure that shadow DOM boundary is not crossed during event prop
agation. Can only run within DRT. |
157 <p>See <a href="https://bugs.webkit.org/show_bug.cgi?id=46015">bug 46015</a>
for details. | 178 <p>See <a href="https://bugs.webkit.org/show_bug.cgi?id=46015">bug 46015</a>
for details. |
158 <div id="log"></div> | 179 <div id="log"></div> |
159 </body> | 180 </body> |
160 </html> | 181 </html> |
OLD | NEW |