Index: third_party/WebKit/Source/core/editing/InputMethodController.cpp |
diff --git a/third_party/WebKit/Source/core/editing/InputMethodController.cpp b/third_party/WebKit/Source/core/editing/InputMethodController.cpp |
index d1f22bb0aecdf46ab38fd30d4ba95daf5338738e..a30c17d7b30ade6f077001042730f0eddfdf4a2b 100644 |
--- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp |
+++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp |
@@ -122,7 +122,7 @@ bool InputMethodController::confirmComposition() |
return confirmComposition(composingText()); |
} |
-static void dispatchCompositionEndEvent(LocalFrame& frame, const String& text) |
+static void dispatchCompositionEvent(LocalFrame& frame, const AtomicString& type, const String& text) |
{ |
// We should send this event before sending a TextEvent as written in |
// Section 6.2.2 and 6.2.3 of the DOM Event specification. |
@@ -131,7 +131,7 @@ static void dispatchCompositionEndEvent(LocalFrame& frame, const String& text) |
return; |
RefPtrWillBeRawPtr<CompositionEvent> event = |
- CompositionEvent::create(EventTypeNames::compositionend, frame.domWindow(), text); |
+ CompositionEvent::create(type, frame.domWindow(), text); |
target->dispatchEvent(event); |
} |
@@ -156,7 +156,7 @@ bool InputMethodController::confirmComposition(const String& text) |
if (frame().selection().isNone()) |
return false; |
- dispatchCompositionEndEvent(frame(), text); |
+ dispatchCompositionEvent(frame(), EventTypeNames::compositionend, text); |
if (!frame().document()) |
return false; |
@@ -179,6 +179,8 @@ bool InputMethodController::confirmCompositionOrInsertText(const String& text, C |
if (!hasComposition()) { |
if (!text.length()) |
return false; |
+ dispatchCompositionEvent(frame(), EventTypeNames::compositionstart, frame().selectedText()); |
+ dispatchCompositionEvent(frame(), EventTypeNames::compositionend, text); |
editor().insertText(text, 0); |
return true; |
} |
@@ -205,7 +207,7 @@ void InputMethodController::cancelComposition() |
if (frame().selection().isNone()) |
return; |
- dispatchCompositionEndEvent(frame(), emptyString()); |
+ dispatchCompositionEvent(frame(), EventTypeNames::compositionend, emptyString()); |
clear(); |
insertTextForConfirmedComposition(emptyString()); |