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

Unified Diff: content/renderer/render_widget.cc

Issue 2323983003: DO NOT SUBMIT: Bundle IME-related messages into one for batch edit (Closed)
Patch Set: fixed nits and fixed blimp test 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') | content/renderer/render_widget_browsertest.cc » ('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 430c7c9b7acaf27a0893850fec98a5d40ce049e6..f0ed8fadeb604b3e8af640f8150d54f641195052 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -485,6 +485,15 @@ bool RenderWidget::OnMessageReceived(const IPC::Message& message) {
OnCursorVisibilityChange)
IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition)
IPC_MESSAGE_HANDLER(InputMsg_ImeConfirmComposition, OnImeConfirmComposition)
+ IPC_MESSAGE_HANDLER(InputMsg_ImeExtendSelectionAndDelete,
+ OnImeExtendSelectionAndDelete)
+ IPC_MESSAGE_HANDLER(InputMsg_ImeSetCompositionFromExistingText,
+ OnImeSetCompositionFromExistingText)
+ IPC_MESSAGE_HANDLER(InputMsg_ImeSetEditableSelectionOffsets,
+ OnImeSetEditableSelectionOffsets)
+ IPC_MESSAGE_HANDLER(InputMsg_ImeBatchEdit, OnImeBatchEdit)
+ IPC_MESSAGE_HANDLER(InputMsg_ImeRequestCompositionUpdate,
+ OnImeRequestCompositionUpdate)
IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost)
IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus)
IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted,
@@ -505,12 +514,10 @@ bool RenderWidget::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_SetSurfaceClientId, OnSetSurfaceClientId)
IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests,
OnWaitNextFrameForTests)
- IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate,
- OnRequestCompositionUpdate)
#if defined(OS_ANDROID)
IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck)
- IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate,
- OnRequestTextInputStateUpdate)
+ IPC_MESSAGE_HANDLER(InputMsg_ImeRequestTextInputStateUpdate,
+ OnImeRequestTextInputStateUpdate)
IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded)
#endif
IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto)
@@ -1426,6 +1433,36 @@ void RenderWidget::OnImeConfirmComposition(const base::string16& text,
UpdateCompositionInfo(false /* not an immediate request */);
}
+void RenderWidget::OnImeExtendSelectionAndDelete(int before, int after) {
+ if (!ShouldHandleImeEvent())
+ return;
+
+ ImeEventGuard guard(this);
+ webwidget_->extendSelectionAndDelete(before, after);
+}
+
+void RenderWidget::OnImeSetEditableSelectionOffsets(int start, int end) {
+ if (!ShouldHandleImeEvent())
+ return;
+ ImeEventGuard guard(this);
+ webwidget_->setEditableSelectionOffsets(start, end);
+}
+
+void RenderWidget::OnImeSetCompositionFromExistingText(
+ int start, int end,
+ const std::vector<blink::WebCompositionUnderline>& underlines) {
+ if (!ShouldHandleImeEvent())
+ return;
+ ImeEventGuard guard(this);
+ webwidget_->setCompositionFromExistingText(start, end, underlines);
+}
+
+void RenderWidget::OnImeBatchEdit(const std::vector<IPC::Message>& messages) {
+ ImeEventGuard guard(this);
+ for (auto message : messages)
+ OnMessageReceived(message);
+}
+
void RenderWidget::OnDeviceScaleFactorChanged() {
if (!compositor_)
return;
@@ -1579,14 +1616,13 @@ void RenderWidget::OnImeEventAck() {
text_input_info_history_.pop_front();
}
-void RenderWidget::OnRequestTextInputStateUpdate() {
- DCHECK(!ime_event_guard_);
+void RenderWidget::OnImeRequestTextInputStateUpdate() {
UpdateSelectionBounds();
UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME);
}
#endif
-void RenderWidget::OnRequestCompositionUpdate(bool immediate_request,
+void RenderWidget::OnImeRequestCompositionUpdate(bool immediate_request,
bool monitor_request) {
monitor_composition_info_ = monitor_request;
if (!immediate_request)
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/renderer/render_widget_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698