Bug 586662 - Part 1: back out bug 393723 to fix some assertions, and add a test case for the fix in that bug; r=roc a=blocking-betaN+

This commit is contained in:
Ehsan Akhgari 2010-09-21 18:49:25 -04:00
parent 0a727bd180
commit c3cff9b1cb
4 changed files with 62 additions and 6 deletions

View File

@ -2280,7 +2280,6 @@ NS_IMETHODIMP nsEditor::ScrollSelectionIntoView(PRBool aScrollToAnchor)
// If the editor is relying on asynchronous reflows, we have
// to use asynchronous requests to scroll, so that the scrolling happens
// after reflow requests are processed.
// XXXbz why not just always do async scroll?
syncScroll = !(flags & nsIPlaintextEditor::eEditorUseAsyncUpdatesMask);
}
@ -4217,11 +4216,6 @@ nsresult nsEditor::EndUpdateViewBatch()
// the reflows we caused will get processed before the invalidates.
if (flags & nsIPlaintextEditor::eEditorUseAsyncUpdatesMask) {
updateFlag = NS_VMREFRESH_DEFERRED;
} else if (presShell) {
// Flush out layout. Need to do this because if we have no invalidates
// to flush the viewmanager code won't flush our reflow here, and we
// have selection code that does sync caret scrolling in this case.
presShell->FlushPendingNotifications(Flush_Layout);
}
mBatch.EndUpdateViewBatch(updateFlag);
}

View File

@ -49,6 +49,8 @@ _TEST_FILES = \
test_selection_move_commands.xul \
test_bug514156.html \
test_bug567213.html \
file_bug586662.html \
test_bug586662.html \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<body>
<div style="height: 20000px;"></div>
<textarea id="editor"></textarea>
</body>
</html>

View File

@ -0,0 +1,53 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=586662
-->
<head>
<title>Test for Bug 586662</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=586662">Mozilla Bug 586662</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
var win = window.open("file_bug586662.html", "_blank",
"width=600,height=600,scrollbars=yes");
SimpleTest.waitForFocus(function() {
// Make sure that focusing the textarea will cause the page to scroll
var ed = win.document.getElementById("editor");
ed.focus();
setTimeout(function() {
isnot(win.scrollY, 0, "Page is scrolled down");
// Scroll back up
win.scrollTo(0, 0);
setTimeout(function() {
is(win.scrollY, 0, "Page is scrolled back up");
// Make sure that typing something into the textarea will cause the
// page to scroll down
synthesizeKey("a", {}, win);
setTimeout(function() {
isnot(win.scrollY, 0, "Page is scrolled down again");
win.close();
SimpleTest.finish();
}, 0);
}, 0);
}, 0);
}, win);
</script>
</pre>
</body>
</html>