Chromium Code Reviews| Index: LayoutTests/scrollbars/scrollbar-visibility-hidden.html |
| diff --git a/LayoutTests/scrollbars/scrollbar-visibility-hidden.html b/LayoutTests/scrollbars/scrollbar-visibility-hidden.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..009608554c93b2b455853e7e01618bb823673b52 |
| --- /dev/null |
| +++ b/LayoutTests/scrollbars/scrollbar-visibility-hidden.html |
| @@ -0,0 +1,53 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> |
| +</head> |
| +<body> |
| +<!-- http://crbug.com/313908 --> |
| +<p>Test that the scrollbars of a visibility:hidden overflow:auto DIV do not participate in hit testing</p> |
| + |
| +<div id="result">FAIL: script didn't run to completion.</div> |
| + |
| +<div id="div1" style="position: absolute; top: 100px; left: 0; width: 100px; height: 140px; background-color: Pink; overflow: auto;"> |
| +<div id="div1Content" style="width: 100%; height: 500px;"> |
| + Div 1 |
| +</div> |
| +</div> |
| +<div id="div2" style="position: absolute; top: 120px; left: 0; width: 100px; height: 100px; background-color: Gold; overflow: auto; z-index: 1;"> |
| +<div id="div2Content" style="width: 200%; height: 500px;"> |
| + Div 2 |
| +</div> |
| +</div> |
| + |
| +<script> |
| + |
| + if (window.testRunner) |
| + testRunner.dumpAsText(); |
| + |
| + // First sanity check that the element at points (95, 170) and (50, 215) is div2 when it's visible. |
| + var elem = document.elementFromPoint(95, 120 + 50); |
|
tony
2013/11/18 17:26:55
We normally use dom position values (offsetTop/off
|
| + var elem2 = document.elementFromPoint(50, 120 + 95); |
| + if (elem.id != "div2" || elem2.id != "div2") { |
| + document.getElementById("result").firstChild.data = "FAILURE: The element at points (95, 170) and (50, 215) should be div2."; |
| + } else { |
| + // Hide div2 by applying visibility:hidden. |
| + document.getElementById("div2").style.visibility = "hidden"; |
| + |
| + // (95, 170) would be within div2's vertical scrollbar if div2 were still visible. |
|
tony
2013/11/18 17:26:55
It would probably be safer to subtract 5px from th
|
| + elem = document.elementFromPoint(95, 120 + 50); |
| + // (50, 215) would be within div2's horizontal scrollbar if div2 were still visible. |
| + elem2 = document.elementFromPoint(50, 120 + 95); |
| + |
| + if (elem.id != "div1") { |
| + document.getElementById("result").firstChild.data = "FAILURE: The element at point (95, 170) should be div1."; |
| + } else if (elem2.id != "div1Content") { |
| + document.getElementById("result").firstChild.data = "FAILURE: The element at point (50, 215) should be div1Content."; |
| + } else { |
| + document.getElementById("result").firstChild.data = "SUCCESS"; |
| + } |
| + } |
| + |
| +</script> |
| +</body> |
| +</html> |