mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 851445. When saving a frame scroll position, if we're in the process of trying to scroll to a saved scroll position, save the desired position instead of the actual current position. r=mats
--HG-- extra : rebase_source : 4aa4110d32db5f26192c0e4b6fa3185d1ed2c073
This commit is contained in:
parent
0ec2e66722
commit
53c5c3d2c4
@ -147,6 +147,8 @@ MOCHITEST_FILES = \
|
||||
file_bug842853.html \
|
||||
test_bug849219.html \
|
||||
test_bug851485.html \
|
||||
test_bug851445.html \
|
||||
bug851445_helper.html \
|
||||
$(NULL)
|
||||
|
||||
# Tests for bugs 441782, 467672 and 570378 don't pass reliably on Windows, because of bug 469208
|
||||
|
11
layout/base/tests/bug851445_helper.html
Normal file
11
layout/base/tests/bug851445_helper.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body style="height:1000px">
|
||||
<script>
|
||||
var docElement = document.documentElement;
|
||||
docElement.style.display = 'none';
|
||||
docElement.offsetTop;
|
||||
docElement.style.display = '';
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
34
layout/base/tests/test_bug851445.html
Normal file
34
layout/base/tests/test_bug851445.html
Normal file
@ -0,0 +1,34 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=851445
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 851445</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=851445">Mozilla Bug 851445</a>
|
||||
<p id="display"></p>
|
||||
<iframe id="f" style="width:400px; height:400px;"></iframe>
|
||||
<script>
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function handleLoad() {
|
||||
f.contentWindow.scrollTo(0,100);
|
||||
function handleLoad2() {
|
||||
// Verify that the scroll position was retained
|
||||
is(f.contentWindow.scrollY, 100);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
f.onload = handleLoad2;
|
||||
f.contentWindow.location.reload();
|
||||
}
|
||||
|
||||
f.src = "bug851445_helper.html?" + Math.random();
|
||||
f.onload = handleLoad;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -3896,7 +3896,16 @@ nsGfxScrollFrameInner::SaveState()
|
||||
}
|
||||
|
||||
nsPresState* state = new nsPresState();
|
||||
state->SetScrollState(GetLogicalScrollPosition());
|
||||
// Save mRestorePos instead of our actual current scroll position, if it's
|
||||
// valid and we haven't moved since the last update of mLastPos (same check
|
||||
// that ScrollToRestoredPosition uses). This ensures if a reframe occurs
|
||||
// while we're in the process of loading content to scroll to a restored
|
||||
// position, we'll keep trying after the reframe.
|
||||
nsPoint pt = GetLogicalScrollPosition();
|
||||
if (mRestorePos.y != -1 && pt == mLastPos) {
|
||||
pt = mRestorePos;
|
||||
}
|
||||
state->SetScrollState(pt);
|
||||
return state;
|
||||
}
|
||||
|
||||
@ -3904,8 +3913,6 @@ void
|
||||
nsGfxScrollFrameInner::RestoreState(nsPresState* aState)
|
||||
{
|
||||
mRestorePos = aState->GetScrollState();
|
||||
mLastPos.x = -1;
|
||||
mLastPos.y = -1;
|
||||
mDidHistoryRestore = true;
|
||||
mLastPos = mScrolledFrame ? GetLogicalScrollPosition() : nsPoint(0,0);
|
||||
}
|
||||
|
@ -291,7 +291,14 @@ public:
|
||||
nsPoint mDestination;
|
||||
nsPoint mScrollPosAtLastPaint;
|
||||
|
||||
// A goal position to try to scroll to as content loads. As long as mLastPos
|
||||
// matches the current logical scroll position, we try to scroll to mRestorePos
|
||||
// after every reflow --- because after each time content is loaded/added to the
|
||||
// scrollable element, there will be a reflow.
|
||||
nsPoint mRestorePos;
|
||||
// The last logical position we scrolled to while trying to restore mRestorePos, or
|
||||
// 0,0 when this is a new frame. Set to -1,-1 once we've scrolled for any reason
|
||||
// other than trying to restore mRestorePos.
|
||||
nsPoint mLastPos;
|
||||
|
||||
nsExpirationState mActivityExpirationState;
|
||||
|
Loading…
Reference in New Issue
Block a user