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

Unified Diff: content/renderer/render_widget.cc

Issue 1999423002: tyrbot test for commitText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SetHasCompositionTextToTrue Created 4 years, 3 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/renderer/render_widget.h ('k') | third_party/WebKit/Source/core/editing/InputMethodController.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 74d2f578ca91ef885bc1aac8ba7728aed02ee742..907bc9ee7f9541967b1e4acfe7309165322e5d91 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -486,7 +486,9 @@ bool RenderWidget::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(InputMsg_CursorVisibilityChange,
OnCursorVisibilityChange)
IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition)
- IPC_MESSAGE_HANDLER(InputMsg_ImeConfirmComposition, OnImeConfirmComposition)
+ IPC_MESSAGE_HANDLER(InputMsg_ImeCommitText, OnImeCommitText)
+ IPC_MESSAGE_HANDLER(InputMsg_ImeFinishComposingText,
+ OnImeFinishComposingText)
IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost)
IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus)
IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted,
@@ -1399,13 +1401,13 @@ void RenderWidget::OnImeSetComposition(
UpdateCompositionInfo(false /* not an immediate request */);
}
-void RenderWidget::OnImeConfirmComposition(const base::string16& text,
- const gfx::Range& replacement_range,
- bool keep_selection) {
+void RenderWidget::OnImeCommitText(const base::string16& text,
+ const gfx::Range& replacement_range,
+ int relative_cursor_pos) {
#if defined(ENABLE_PLUGINS)
if (focused_pepper_plugin_) {
- focused_pepper_plugin_->render_frame()->OnImeConfirmComposition(
- text, replacement_range, keep_selection);
+ focused_pepper_plugin_->render_frame()->OnImeCommitText(
+ text, replacement_range, relative_cursor_pos);
return;
}
#endif
@@ -1418,12 +1420,27 @@ void RenderWidget::OnImeConfirmComposition(const base::string16& text,
return;
ImeEventGuard guard(this);
input_handler_->set_handling_input_event(true);
- if (text.length())
- webwidget_->confirmComposition(text);
- else if (keep_selection)
- webwidget_->confirmComposition(WebWidget::KeepSelection);
- else
- webwidget_->confirmComposition(WebWidget::DoNotKeepSelection);
+ webwidget_->commitText(text, relative_cursor_pos);
+ input_handler_->set_handling_input_event(false);
+ UpdateCompositionInfo(false /* not an immediate request */);
+}
+
+void RenderWidget::OnImeFinishComposingText(bool keep_selection) {
+#if defined(ENABLE_PLUGINS)
+ if (focused_pepper_plugin_) {
+ focused_pepper_plugin_->render_frame()->OnImeFinishComposingText(
+ keep_selection);
+ return;
+ }
+#endif
+
+ if (!ShouldHandleImeEvent())
+ return;
+ ImeEventGuard guard(this);
+ input_handler_->set_handling_input_event(true);
+ webwidget_->finishComposingText(keep_selection
+ ? WebWidget::KeepSelection
+ : WebWidget::DoNotKeepSelection);
input_handler_->set_handling_input_event(false);
UpdateCompositionInfo(false /* not an immediate request */);
}
@@ -1922,7 +1939,7 @@ void RenderWidget::resetInputMethod() {
if (text_input_info_.type != blink::WebTextInputTypeNone) {
// If a composition text exists, then we need to let the browser process
// to cancel the input method's ongoing composition session.
- if (webwidget_->confirmComposition())
+ if (webwidget_->finishComposingText(WebWidget::DoNotKeepSelection))
Send(new InputHostMsg_ImeCancelComposition(routing_id()));
}
« no previous file with comments | « content/renderer/render_widget.h ('k') | third_party/WebKit/Source/core/editing/InputMethodController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698