Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / nodesFromRect / nodesFromRect-child-frame-scrolled-content.html
blob489ea3422463073d8abd18b1fe7d6fce10748c9b
1 <!DOCTYPE html>
2 <style>
3 body { margin: 0px; }
4 #sandbox {
5 width: 400px;
6 height: 200px;
8 #sandbox iframe {
9 display: block;
10 box-sizing: border-box;
11 width: 200px;
12 height: 200px;
13 border: none;
15 #sandbox {
16 box-sizing: border-box;
17 height: 100px;
18 width: 200px;
19 border: 1px solid black;
21 </style>
23 <script src="../../../resources/js-test.js"></script>
24 <script src="resources/nodesFromRect.js"></script>
26 <body id="body">
27 <input id="text-input" type="text"> <br>
28 <iframe id="iframe" src="resources/child-frame-scrolled.html"></iframe>
29 <div id="console"></div>
30 </body>
32 <script>
33 description("nodesFromRect returns correct rects when the rect is overlapping" +
34 " an iframe with scrolled contents");
36 if (window.testRunner) {
37 testRunner.dumpAsText();
38 testRunner.waitUntilDone();
41 window.addEventListener("message", function(evt) {
42 if (evt.data == "subframe-loaded") {
43 var inputElement = document.getElementById('text-input');
44 var inputBoundingRect = inputElement.getBoundingClientRect();
45 var inputCenterX = inputBoundingRect.left + inputBoundingRect.width / 2;
46 var inputCenterY = inputBoundingRect.top + inputBoundingRect.height / 2;
47 var inputHeight = inputBoundingRect.height;
49 var iframeElement = document.getElementById('iframe');
50 var iframeBoundingRect = iframeElement.getBoundingClientRect();
51 var iframeCenterX = iframeBoundingRect.left + iframeBoundingRect.width / 2;
52 var iframeCenterY = iframeBoundingRect.top + iframeBoundingRect.height / 2;
54 // Rect is totally within input box.
55 checkRect(inputCenterX, inputCenterY, 1, 1, "DIV#inner-editor");
56 // Rect covers both input box and iframe.
57 checkRect(inputCenterX, inputCenterY, inputHeight, inputHeight,
58 "DIV#content, IFRAME#iframe, DIV#inner-editor, INPUT#text-input, BODY#body");
59 // Rect is totally within iframe.
60 checkRect(iframeCenterX, iframeCenterY, 1, 1, "DIV#content");
62 if (window.testRunner)
63 testRunner.notifyDone();
66 }, true);
68 </script>