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..f2b8b28b0761d84ef76023c91a628be1cd385795 |
| --- /dev/null |
| +++ b/LayoutTests/scrollbars/scrollbar-visibility-hidden.html |
| @@ -0,0 +1,58 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> |
|
leviw_travelin_and_unemployed
2013/11/20 19:33:26
Is this needed?
|
| +</head> |
| +<body> |
| +<!-- http://crbug.com/313908 --> |
|
leviw_travelin_and_unemployed
2013/11/20 19:33:26
How about just putting this in the description?
|
| +<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; width: 100px; height: 340px; 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; width: 100px; height: 300px; 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(); |
| + |
| + var div1 = document.getElementById("div1"); |
| + var div2 = document.getElementById("div2"); |
| + |
| + // First sanity check points that should be within div2's vertical and horizontal scrollbars |
| + // when it's visible. |
| + // Subtract 5px from the right (bottom) edge to get a point within the vertical (horizontal) scrollbar. |
| + var verticalPoint = [div2.offsetLeft + div2.offsetWidth - 5, div2.offsetTop + Math.floor(div2.offsetHeight / 2)]; |
| + var horizontalPoint = [div2.offsetLeft + Math.floor(div2.offsetWidth / 2), div2.offsetTop + div2.offsetHeight - 5]; |
| + var elem = document.elementFromPoint(verticalPoint[0], verticalPoint[1]); |
| + var elem2 = document.elementFromPoint(horizontalPoint[0], horizontalPoint[1]); |
| + if (elem.id != "div2" || elem2.id != "div2") { |
| + document.getElementById("result").firstChild.data = "FAILURE: The element 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'.)"; |
| + } else { |
| + // Hide div2 by applying visibility:hidden and re-check. |
| + document.getElementById("div2").style.visibility = "hidden"; |
| + |
| + elem = document.elementFromPoint(verticalPoint[0], verticalPoint[1]); |
| + elem2 = document.elementFromPoint(horizontalPoint[0], horizontalPoint[1]); |
| + |
| + if (elem.id != "div1") { |
| + document.getElementById("result").firstChild.data = "FAILURE: The element at point (" + verticalPoint + ") should be div1."; |
| + } else if (elem2.id != "div1Content") { |
| + document.getElementById("result").firstChild.data = "FAILURE: The element at point (" + horizontalPoint + ") should be div1Content."; |
| + } else { |
| + document.getElementById("result").firstChild.data = "SUCCESS"; |
| + } |
| + } |
| + |
| +</script> |
| +</body> |
| +</html> |