4 <title>Touch Adjustment : Disabled form elements - bug 92093</title>
5 <script src="../resources/js-test.js"></script>
6 <script src="resources/touchadjustment.js"></script>
7 <style type="text/css">
22 <label for="input1" id="label1">Label</label> <input type="text" id="input1" value="Disabled input" disabled></input><br>
23 <label for="input2" id="label2">Label</label> <input type="text" id="input2" value="Enabled input"></input>
27 <p id='description'></p>
28 <div id='console'></div>
31 // Set up shortcut access to elements
33 ['sandbox', 'form,', 'label1', 'label2', 'input1', 'input2'].forEach(function(a) {
34 e[a] = document.getElementById(a);
37 function testDirectTouches()
39 // Quick sanity check.
40 debug('Test we can hit the form elements directly.');
42 testTouchPoint(touchPoint(16, 8, 5), null);
43 testTouchPoint(touchPoint(16, 38, 5), e.label2);
44 testTouchPoint(touchPoint(60, 8, 5), null);
45 testTouchPoint(touchPoint(60, 38, 5), e.input2, /* allowTextNodes */ false, /* disallowShadowDOM */ true);
48 function testAdjustedTouches()
50 debug('Test indirect touches are adjusted to the enabled form elements.');
51 testTouchPoint(touchPoint(16, 25, 10), e.label2);
52 testTouchPoint(touchPoint(16, 20, 15), e.label2);
53 testTouchPoint(touchPoint(16, 16, 20), e.label2);
55 testTouchPoint(touchPoint(60, 25, 10), e.input2, /* allowTextNodes */ false, /* disallowShadowDOM */ true);
56 testTouchPoint(touchPoint(60, 20, 15), e.input2, /* allowTextNodes */ false, /* disallowShadowDOM */ true);
57 testTouchPoint(touchPoint(60, 16, 20), e.input2, /* allowTextNodes */ false, /* disallowShadowDOM */ true);
62 if (window.testRunner && window.internals && internals.touchNodeAdjustedToBestClickableNode) {
63 description(document.title);
65 testAdjustedTouches();
66 e.sandbox.style.display = 'none';