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

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 2931443003: Add support for Android spellcheck menu in Chrome/WebViews (Closed)
Patch Set: Simplify Mojo binding based on rockot@'s advice Created 3 years, 5 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/browser/renderer_host/render_widget_host_view_android.h ('k') | content/public/android/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_android.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index 591ca19da78cb46fa298fae8cf2f86548a71dcfc..c32a1d04f024eb98cade8a32fd13f81b67fb9521 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -43,6 +43,7 @@
#include "content/browser/android/overscroll_controller_android.h"
#include "content/browser/android/selection_popup_controller.h"
#include "content/browser/android/synchronous_compositor_host.h"
+#include "content/browser/android/text_suggestion_host_android.h"
#include "content/browser/compositor/surface_utils.h"
#include "content/browser/devtools/render_frame_devtools_agent_host.h"
#include "content/browser/gpu/browser_gpu_channel_host_factory.h"
@@ -455,6 +456,7 @@ RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid(
content_view_core_(nullptr),
ime_adapter_android_(nullptr),
selection_popup_controller_(nullptr),
+ text_suggestion_host_(nullptr),
background_color_(SK_ColorWHITE),
cached_background_color_(SK_ColorWHITE),
view_(this),
@@ -965,6 +967,11 @@ bool RenderWidgetHostViewAndroid::OnTouchEvent(
ComputeEventLatencyOSTouchHistograms(event);
+ // Receiving any other touch event before the double-tap timeout expires
+ // cancels opening the spellcheck menu.
+ if (text_suggestion_host_)
+ text_suggestion_host_->StopSpellCheckMenuTimer();
+
// If a browser-based widget consumes the touch event, it's critical that
// touch event interception be disabled. This avoids issues with
// double-handling for embedder-detected gestures like side swipe.
@@ -1826,6 +1833,11 @@ void RenderWidgetHostViewAndroid::SendKeyEvent(
if (!target_host)
return;
+ // Receiving a key event before the double-tap timeout expires cancels opening
+ // the spellcheck menu. If the suggestion menu is open, we close the menu.
+ if (text_suggestion_host_)
+ text_suggestion_host_->OnKeyEvent();
+
ui::LatencyInfo latency_info;
if (event.GetType() == blink::WebInputEvent::kRawKeyDown ||
event.GetType() == blink::WebInputEvent::kChar) {
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | content/public/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698