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

Unified Diff: third_party/WebKit/Source/core/editing/InputMethodController.cpp

Issue 1600253003: [try] Trigger compositionstart/end on commitText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « content/test/data/android/ime/input_forms.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « content/test/data/android/ime/input_forms.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698