10 box-sizing: border-box;
16 box-sizing: border-box;
19 border:
1px solid black;
23 <script src=
"../../../resources/js-test.js"></script>
24 <script src=
"resources/nodesFromRect.js"></script>
27 <input id=
"text-input" type=
"text"> <br>
28 <iframe id=
"iframe" src=
"resources/child-frame-scrolled.html"></iframe>
29 <div id=
"console"></div>
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();