mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1538762 - Ensure the Android session store respects the layout scroll range. r=kats
Differential Revision: https://phabricator.services.mozilla.com/D25144 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
72f3e593fd
commit
cba0362f99
@ -352,9 +352,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1498892
|
||||
checkScroll(browser, testData);
|
||||
|
||||
// Check that the layout scroll range is still respected.
|
||||
// TODO: This should start passing after bug 1516056 is fixed.
|
||||
todo_is(browser.contentWindow.scrollX, 0, "Layout scroll range should be respected");
|
||||
todo_is(browser.contentWindow.scrollY, 0, "Layout scroll range should be respected");
|
||||
is(browser.contentWindow.scrollX, 0, "Layout scroll range should be respected");
|
||||
is(browser.contentWindow.scrollY, 0, "Layout scroll range should be respected");
|
||||
|
||||
// Now go back in history and check that the scroll position
|
||||
// is restored there as well.
|
||||
|
@ -287,7 +287,23 @@ void SessionStoreUtils::RestoreScrollPosition(const GlobalObject& aGlobal,
|
||||
int pos_X = atoi(token.get());
|
||||
token = tokenizer.nextToken();
|
||||
int pos_Y = atoi(token.get());
|
||||
aWindow.ScrollTo(pos_X, pos_Y);
|
||||
|
||||
// Self-clamp the layout scroll position to the layout scroll range.
|
||||
// This step will be unnecessary after bug 1516056, when window.scrollTo()
|
||||
// will start performing this clamping itself.
|
||||
CSSCoord layoutPosX = pos_X;
|
||||
CSSCoord layoutPosY = pos_Y;
|
||||
ErrorResult rv;
|
||||
CSSCoord layoutPosMaxX = aWindow.GetScrollMaxX(rv);
|
||||
CSSCoord layoutPosMaxY = aWindow.GetScrollMaxY(rv);
|
||||
if (layoutPosX > layoutPosMaxX) {
|
||||
layoutPosX = layoutPosMaxX;
|
||||
}
|
||||
if (layoutPosY > layoutPosMaxY) {
|
||||
layoutPosY = layoutPosMaxY;
|
||||
}
|
||||
|
||||
aWindow.ScrollTo(layoutPosX, layoutPosY);
|
||||
|
||||
if (nsCOMPtr<Document> doc = aWindow.GetExtantDoc()) {
|
||||
if (nsPresContext* presContext = doc->GetPresContext()) {
|
||||
|
Loading…
Reference in New Issue
Block a user