4 <title>Touch Adjustment : Improved targetting for small controls - bug
92293</title>
5 <script src=
"../resources/js-test.js"></script>
6 <script src=
"resources/touchadjustment.js"></script>
10 -webkit-margin-start:
20px;
18 border:
1px solid black;
19 display: inline-block;
21 vertical-align: middle;
27 display: inline-block;
29 vertical-align: middle;
33 border:
1px solid #
777;
39 border:
1px solid #
777;
47 display: inline-block;
48 vertical-align: middle;
52 -webkit-box-sizing: content-box;
55 border-left:
5px solid transparent;
56 border-right:
5px solid transparent;
57 border-top:
10px solid #
777;
67 <div class=
"control-pair">
68 <!-- Small checkbox to the left of another control -->
69 <div id=
"check" onclick=
"onClick();"></div>
70 <input id=
"task" type=
"text" value=
"Task 1">
72 <div class=
"control-pair">
73 <!-- Small remove button to the right of another control -->
74 <input id =
"item-label" type=
"text" value =
"Option 1">
75 <div id =
"remove-button" onclick=
"onClick();"></div>
78 <div id=
"combo-button">
79 <!-- Combo-button controls -->
80 <div id =
"combo-label" onclick=
"function() {};"></div>
81 <div id =
"drop-down-selector" onclick=
"onClick();"></div>
86 <p id='description'
></p>
87 <div id='console'
></div>
100 function testDirectTouch(id
)
102 testTouch(id
, 'center');
105 function testIndirectTouch(id
)
107 testTouch(id
, 'left');
108 testTouch(id
, 'right');
109 testTouch(id
, 'top-left');
110 testTouch(id
, 'top-right');
111 testTouch(id
, 'bottom-left');
112 testTouch(id
, 'bottom-right');
113 testTouch(id
, 'top');
114 testTouch(id
, 'bottom');
117 function testTouch(id
, relativePosition
)
119 var element
= document
.getElementById(id
);
120 testTouchPoint(offsetTouchPoint(findAbsoluteBounds(element
), relativePosition
, touchOffset
, touchRadius
), element
, /* allowTextNodes */ false, /* disallowShadowDOM */ true);
123 function testDirectTouches()
125 debug('Testing small direct hits.');
127 testDirectTouch('check');
128 testDirectTouch('task');
129 testDirectTouch('item-label');
130 testDirectTouch('remove-button');
131 testDirectTouch('combo-label');
132 testDirectTouch('drop-down-selector');
135 function testIndirectTouches()
137 debug('Testing indirect hits.');
139 testIndirectTouch('check');
140 testIndirectTouch('remove-button');
141 testIndirectTouch('drop-down-selector');
146 if (window
.testRunner
&& window
.internals
&& internals
.touchNodeAdjustedToBestClickableNode
) {
147 description('Tests if small clickable targets adjacent to larger clickable controls are properly targetted with touch adjustment.');
149 testIndirectTouches();
150 document
.getElementById('sandbox').style
.display
= 'none';