Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / touchadjustment / disabled-formelements.html
1 <!DOCTYPE html>
2 <html>
3 <head>
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">
8         #sandbox {
9             position: absolute;
10             left: 0px;
11             top: 0px;
12             width: 600px;
13             height: 600px;
14         }
15     </style>
16 </head>
17
18 <body id="body">
19
20 <div id=sandbox>
21     <form id="form">
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>
24     </form>
25 </div>
26
27 <p id='description'></p>
28 <div id='console'></div>
29
30 <script>
31     // Set up shortcut access to elements
32     var e = {};
33     ['sandbox', 'form,', 'label1', 'label2', 'input1', 'input2'].forEach(function(a) {
34         e[a] = document.getElementById(a);
35     });
36
37     function testDirectTouches()
38     {
39         // Quick sanity check.
40         debug('Test we can hit the form elements directly.');
41
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);
46     }
47
48     function testAdjustedTouches()
49     {
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);
54
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);
58     }
59
60     function runTests()
61     {
62         if (window.testRunner && window.internals && internals.touchNodeAdjustedToBestClickableNode) {
63             description(document.title);
64             testDirectTouches();
65             testAdjustedTouches();
66             e.sandbox.style.display = 'none';
67         }
68     }
69
70     runTests();
71 </script>
72
73
74 </body>
75 </html>