Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / touchadjustment / scroll-offset.html
blobca720d162aede71456c3442bd108cf95743f5a8a
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Touch Adjustment : Adjust correctly for scroll offset - bug 86205</title>
5 <script src="../resources/js-test.js"></script>
6 <script src="resources/touchadjustment.js"></script>
7 <style>
8 #scrolloffsetcontainer {
9 position: absolute;
10 top: 500px;
11 height: 1000px;
13 body {
14 margin: 0px;
16 #div0 { margin-left: 20px; height: 100px; box-sizing: border-box; }
17 #div1 { margin-left: 10px; height: 100px; box-sizing: border-box; }
18 </style>
19 </head>
20 <body>
22 <div id=scrolloffsetcontainer>
23 <div id=div0>
24 <a id=a0 href="#div0">Link 0</a>
25 </div>
26 <div id=div1>
27 <a id=a1 href="#div1">Link 1</a>
28 </div>
29 </div>
31 <p id='description'></p>
32 <div id='console'></div>
34 <script>
35 var adjustedNode;
36 var adjustedPoint;
37 // Set up shortcut access to elements
38 var e = {};
39 ['scrolloffsetcontainer', 'div0', 'div1', 'a0', 'a1'].forEach(function(a) {
40 e[a] = document.getElementById(a);
41 });
43 function adjustedPointAtTouch(x, y, radius)
45 var x = x - radius;
46 var y = y - radius;
47 var width = radius * 2;
48 var height = radius * 2;
49 var position = internals.touchPositionAdjustedToBestClickableNode(x, y, width, height, document);
50 return position;
53 function testDirectTouches()
55 testTouchPoint(touchPoint(40, 130, 50), e.a0);
56 testTouchPoint(touchPoint(30, 230, 50), e.a1);
58 function testAdjustedTouches()
60 adjustedPoint = adjustedPointAtTouch(10, 120, 80);
61 shouldBeNonNull('adjustedPoint');
62 adjustedNode = document.elementFromPoint(adjustedPoint.x, adjustedPoint.y);
63 shouldBe('adjustedNode', 'e.a0');
65 adjustedPoint = adjustedPointAtTouch(5, 220, 80);
66 shouldBeNonNull('adjustedPoint');
67 adjustedNode = document.elementFromPoint(adjustedPoint.x, adjustedPoint.y);
68 shouldBe('adjustedNode', 'e.a1');
71 function runTests()
73 if (window.testRunner && window.internals && internals.touchNodeAdjustedToBestClickableNode) {
74 description('Test touch adjustment when main frame is scroll offset.');
75 window.scrollBy(0,400);
76 testDirectTouches();
77 testAdjustedTouches();
78 e.scrolloffsetcontainer.style.display = 'none';
81 runTests();
82 </script>
85 </body>
86 </html>