Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Side by Side Diff: LayoutTests/fast/dom/elementsFromPoint/elementsFromPoint-invalid-cases.html

Issue 869813003: Implement elementsFromPoint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Cleanup, add a better test for tables Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <script src="../../../resources/js-test.js"></script>
3 <script src="resources/elementsFromPoint.js"></script>
4 <style>
5 html {
6 overflow-y: scroll;
7 overflow-x: scroll;
8 }
9 html, body {
10 margin: 0;
11 padding: 0;
12 }
13 body {
14 width: 100%;
15 height: 100%;
16 }
17 #simpleDiv {
18 width: 200px;
19 height: 200px;
20 background-color: rgba(0,255,0,0.5);
21 }
22 #beyondTopLeft {
23 position: absolute;
24 transform: translate3d(-100px, -100px, 10px);
25 left: 0;
26 top: 0;
27 width: 100px;
28 height: 100px;
29 background-color: rgba(0,0,0,0.1);
30 }
31 </style>
32 <body>
33 <div id="beyondTopLeft"></div>
34 <div id="simpleDiv"></div>
35 <div id="console"></div>
36 <script>
37 window.jsTestIsAsync = true;
38
39 if (window.testRunner)
40 testRunner.dumpAsText();
41
42 if (window.internals)
43 internals.settings.setMockScrollbarsEnabled(true);
44
45 onload = function() {
46 // Verify the document root element is the last element returned for empty q ueries.
47 shouldBe('document.elementsFromPoint(300, 300)[0]', 'document.body.parentEle ment');
48
49 // Verify the document root element is the last element returned for valid q ueries.
50 var simpleDiv = document.getElementById('simpleDiv');
51 var simpleRect = simpleDiv.getBoundingClientRect();
52 var simpleCoords = (simpleRect.right - 1) + ', ' + (simpleRect.bottom - 1);
53 shouldBe('document.elementsFromPoint(' + simpleCoords + ')[0]', 'simpleDiv') ;
54 shouldBe('document.elementsFromPoint(' + simpleCoords + ')[1]', 'document.bo dy');
55 shouldBe('document.elementsFromPoint(' + simpleCoords + ')[2]', 'document.bo dy.parentElement');
56
57 // Verify an empty sequence is returned for queries outside the viewport.
58 var bodyRect = document.body.getBoundingClientRect();
59 var bodyScrollBar = (bodyRect.right + 1) + ', ' + (bodyRect.top + 1);
60 shouldBeEqualToNumber('document.elementsFromPoint(' + bodyScrollBar + ').len gth', 0);
61 var outsideBodyLeft = (bodyRect.left - 1) + ', ' + (bodyRect.top + 1);
62 shouldBeEqualToNumber('document.elementsFromPoint(' + outsideBodyLeft + ').l ength', 0);
63 var outsideBodyTopLeft = (bodyRect.left - 10) + ', ' + (bodyRect.top - 10);
64 shouldBeEqualToNumber('document.elementsFromPoint(' + outsideBodyTopLeft + ' ).length', 0);
65
66 finishJSTest();
67 }
68 </script>
69 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698