mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 08:13:35 +00:00
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:
parent
2c088ca165
commit
fd79cc535c
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user