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

Unified Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 1308273003: Resend unconsumed scroll update from guest back to embedder (WebView Scroll Bubble). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove GestureEventObserver now that we don't forward fling GestureScrollUpdates. Created 5 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
Index: content/browser/browser_plugin/browser_plugin_guest.cc
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index 7942c4f1199725217a91e63a4171126c6572c23c..6da3e600a7b9a91dcc0586946ee8d9f83aaa4c05 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -472,6 +472,48 @@ bool BrowserPluginGuest::StopFinding(StopFindAction action) {
return delegate_->StopFinding(action);
}
+void BrowserPluginGuest::ResendEventToEmbedder(
+ const blink::WebInputEvent& event) {
+ if (!attached() || !owner_web_contents_)
+ return;
+
+ DCHECK(browser_plugin_instance_id_);
+ RenderViewHost* rvh = embedder_web_contents()->GetRenderViewHost();
kenrb 2015/09/14 15:48:51 I would prefer if you accessed the main RenderFram
wjmaclean 2015/09/14 20:47:21 Done.
+
+ if (event.type == blink::WebInputEvent::GestureScrollUpdate) {
+ blink::WebGestureEvent resent_gesture_event;
+ memcpy(&resent_gesture_event, &event, sizeof(blink::WebGestureEvent));
+ // Mark the resend source with the browser plugin's instance id, so the
+ // correct browser_plugin will know to ignore the event.
+ resent_gesture_event.resendSource = browser_plugin_instance_id_;
+ RenderWidgetHostImpl* host = RenderWidgetHostImpl::From(rvh);
+ bool needs_wrapping = !host->is_in_gesture_scroll();
+ if (needs_wrapping) {
+ blink::WebGestureEvent wrap_gesture_scroll_begin;
+ wrap_gesture_scroll_begin.type = blink::WebInputEvent::GestureScrollBegin;
+ wrap_gesture_scroll_begin.data.scrollBegin.deltaXHint = 0;
+ wrap_gesture_scroll_begin.data.scrollBegin.deltaYHint = 0;
+ wrap_gesture_scroll_begin.resendSource = browser_plugin_instance_id_;
+ host->ForwardGestureEvent(wrap_gesture_scroll_begin);
+ }
+ host->ForwardGestureEvent(resent_gesture_event);
+ if (needs_wrapping) {
+ blink::WebGestureEvent wrap_gesture_scroll_end;
+ wrap_gesture_scroll_end.type = blink::WebInputEvent::GestureScrollEnd;
+ wrap_gesture_scroll_end.resendSource = browser_plugin_instance_id_;
+ host->ForwardGestureEvent(wrap_gesture_scroll_end);
+ }
+ } else if (event.type == blink::WebInputEvent::MouseWheel) {
+ blink::WebMouseWheelEvent resent_wheel_event;
+ memcpy(&resent_wheel_event, &event, sizeof(blink::WebMouseWheelEvent));
+ resent_wheel_event.resendSource = browser_plugin_instance_id_;
+ RenderWidgetHostImpl::From(rvh)->ForwardWheelEvent(resent_wheel_event);
+ } else {
+ NOTIMPLEMENTED();
+ }
+
+}
+
WebContentsImpl* BrowserPluginGuest::GetWebContents() const {
return static_cast<WebContentsImpl*>(web_contents());
}

Powered by Google App Engine
This is Rietveld 408576698