| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Touch Adjustment : HTML Label and form fields - bug 78801</title> | 4 <title>Touch Adjustment : HTML Label and form fields - bug 78801</title> |
| 5 <script src="../resources/js-test.js"></script> | 5 <script src="../resources/js-test.js"></script> |
| 6 <script src="resources/touchadjustment.js"></script> | 6 <script src="resources/touchadjustment.js"></script> |
| 7 <style> | 7 <style> |
| 8 #sandbox { | 8 #sandbox { |
| 9 position: absolute; | 9 position: absolute; |
| 10 left: 0px; | 10 left: 0px; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 var adjustedNode; | 33 var adjustedNode; |
| 34 // Set up shortcut access to elements | 34 // Set up shortcut access to elements |
| 35 var e = {}; | 35 var e = {}; |
| 36 ['sandbox', 'mylink', 'myform', 'myinput', 'mylabel', 'myspan'].forEach(func
tion(a) { | 36 ['sandbox', 'mylink', 'myform', 'myinput', 'mylabel', 'myspan'].forEach(func
tion(a) { |
| 37 e[a] = document.getElementById(a); | 37 e[a] = document.getElementById(a); |
| 38 }); | 38 }); |
| 39 | 39 |
| 40 function testDirectTouch(element) | 40 function testDirectTouch(element) |
| 41 { | 41 { |
| 42 var touchpoint = offsetTouchPoint(findAbsoluteBounds(element), 'center',
0, 20, 30); | 42 var touchpoint = offsetTouchPoint(findAbsoluteBounds(element), 'center',
0, 20, 30); |
| 43 testTouchPoint(touchpoint, element); | 43 testTouchPoint(touchpoint, element, /* allowTextNodes */ false, /* disal
lowShadowDOM */ true); |
| 44 } | 44 } |
| 45 | 45 |
| 46 function testIndirectTouch(element, offset) | 46 function testIndirectTouch(element, offset) |
| 47 { | 47 { |
| 48 // Touch just right of the element. | 48 // Touch just right of the element. |
| 49 var touchpoint = offsetTouchPoint(findAbsoluteBounds(element), 'right',
offset, 30, 20); | 49 var touchpoint = offsetTouchPoint(findAbsoluteBounds(element), 'right',
offset, 30, 20); |
| 50 testTouchPoint(touchpoint, element); | 50 testTouchPoint(touchpoint, element, /* allowTextNodes */ false, /* disal
lowShadowDOM */ true); |
| 51 } | 51 } |
| 52 | 52 |
| 53 function testDirectTouches() | 53 function testDirectTouches() |
| 54 { | 54 { |
| 55 debug('Testing small direct hits.'); | 55 debug('Testing small direct hits.'); |
| 56 | 56 |
| 57 testDirectTouch(e.mylink); | 57 testDirectTouch(e.mylink); |
| 58 testDirectTouch(e.mylabel); | 58 testDirectTouch(e.mylabel); |
| 59 testDirectTouch(e.myinput); | 59 testDirectTouch(e.myinput); |
| 60 } | 60 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 79 description('Tests if labels are treated as clickable if the input t
hey control is.'); | 79 description('Tests if labels are treated as clickable if the input t
hey control is.'); |
| 80 testDirectTouches(); | 80 testDirectTouches(); |
| 81 testIndirectTouches(); | 81 testIndirectTouches(); |
| 82 e.sandbox.style.display = 'none'; | 82 e.sandbox.style.display = 'none'; |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 runTests(); | 85 runTests(); |
| 86 </script> | 86 </script> |
| 87 </body> | 87 </body> |
| 88 </html> | 88 </html> |
| OLD | NEW |