benjamin@webkit.org | 1f7ed75 | 2014-08-28 20:01:18 +0000 | [diff] [blame] | 1 | <html> |
| 2 | <head> |
| 3 | <style> |
| 4 | body { |
| 5 | height: 10000px; |
| 6 | } |
| 7 | #top-bar { |
| 8 | position: fixed; |
| 9 | width: 100%; |
| 10 | height: 120px; |
| 11 | background-color: green; |
| 12 | top: 0; |
| 13 | left: 0; |
| 14 | } |
| 15 | /* This fixed element does not cover the entire width and should be ignored. */ |
| 16 | #ignored-left { |
| 17 | position: fixed; |
| 18 | width: 20px; |
| 19 | height: 5000px; |
| 20 | background-color: red; |
| 21 | left: 0; |
| 22 | top: 0; |
| 23 | } |
| 24 | /* This fixed element does not cover an edge and should be ignored. */ |
| 25 | #ignored-center { |
| 26 | position: fixed; |
| 27 | width: 100%; |
| 28 | height: 150px; |
| 29 | background-color: red; |
| 30 | left: 0; |
| 31 | top: 50%; |
| 32 | } |
| 33 | </style> |
| 34 | <script src="../resources/js-test-pre.js"></script> |
| 35 | </head> |
| 36 | <body> |
| 37 | <div id="top-bar"></div> |
| 38 | <div id="ignored-left"></div> |
| 39 | <div id="ignored-center"></div> |
| 40 | <script> |
| 41 | description("Test scrolling with page granularity by using the space bar excludes the height of fixed element covering the full page width."); |
| 42 | |
| 43 | jsTestIsAsync = true; |
| 44 | |
| 45 | var failTimeoutId; |
| 46 | function test() { |
| 47 | if (window.eventSender) { |
| 48 | // Force the first layout to avoid the suppressed scrollbar cases. |
| 49 | scratch = document.documentElement.offsetWidth; |
| 50 | |
| 51 | // Avoid special cases for being "onload". |
| 52 | setTimeout(function() { |
| 53 | eventSender.keyDown(' '); |
| 54 | } , 0); |
| 55 | |
| 56 | failTimeoutId = setTimeout(function() { |
| 57 | testFailed("The scrollview failed to scroll in response to the event."); |
| 58 | debug("window.scrollY = " + window.scrollY + " excepted value around " + (window.innerHeight - 120)); |
| 59 | finishJSTest(); |
| 60 | }, 1000); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | window.addEventListener("scroll", function() { |
| 65 | if (window.scrollY == window.innerHeight - 120) { |
| 66 | testPassed("Scrolled to " + window.scrollY); |
| 67 | clearTimeout(failTimeoutId); |
| 68 | finishJSTest(); |
| 69 | } |
| 70 | }) |
| 71 | window.addEventListener("load", test); |
| 72 | </script> |
| 73 | <script src="../resources/js-test-post.js"></script> |
| 74 | </body> |
| 75 | </html> |