4 <title>Document::nodesFromRect test - bug
40197</title>
5 <style type=
"text/css"> @import
"resources/nodesFromRect.css"; </style>
6 <script src=
"../../../resources/js-test.js"></script>
7 <script src=
"resources/nodesFromRect.js"></script>
8 <script type=
"application/javascript">
13 // Set up shortcut access to elements
14 e['html'] = document.getElementsByTagName(
"html")[
0];
15 ['h1', 'd1', 'd2', 'p1', 'p2', 'p3', 'p4', 'p5', 'span', 'body'].forEach(function(a) {
16 e[a] = document.getElementById(a);
19 window.scrollTo(
0,
0);
21 check(
53,
71,
0,
0,
0,
0, [e.body]);
22 check(
53,
71,
10,
0,
0,
0, [e.h1, e.body]);
23 check(
53,
71,
0,
10,
0,
0, [e.p3, e.body]);
24 check(
53,
71,
0,
0,
10,
0, [e.d1, e.body]);
25 check(
53,
71,
0,
0,
0,
10, [e.body]);
26 check(
53,
71,
0,
10,
0,
10, [e.p3, e.body]);
27 check(
53,
71,
10,
0,
10,
0, [e.d1, e.h1, e.body]);
28 check(
53,
71,
10,
10,
10,
10, [e.p3, e.d1, e.h1, e.body]);
30 check(
152,
105,
10,
0,
0,
0, [e.p3, e.body]);
31 check(
152,
105,
0,
10,
0,
0, [e.p4, e.body]);
32 check(
152,
105,
0,
0,
10,
0, [e.body]);
33 check(
152,
105,
0,
0,
0,
10, [e.d1, e.body]);
34 check(
152,
105,
10,
0,
10,
0, [e.p3, e.body]);
35 check(
152,
105,
0,
10,
0,
10, [e.p4, e.d1, e.body]);
36 check(
152,
105,
10,
10,
10,
10, [e.p4, e.p3, e.d1, e.body]);
38 // e.p1 is invisible and shouldn't appear:
39 check(
153,
193,
0,
0,
0,
0, [e.p5]);
40 // NOTE: [e.p5, e.d2]) should be returned if we did not stop
41 // at e.p5, which fully encloses the target rect.
42 check(
153,
193,
0,
20,
0,
20, [e.p5]);
43 check(
153,
193,
20,
0,
20,
0, [e.p5, e.body]);
45 check(
77,
240,
0,
0,
0,
0, [e.p2]);
46 check(
77,
240,
1,
0,
0,
0, [e.p5, e.p2]);
47 check(
77,
240,
0,
0,
1,
0, [e.span, e.p2]);
48 check(
77,
240,
1,
0,
1,
0, [e.p5, e.span, e.p2]);
50 // Precise pixel checks:
51 check(
144,
183,
0,
0,
0,
0, [e.body]);
52 check(
144,
183,
1,
0,
1,
0, [e.p5, e.body]);
53 check(
144,
183,
0,
1,
0,
1, [e.d2, e.body]);
54 check(
144,
183,
0,
0,
1,
0, [e.p5, e.body]);
55 check(
144,
183,
0,
0,
0,
1, [e.d2, e.body]);
56 check(
144,
183,
0,
0,
1,
1, [e.p5, e.d2, e.body]);
57 check(
144,
183,
1,
1,
1,
1, [e.p5, e.d2, e.body]);
58 check(
77,
240,
0,
0,
0,
0, [e.p2]);
59 check(
77,
240,
0,
1,
0,
1, [e.p2]);
60 check(
77,
240,
1,
0,
0,
0, [e.p5, e.p2]);
61 check(
77,
240,
0,
0,
1,
0, [e.span, e.p2]);
62 check(
77,
240,
1,
0,
1,
0, [e.p5, e.span, e.p2]);
63 check(
77,
240,
1,
1,
1,
1, [e.p5, e.span, e.p2]);
65 // Expanding area checks:
66 check(
39,
212,
0,
0,
0,
0, [e.body]);
67 check(
39,
212,
10,
0,
0,
0, [e.d2, e.body]);
68 check(
39,
212,
0,
0,
10,
0, [e.p2, e.body]);
69 check(
39,
212,
10,
1,
30,
0, [e.d2, e.p2, e.body]);
70 check(
39,
212,
10,
5,
30,
0, [e.span, e.d2, e.p2, e.body]);
71 check(
39,
212,
10,
15,
30,
0, [e.p5, e.span, e.d2, e.p2, e.body]);
72 check(
39,
212,
10,
0,
10,
0, [e.d2, e.p2, e.body]);
73 check(
39,
212,
0,
10,
0,
10, [e.p5, e.body]);
74 check(
39,
212,
10,
10,
10,
10, [e.p5, e.d2, e.p2, e.body]);
76 window.onload = runTest;
83 <!-- floated element -->
84 <div id=
"d2" style=
"float: left"></div>
86 <!-- hidden element -->
87 <p id=
"p1" style=
"float: left; visibility: hidden"></p>
89 <p id=
"p2" style=
"clear: left"><span id=
"span"></span></p>
91 <!-- absolute position -->
92 <p id=
"p3" style=
"position:absolute; top: 10px; left:50px; height:50px;"></p>
94 <!-- fixed position -->
95 <p id=
"p4" style=
"position: fixed; top: 30px; left: 150px; height: 50px; background-color: blue;"></p>
97 <!-- relative position -->
98 <p id=
"p5" style=
"position:relative; top: -100px; left: 30px; margin-bottom: -70px; background-color: green"></p>
100 <span id=
"console"></span>