| <title>fullscreen-restore-scroll-position</title> |
| <script src="../media/video-test.js"></script> |
| <script src="../media/media-file.js"></script> |
| waitFor(window, 'load').then(async event => { |
| if (Element.prototype.webkitRequestFullScreen == undefined) { |
| logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); |
| video = document.getElementsByTagName('video')[0]; |
| video.src = findMediaFile('video', '../media/content/test'); |
| waitFor(video, 'canplaythrough', true); |
| originalScroll = document.body.clientHeight; |
| document.scrollingElement.scrollTop = originalScroll; |
| originalScroll = document.scrollingElement.scrollTop; |
| document.onwebkitfullscreenchange = async (event) => { |
| if (document.webkitIsFullScreen) { |
| document.webkitCancelFullScreen(); |
| await testExpectedEventually("(document.scrollingElement.scrollTop === originalScroll)", true); |
| runWithKeyDown(() => document.getElementById('parent').webkitRequestFullScreen()); |
| <p>This tests that page scroll is restored after fullscreen. Press any key to start the test.</p> |
| <video id="video" controls><video> |