Created
March 9, 2012 20:14
-
-
Save AutomatedTester/2008427 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Index: test/shown_test.html | |
| =================================================================== | |
| --- test/shown_test.html (revision 16201) | |
| +++ test/shown_test.html (working copy) | |
| @@ -286,6 +286,10 @@ | |
| var noscript = findElement({id: 'noscript'}); | |
| assertFalse(isShown(noscript)); | |
| } | |
| + function testThatItemsHiddenWithOverflowHiddenAreFalse(){ | |
| + var target = findElement({id: 'target'}); | |
| + assertFalse(isShown(target)); | |
| + } | |
| </script> | |
| <style type="text/css"> | |
| @@ -395,5 +399,33 @@ | |
| <iframe id="iframe" src="testdata/iframe_page.html"></iframe> | |
| <span id="onlyWhitespace"> </span> | |
| +<style> | |
| + #box{ | |
| + border: 1px solid black; | |
| + } | |
| + #box ul{ | |
| + height: 250px; | |
| + overflow: hidden; | |
| + } | |
| + #box ul > li{ | |
| + height: 50px; | |
| + } | |
| + #box ul > li > a{ | |
| + height: 26px; | |
| + } | |
| +</style> | |
| +<div id="box"> | |
| + <ul id="list1"> | |
| + <li><a>Item 1</a></li> | |
| + <li><a>Item 2</a></li> | |
| + <li><a>Item 3</a></li> | |
| + <li><a>Item 4</a></li> | |
| + <li><a>Item 5</a></li> | |
| + <li><a>Item 6</a></li> | |
| + <li><a>Item 7</a></li> | |
| + <li id="target"><a>Item 8</a></li> | |
| + </ul> | |
| +</div> | |
| + | |
| </body> | |
| </html> | |
| Index: dom.js | |
| =================================================================== | |
| --- dom.js (revision 16201) | |
| +++ dom.js (working copy) | |
| @@ -708,7 +708,27 @@ | |
| if (!positiveSize(elem)) { | |
| return false; | |
| } | |
| + function isOverflowHiding(e){ | |
| + var parent = bot.dom.getParentElement(e); | |
| + if (bot.dom.getEffectiveStyle(parent, 'overflow') == 'hidden'){ | |
| + var sizeOfParent = bot.dom.getElementSize_(parent); | |
| + var locOfParent = goog.style.getClientPosition(parent); | |
| + var locOfElement = goog.style.getClientPosition(e); | |
| + if (locOfParent.x + sizeOfParent.width < locOfElement.x){ | |
| + return false; | |
| + } | |
| + if (locOfParent.y + sizeOfParent.height < locOfElement.y){ | |
| + return false; | |
| + } | |
| + return !parent || isOverflowHiding(parent); | |
| + } | |
| + return true; | |
| + } | |
| + if (!isOverflowHiding(elem)){ | |
| + return false; | |
| + } | |
| + | |
| return true; | |
| }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment