OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
leviw_travelin_and_unemployed
2013/11/20 19:33:26
Is this needed?
| |
5 </head> | |
6 <body> | |
7 <!-- http://crbug.com/313908 --> | |
leviw_travelin_and_unemployed
2013/11/20 19:33:26
How about just putting this in the description?
| |
8 <p>Test that the scrollbars of a visibility:hidden overflow:auto DIV do not part icipate in hit testing</p> | |
9 | |
10 <div id="result">FAIL: script didn't run to completion.</div> | |
11 | |
12 <div id="div1" style="position: absolute; top: 100px; width: 100px; height: 340p x; background-color: Pink; overflow: auto;"> | |
13 <div id="div1Content" style="width: 100%; height: 500px;"> | |
14 Div 1 | |
15 </div> | |
16 </div> | |
17 <div id="div2" style="position: absolute; top: 120px; width: 100px; height: 300p x; background-color: Gold; overflow: auto; z-index: 1;"> | |
18 <div id="div2Content" style="width: 200%; height: 500px;"> | |
19 Div 2 | |
20 </div> | |
21 </div> | |
22 | |
23 <script> | |
24 | |
25 if (window.testRunner) | |
26 testRunner.dumpAsText(); | |
27 | |
28 var div1 = document.getElementById("div1"); | |
29 var div2 = document.getElementById("div2"); | |
30 | |
31 // First sanity check points that should be within div2's vertical and horiz ontal scrollbars | |
32 // when it's visible. | |
33 // Subtract 5px from the right (bottom) edge to get a point within the verti cal (horizontal) scrollbar. | |
34 var verticalPoint = [div2.offsetLeft + div2.offsetWidth - 5, div2.offsetTop + Math.floor(div2.offsetHeight / 2)]; | |
35 var horizontalPoint = [div2.offsetLeft + Math.floor(div2.offsetWidth / 2), d iv2.offsetTop + div2.offsetHeight - 5]; | |
36 var elem = document.elementFromPoint(verticalPoint[0], verticalPoint[1]); | |
37 var elem2 = document.elementFromPoint(horizontalPoint[0], horizontalPoint[1] ); | |
38 if (elem.id != "div2" || elem2.id != "div2") { | |
39 document.getElementById("result").firstChild.data = "FAILURE: The elemen t at points (" + verticalPoint + ") and (" + horizontalPoint + ") should be div2 . You may need to turn on overflow scrollbars temporarily. (On Mac: Change the ' Show scroll bars' setting to 'Always'.)"; | |
40 } else { | |
41 // Hide div2 by applying visibility:hidden and re-check. | |
42 document.getElementById("div2").style.visibility = "hidden"; | |
43 | |
44 elem = document.elementFromPoint(verticalPoint[0], verticalPoint[1]); | |
45 elem2 = document.elementFromPoint(horizontalPoint[0], horizontalPoint[1] ); | |
46 | |
47 if (elem.id != "div1") { | |
48 document.getElementById("result").firstChild.data = "FAILURE: The el ement at point (" + verticalPoint + ") should be div1."; | |
49 } else if (elem2.id != "div1Content") { | |
50 document.getElementById("result").firstChild.data = "FAILURE: The el ement at point (" + horizontalPoint + ") should be div1Content."; | |
51 } else { | |
52 document.getElementById("result").firstChild.data = "SUCCESS"; | |
53 } | |
54 } | |
55 | |
56 </script> | |
57 </body> | |
58 </html> | |
OLD | NEW |