Bug 1644567 - Add another case to the test for scroll restoration during frame reconstruction. r=botond

This adds another case to this test, which is specifically intended to bypass
any short-circuit resulting from the clamped scroll offset being the same as
the scrollframe's existing scroll offset. The pre-existing case in the tests
shortens the scrollframe to be non-scrollable, so the clamped mRestorePos for
the scrollframe is 0, which is the same as the default scroll position of the
reconstructed scrollframe. The new case ensures the clamped mRestorePos is
greater than zero, to verify that scroll restoration works as intended in that
scenario as well.

Differential Revision: https://phabricator.services.mozilla.com/D81739
This commit is contained in:
Kartikaya Gupta 2020-07-03 16:09:58 +00:00
parent 668686ae05
commit 4a1b02c5c5

View File

@ -41,7 +41,21 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1268195
SimpleTest.is(document.body.scrollTop > 0, true, "Scrolled body");
// Do a frame reconstruction on the body while also shortening the
// height.
// 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';