mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1177247 - Prevent HandlePossibleViewportChange from clobbering a restored scroll position from forward/back navigation. r=botond
When the mochitest docshell/test/test_bug590573.html is run with APZ enabled, it fails because the HandlePossibleViewportChange code clobbers the scroll position after it has been restored by the session history code. Instead of using the default 0,0 as the initial scroll position we now pick up the pre-existing scroll position and use that.
This commit is contained in:
parent
06d449dbbe
commit
e8768b5c0a
@ -248,7 +248,16 @@ TabChildBase::InitializeRootMetrics()
|
|||||||
// This is the root layer, so the cumulative resolution is the same
|
// This is the root layer, so the cumulative resolution is the same
|
||||||
// as the resolution.
|
// as the resolution.
|
||||||
mLastRootMetrics.SetPresShellResolution(mLastRootMetrics.GetCumulativeResolution().ToScaleFactor().scale);
|
mLastRootMetrics.SetPresShellResolution(mLastRootMetrics.GetCumulativeResolution().ToScaleFactor().scale);
|
||||||
mLastRootMetrics.SetScrollOffset(CSSPoint(0, 0));
|
|
||||||
|
nsCOMPtr<nsIPresShell> shell = GetPresShell();
|
||||||
|
if (shell && shell->GetRootScrollFrameAsScrollable()) {
|
||||||
|
// The session history code might restore a scroll position when navigating
|
||||||
|
// back or forward, and we don't want to clobber that.
|
||||||
|
nsPoint pos = shell->GetRootScrollFrameAsScrollable()->GetScrollPosition();
|
||||||
|
mLastRootMetrics.SetScrollOffset(CSSPoint::FromAppUnits(pos));
|
||||||
|
} else {
|
||||||
|
mLastRootMetrics.SetScrollOffset(CSSPoint(0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
TABC_LOG("After InitializeRootMetrics, mLastRootMetrics is %s\n",
|
TABC_LOG("After InitializeRootMetrics, mLastRootMetrics is %s\n",
|
||||||
Stringify(mLastRootMetrics).c_str());
|
Stringify(mLastRootMetrics).c_str());
|
||||||
|
Loading…
Reference in New Issue
Block a user