OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script> | 4 <script> |
5 var eventCount = 0; | 5 var eventCount = 0; |
6 | 6 |
7 function handleClick(evt) { | 7 function handleClick(evt) { |
8 eventCount++; | 8 eventCount++; |
9 document.getElementById('click').textContent = 'PASS'; | 9 document.getElementById('click').textContent = 'PASS'; |
10 } | 10 } |
(...skipping 16 matching lines...) Expand all Loading... |
27 function handleTouchCancel(evt) { | 27 function handleTouchCancel(evt) { |
28 eventCount++; | 28 eventCount++; |
29 document.getElementById('touchcancel').textContent = 'PASS'; | 29 document.getElementById('touchcancel').textContent = 'PASS'; |
30 } | 30 } |
31 | 31 |
32 function fireEvents() { | 32 function fireEvents() { |
33 if (!window.testRunner || !window.eventSender) { | 33 if (!window.testRunner || !window.eventSender) { |
34 document.write('This test does not work in manual mode.'); | 34 document.write('This test does not work in manual mode.'); |
35 } else { | 35 } else { |
36 var svg = document.getElementById('svg'); | 36 var svg = document.getElementById('svg'); |
37 var positionX = svg.offsetLeft + 30; | 37 var clientRect = svg.getBoundingClientRect(); |
38 var positionY = svg.offsetTop + 30; | 38 var positionX = clientRect.left + 30; |
| 39 var positionY = clientRect.top + 30; |
39 | 40 |
40 // Touch, move, end. | 41 // Touch, move, end. |
41 eventSender.addTouchPoint(positionX, positionY); | 42 eventSender.addTouchPoint(positionX, positionY); |
42 eventSender.touchStart(); | 43 eventSender.touchStart(); |
43 eventSender.updateTouchPoint(0, positionX + 10, positionY + 10); | 44 eventSender.updateTouchPoint(0, positionX + 10, positionY + 10); |
44 eventSender.touchMove(); | 45 eventSender.touchMove(); |
45 eventSender.releaseTouchPoint(0); | 46 eventSender.releaseTouchPoint(0); |
46 eventSender.touchEnd(); | 47 eventSender.touchEnd(); |
47 // Touch, cancel. | 48 // Touch, cancel. |
48 eventSender.addTouchPoint(positionX, positionY); | 49 eventSender.addTouchPoint(positionX, positionY); |
(...skipping 27 matching lines...) Expand all Loading... |
76 onclick fired: <span id="click">FAIL</span><br/> | 77 onclick fired: <span id="click">FAIL</span><br/> |
77 ontouchstart fired: <span id="touchstart">FAIL</span><br/> | 78 ontouchstart fired: <span id="touchstart">FAIL</span><br/> |
78 ontouchmove fired: <span id="touchmove">FAIL</span><br/> | 79 ontouchmove fired: <span id="touchmove">FAIL</span><br/> |
79 ontouchend fired: <span id="touchend">FAIL</span><br/> | 80 ontouchend fired: <span id="touchend">FAIL</span><br/> |
80 ontouchcancel fired: <span id="touchcancel">FAIL</span><br/> | 81 ontouchcancel fired: <span id="touchcancel">FAIL</span><br/> |
81 total event count is 6: <span id="eventcount">FAIL</span><br/> | 82 total event count is 6: <span id="eventcount">FAIL</span><br/> |
82 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xl
ink" width="100" height="100" id="svg"> | 83 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xl
ink" width="100" height="100" id="svg"> |
83 <rect id="rect" x="20" y="20" width="60" height="60" fill="green" onclick="h
andleClick()" ontouchstart="handleTouchStart()" ontouchmove="handleTouchMove()"
ontouchend="handleTouchEnd()" ontouchcancel="handleTouchCancel()"/> | 84 <rect id="rect" x="20" y="20" width="60" height="60" fill="green" onclick="h
andleClick()" ontouchstart="handleTouchStart()" ontouchmove="handleTouchMove()"
ontouchend="handleTouchEnd()" ontouchcancel="handleTouchCancel()"/> |
84 </svg> | 85 </svg> |
85 </body> | 86 </body> |
86 </html> | 87 </html> |
OLD | NEW |