Bug 633762. Only bail early if we have an async scroll pending so the ScrollTo call can update mDestination. r=roc a=roc

This commit is contained in:
Timothy Nikkel 2011-02-20 14:03:32 -06:00
Родитель d320742fb3
Коммит 084c19569c
4 изменённых файлов: 67 добавлений и 1 удалений

Просмотреть файл

@ -2442,7 +2442,8 @@ void nsGfxScrollFrameInner::CurPosAttributeChanged(nsIContent* aContent)
-scrolledRect.y) +
scrolledRect.y;
if (dest == GetScrollPosition()) {
// If we have an async scroll pending don't stomp on that by calling ScrollTo.
if (mAsyncScroll && dest == GetScrollPosition()) {
return;
}

Просмотреть файл

@ -125,6 +125,8 @@ _TEST_FILES = \
test_bug589621.html \
test_bug589623.html \
test_bug632379.xul \
test_bug633762.html \
bug633762_iframe.html \
$(srcdir)/../../reftests/backgrounds/blue-32x32.png \
$(srcdir)/../../reftests/backgrounds/fuchsia-32x32.png \
$(NULL)

Просмотреть файл

@ -0,0 +1,8 @@
<html>
<body>
<div style="background: red; height: 4000px;">hi</div>
<div id="b" style="background: blue; height: 10000px;"></div>
<div id="a" style="background: yellow; height: 100px;"></div>
<div style="background: green; height: 4000px;"></div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,55 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=633762
-->
<head>
<title>Test for Bug 633762</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p><a target="_blank" href="https://bugzilla.mozilla.org/show_bug?id=633762">Mozilla Bug 633762</a>
<iframe id="i" src="bug633762_iframe.html#a"></iframe>
<pre id="test">
<script>
var doc;
function runTests() {
var i = document.getElementById("i");
doc = i.contentDocument;
var win = i.contentWindow;
// set display none on b
doc.getElementById("b").style.display = "none";
// flush layout
doc.documentElement.offsetLeft;
// click in middle of iframe document to give it focus
synthesizeMouseAtCenter(i, {}, win);
win.focus();
// record scrolltop
scrollTopBefore = doc.body.scrollTop;
// send up arrow key event
sendKey("UP", doc.body);
setTimeout("finish();", 0);
}
function finish() {
// assert that scroll top is now less than before
ok(scrollTopBefore > doc.body.scrollTop, "pressing up arrow should scroll up");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(runTests);
</script>
</pre>
</body>
</html>