Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(772)

Unified Diff: Source/core/editing/Editor.cpp

Issue 21030005: Editor: Deffer event dispatch after selection change. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/editing/Editor.cpp
diff --git a/Source/core/editing/Editor.cpp b/Source/core/editing/Editor.cpp
index 9bbc1f14ce565e3967f4f96271cb57016a02d0d6..c64ae65c9789176bcfb8a636e5c0ce5299d00b1c 100644
--- a/Source/core/editing/Editor.cpp
+++ b/Source/core/editing/Editor.cpp
@@ -42,6 +42,7 @@
#include "core/dom/KeyboardEvent.h"
#include "core/dom/NodeList.h"
#include "core/dom/NodeTraversal.h"
+#include "core/dom/ScopedEventQueue.h"
#include "core/dom/Text.h"
#include "core/dom/TextEvent.h"
#include "core/dom/UserTypingGestureIndicator.h"
@@ -716,15 +717,16 @@ static void dispatchEditableContentChangedEvents(PassRefPtr<Element> startRoot,
void Editor::appliedEditing(PassRefPtr<CompositeEditCommand> cmd)
{
+ EventQueueScope scope;
m_frame->document()->updateLayout();
EditCommandComposition* composition = cmd->composition();
ASSERT(composition);
+ dispatchEditableContentChangedEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement());
VisibleSelection newSelection(cmd->endingSelection());
// Don't clear the typing style with this selection change. We do those things elsewhere if necessary.
changeSelectionAfterCommand(newSelection, 0);
- dispatchEditableContentChangedEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement());
if (!cmd->preservesTypingStyle())
m_frame->selection()->clearTypingStyle();
@@ -745,11 +747,13 @@ void Editor::appliedEditing(PassRefPtr<CompositeEditCommand> cmd)
void Editor::unappliedEditing(PassRefPtr<EditCommandComposition> cmd)
{
+ EventQueueScope scope;
m_frame->document()->updateLayout();
+ dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement());
+
VisibleSelection newSelection(cmd->startingSelection());
changeSelectionAfterCommand(newSelection, FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle);
- dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement());
m_lastEditCommand = 0;
if (client())
@@ -759,11 +763,13 @@ void Editor::unappliedEditing(PassRefPtr<EditCommandComposition> cmd)
void Editor::reappliedEditing(PassRefPtr<EditCommandComposition> cmd)
{
+ EventQueueScope scope;
m_frame->document()->updateLayout();
+ dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement());
+
VisibleSelection newSelection(cmd->endingSelection());
changeSelectionAfterCommand(newSelection, FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle);
- dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement());
m_lastEditCommand = 0;
if (client())

Powered by Google App Engine
This is Rietveld 408576698