diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /layout/base/tests/test_frame_reconstruction_scroll_restore.html | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | layout/base/tests/test_frame_reconstruction_scroll_restore.html | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/layout/base/tests/test_frame_reconstruction_scroll_restore.html b/layout/base/tests/test_frame_reconstruction_scroll_restore.html new file mode 100644 index 0000000000..a5115bb694 --- /dev/null +++ b/layout/base/tests/test_frame_reconstruction_scroll_restore.html @@ -0,0 +1,82 @@ +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=1268195 +--> +<head> + <meta charset="utf-8"> + <title>Test for Bug 1268195</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> + <style> + html, body { + margin: 0; + padding: 0; + } + + .noscroll { + overflow: hidden; + height: 100%; + } + + /* Toggling this on and off triggers a frame reconstruction on the <body> */ + html.reconstruct-body::before { + top: 0; + content: ''; + display: block; + height: 2px; + position: absolute; + width: 100%; + z-index: 99; + } + </style> + <script type="application/javascript"> + SimpleTest.waitForExplicitFinish(); + + function run() { + // Make sure we have the right scroll element + SimpleTest.is(document.body.scrollTopMax > 0, true, "Body is the scrolling element"); + + // Scroll to the bottom + document.body.scrollTop = document.body.scrollTopMax; + SimpleTest.is(document.body.scrollTop > 0, true, "Scrolled body"); + + // Do a frame reconstruction on the body while also shortening the + // height, but still keep it long enough to be scrollable. + document.body.classList.toggle('noscroll'); + document.documentElement.classList.toggle('reconstruct-body'); + document.getElementById('spacer').style.height = '1000px'; + var reducedMax = document.body.scrollTopMax; + SimpleTest.is(document.body.scrollTop, reducedMax, `Scroll forced to new bottom ${reducedMax}`); + + // Do another frame reconstruction while lengthening the height again. + document.body.classList.toggle('noscroll'); + document.documentElement.classList.toggle('reconstruct-body'); + document.getElementById('spacer').style.height = '5000px'; + SimpleTest.is(document.body.scrollTop, reducedMax, "Scroll remained at reduced height"); + + // Do a frame reconstruction on the body while also shortening the + // height, this time down to a non-scrollable height. + document.body.classList.toggle('noscroll'); + document.documentElement.classList.toggle('reconstruct-body'); + document.getElementById('spacer').style.height = '1px'; + SimpleTest.is(document.body.scrollTop, 0, "Scroll forced to top"); + + // Do another frame reconstruction while lengthening the height again. + document.body.classList.toggle('noscroll'); + document.documentElement.classList.toggle('reconstruct-body'); + document.getElementById('spacer').style.height = '5000px'; + SimpleTest.is(document.body.scrollTop, 0, "Scroll remained at top"); + + SimpleTest.finish(); + } + </script> +</head> +<body onload="setTimeout(run, 0)"> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1268195">Mozilla Bug 1268195</a><br/> +The scroll position should end the top of the page. This is the top, yay! +<div id="spacer" style="height: 5000px"></div> +The scroll position should end the top of the page. This is the bottom! +<pre id="test"> +</pre> +</body> +</html> |