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

Unified Diff: content/renderer/render_widget.cc

Issue 2650113004: [WIP] Add support for Android SuggestionSpans when editing text (Closed)
Patch Set: Remove logging statements, fix copyright years in new files Created 3 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
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index d9edfea44b72f0dc3fcb4a0e2dc05dec9d3df7b1..e64157cfe705eb2d885b6e3395783b570a7ca524 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -596,6 +596,11 @@ bool RenderWidget::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(InputMsg_ImeCommitText, OnImeCommitText)
IPC_MESSAGE_HANDLER(InputMsg_ImeFinishComposingText,
OnImeFinishComposingText)
+ IPC_MESSAGE_HANDLER(InputMsg_ApplySuggestionReplacement,
+ OnApplySuggestionReplacement)
esprehn 2017/01/31 22:41:34 Please use mojo.
rlanday 2017/01/31 23:30:09 Ok
+ IPC_MESSAGE_HANDLER(InputMsg_DeleteSuggestionHighlight,
+ OnDeleteSuggestionHighlight)
+ IPC_MESSAGE_HANDLER(InputMsg_SuggestionMenuClosed, OnSuggestionMenuClosed)
IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost)
IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent,
OnSetEditCommandsForNextKeyEvent)
@@ -1625,6 +1630,25 @@ void RenderWidget::OnImeFinishComposingText(bool keep_selection) {
UpdateCompositionInfo(false /* not an immediate request */);
}
+void RenderWidget::OnApplySuggestionReplacement(int document_marker_id,
+ int suggestion_index) {
+ if (auto* controller = GetInputMethodController()) {
+ controller->applySuggestionReplacement(document_marker_id,
+ suggestion_index);
+ }
+}
+
+void RenderWidget::OnDeleteSuggestionHighlight() {
+ if (auto* controller = GetInputMethodController()) {
+ controller->deleteSuggestionHighlight();
+ }
+}
+
+void RenderWidget::OnSuggestionMenuClosed() {
+ if (auto* controller = GetInputMethodController())
+ controller->suggestionMenuClosed();
+}
+
void RenderWidget::OnDeviceScaleFactorChanged() {
if (!compositor_)
return;
@@ -2102,6 +2126,27 @@ blink::WebScreenInfo RenderWidget::screenInfo() {
return web_screen_info;
}
+void RenderWidget::handlePotentialTextSuggestionTap() {
+ blink::WebInputMethodController* controller = GetInputMethodController();
+ if (!controller)
+ return;
+
+ WebVector<blink::WebTextSuggestionInfo> suggestion_infos =
+ controller->getTextSuggestionInfosUnderCaret();
+
+ if (suggestion_infos.size() == 0)
+ return;
+
+ // The composition is now on the suggestion range highlight
+ UpdateCompositionInfo(false /* not an immediate request */);
+
+ controller->prepareForTextSuggestionMenuToBeShown();
esprehn 2017/01/31 22:41:34 This should all be done with mojo inside blink.
rlanday 2017/01/31 23:30:09 Ok
rlanday 2017/02/17 01:46:20 Is there a way to get access to the RenderWidget f
+
+ Send(new InputHostMsg_ShowTextSuggestionMenu(
+ routing_id(), std::vector<blink::WebTextSuggestionInfo>(
+ suggestion_infos.begin(), suggestion_infos.end())));
+}
+
void RenderWidget::resetInputMethod() {
ImeEventGuard guard(this);
Send(new InputHostMsg_ImeCancelComposition(routing_id()));

Powered by Google App Engine
This is Rietveld 408576698