Bug 575336 part 2. Make sure editor flushes layout before caret moves and scrolls that depend on layout information. r=roc,ehsan

This commit is contained in:
Boris Zbarsky 2010-08-05 14:39:39 -04:00
parent e8a9de31ab
commit ddf024831a

View File

@ -47,6 +47,7 @@
#include "nsIClipboard.h"
#include "nsEditorCommands.h"
#include "nsIDocument.h"
#define STATE_ENABLED "state_enabled"
@ -669,7 +670,6 @@ nsSelectionMoveCommands::IsCommandEnabled(const char * aCommandName,
return NS_OK;
}
NS_IMETHODIMP
nsSelectionMoveCommands::DoCommand(const char *aCommandName,
nsISupports *aCommandRefCon)
@ -677,6 +677,15 @@ nsSelectionMoveCommands::DoCommand(const char *aCommandName,
nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
NS_ENSURE_TRUE(editor, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMDocument> domDoc;
editor->GetDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
if (doc) {
// Most of the commands below (possibly all of them) need layout to
// be up to date.
doc->FlushPendingNotifications(Flush_Layout);
}
nsCOMPtr<nsISelectionController> selCont;
nsresult rv = editor->GetSelectionController(getter_AddRefs(selCont));
NS_ENSURE_SUCCESS(rv, rv);