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

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

Issue 311053008: CANCEL: Make "compositionstart" event cancelable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2014-06-18T10:53:48 Created 6 years, 6 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 | « Source/core/core.gypi ('k') | Source/core/editing/InputMethodControllerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/InputMethodController.cpp
diff --git a/Source/core/editing/InputMethodController.cpp b/Source/core/editing/InputMethodController.cpp
index 47a27e6abba2bbc30475fe03c0fe856aacf7e8ad..eeeb84f330861ff3afd72097a24da9871ca3c9bf 100644
--- a/Source/core/editing/InputMethodController.cpp
+++ b/Source/core/editing/InputMethodController.cpp
@@ -259,7 +259,12 @@ void InputMethodController::setComposition(const String& text, const Vector<Comp
// We should send a compositionstart event only when the given text is not empty because this
// function doesn't create a composition node when the text is empty.
if (!text.isEmpty()) {
- target->dispatchEvent(CompositionEvent::create(EventTypeNames::compositionstart, m_frame.domWindow(), m_frame.selectedText(), underlines));
+ RefPtrWillBeRawPtr<CompositionEvent> compositionStartEvent = CompositionEvent::create(EventTypeNames::compositionstart, m_frame.domWindow(), m_frame.selectedText(), underlines);
+ if (!target->dispatchEvent(compositionStartEvent)) {
+ RefPtrWillBeRawPtr<CompositionEvent> compositionEndEvent = CompositionEvent::create(EventTypeNames::compositionend, m_frame.domWindow(), emptyString(), Vector<CompositionUnderline>());
+ target->dispatchEvent(compositionEndEvent, IGNORE_EXCEPTION);
+ return;
+ }
event = CompositionEvent::create(EventTypeNames::compositionupdate, m_frame.domWindow(), text, underlines);
}
} else {
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/editing/InputMethodControllerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698