diff options
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_scroll_on_position_fixed.html')
-rw-r--r-- | gfx/layers/apz/test/mochitest/helper_scroll_on_position_fixed.html | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_scroll_on_position_fixed.html b/gfx/layers/apz/test/mochitest/helper_scroll_on_position_fixed.html new file mode 100644 index 000000000..b9d187faf --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_scroll_on_position_fixed.html @@ -0,0 +1,62 @@ +<head> + <meta name="viewport" content="width=device-width; initial-scale=1.0"> + <title>Wheel-scrolling over position:fixed and position:sticky elements, in the top-level document as well as iframes</title> + <script type="application/javascript" src="apz_test_native_event_utils.js"></script> + <script type="application/javascript" src="apz_test_utils.js"></script> + <script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script> + <script type="application/javascript"> + +function* test(testDriver) { + var iframeWin = document.getElementById('iframe').contentWindow; + + // scroll over the middle of the iframe's position:sticky element, check + // that it scrolls the iframe + var scrollPos = iframeWin.scrollY; + yield moveMouseAndScrollWheelOver(iframeWin.document.body, 50, 150, testDriver); + ok(iframeWin.scrollY > scrollPos, "iframe scrolled after wheeling over the position:sticky element"); + + // same, but using the iframe's position:fixed element + scrollPos = iframeWin.scrollY; + yield moveMouseAndScrollWheelOver(iframeWin.document.body, 250, 150, testDriver); + ok(iframeWin.scrollY > scrollPos, "iframe scrolled after wheeling over the position:fixed element"); + + // same, but scrolling the scrollable frame *inside* the position:fixed item + var fpos = document.getElementById('fpos_scrollable'); + scrollPos = fpos.scrollTop; + yield moveMouseAndScrollWheelOver(fpos, 50, 150, testDriver); + ok(fpos.scrollTop > scrollPos, "scrollable item inside fixed-pos element scrolled"); + // wait for it to layerize fully and then try again + yield waitForAllPaints(function() { + flushApzRepaints(testDriver); + }); + scrollPos = fpos.scrollTop; + yield moveMouseAndScrollWheelOver(fpos, 50, 150, testDriver); + ok(fpos.scrollTop > scrollPos, "scrollable item inside fixed-pos element scrolled after layerization"); + + // same, but using the top-level window's position:sticky element + scrollPos = window.scrollY; + yield moveMouseAndScrollWheelOver(document.body, 50, 150, testDriver); + ok(window.scrollY > scrollPos, "top-level document scrolled after wheeling over the position:sticky element"); + + // same, but using the top-level window's position:fixed element + scrollPos = window.scrollY; + yield moveMouseAndScrollWheelOver(document.body, 250, 150, testDriver); + ok(window.scrollY > scrollPos, "top-level document scrolled after wheeling over the position:fixed element"); +} + +waitUntilApzStable() +.then(runContinuation(test)) +.then(subtestDone); + + </script> +</head> +<body style="height:5000px; margin:0"> + <div style="position:sticky; width: 100px; height: 300px; top: 0; background-color:red">sticky</div> + <div style="position:fixed; width: 100px; height: 300px; top: 0; left: 200px; background-color: green">fixed</div> + <iframe id='iframe' width="300" height="400" src="data:text/html,<body style='height:5000px; margin:0'><div style='position:sticky; width:100px; height:300px; top: 0; background-color:red'>sticky</div><div style='position:fixed; right:0; top: 0; width:100px; height:300px; background-color:green'>fixed</div>"></iframe> + + <div id="fpos_scrollable" style="position:fixed; width: 100px; height: 300px; top: 0; left: 400px; background-color: red; overflow:scroll"> + <div style="background-color: blue; height: 1000px; margin: 3px">scrollable content inside a fixed-pos item</div> + </div> +</body> +</head> |