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

Unified Diff: content/browser/frame_host/render_widget_host_view_guest.cc

Issue 2101663002: Send synthetic GestureTapDown to focus BrowserPlugin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
Index: content/browser/frame_host/render_widget_host_view_guest.cc
diff --git a/content/browser/frame_host/render_widget_host_view_guest.cc b/content/browser/frame_host/render_widget_host_view_guest.cc
index 2f7ff291f026d98146d677db08171c8e438639c0..1964987c6c41c1cdadd3ee598a60ffe3ceaf740a 100644
--- a/content/browser/frame_host/render_widget_host_view_guest.cc
+++ b/content/browser/frame_host/render_widget_host_view_guest.cc
@@ -175,6 +175,25 @@ void RenderWidgetHostViewGuest::ProcessTouchEvent(
guest_->GetOwnerRenderWidgetHostView()->GetRenderWidgetHost());
if (!embedder->GetView()->HasFocus())
embedder->GetView()->Focus();
+
+ // Since we now route GestureEvents directly to the guest renderer, we need
+ // a way to make sure that the BrowserPlugin in the embedder gets focused so
+ // that keyboard input (which still travels via BrowserPlugin) is routed to
+ // the plugin and thus onwards to the guest.
+ // TODO(wjmaclean): When we remove BrowserPlugin, delete this code.
+ // http://crbug.com/533069
+ if (!HasFocus()) {
+ auto offset = GetViewBounds().origin();
+ blink::WebGestureEvent gesture_tap_down;
+ gesture_tap_down.sourceDevice = blink::WebGestureDeviceTouchscreen;
+ gesture_tap_down.type = blink::WebGestureEvent::GestureTapDown;
+ gesture_tap_down.x = event.touches[0].position.x + offset.x();
+ gesture_tap_down.y = event.touches[0].position.y + offset.y();
+ gesture_tap_down.globalX = event.touches[0].screenPosition.x;
+ gesture_tap_down.globalY = event.touches[0].screenPosition.y;
+ GetOwnerRenderWidgetHostView()->ProcessGestureEvent(gesture_tap_down,
+ ui::LatencyInfo());
Charlie Reis 2016/06/27 21:05:06 Is there any need to send an equivalent "up" event
+ }
}
host_->ForwardTouchEventWithLatencyInfo(event, latency);
« no previous file with comments | « chrome/browser/apps/guest_view/web_view_browsertest.cc ('k') | content/renderer/browser_plugin/browser_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698