Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
| 5 </head> | |
| 6 <body> | |
| 7 <!-- http://crbug.com/313908 --> | |
| 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; left: 0; width: 100px; hei ght: 140px; 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; left: 0; width: 100px; hei ght: 100px; 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 // First sanity check that the element at points (95, 170) and (50, 215) is div2 when it's visible. | |
| 29 var elem = document.elementFromPoint(95, 120 + 50); | |
|
tony
2013/11/18 17:26:55
We normally use dom position values (offsetTop/off
| |
| 30 var elem2 = document.elementFromPoint(50, 120 + 95); | |
| 31 if (elem.id != "div2" || elem2.id != "div2") { | |
| 32 document.getElementById("result").firstChild.data = "FAILURE: The elemen t at points (95, 170) and (50, 215) should be div2."; | |
| 33 } else { | |
| 34 // Hide div2 by applying visibility:hidden. | |
| 35 document.getElementById("div2").style.visibility = "hidden"; | |
| 36 | |
| 37 // (95, 170) would be within div2's vertical scrollbar if div2 were stil l visible. | |
|
tony
2013/11/18 17:26:55
It would probably be safer to subtract 5px from th
| |
| 38 elem = document.elementFromPoint(95, 120 + 50); | |
| 39 // (50, 215) would be within div2's horizontal scrollbar if div2 were st ill visible. | |
| 40 elem2 = document.elementFromPoint(50, 120 + 95); | |
| 41 | |
| 42 if (elem.id != "div1") { | |
| 43 document.getElementById("result").firstChild.data = "FAILURE: The el ement at point (95, 170) should be div1."; | |
| 44 } else if (elem2.id != "div1Content") { | |
| 45 document.getElementById("result").firstChild.data = "FAILURE: The el ement at point (50, 215) should be div1Content."; | |
| 46 } else { | |
| 47 document.getElementById("result").firstChild.data = "SUCCESS"; | |
| 48 } | |
| 49 } | |
| 50 | |
| 51 </script> | |
| 52 </body> | |
| 53 </html> | |
| OLD | NEW |