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

Unified Diff: content/browser/frame_host/render_widget_host_view_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: Don't require GestureScrollBegin for touch-pad GestureFlingStart. 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/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 638a2327deb26072192ec44a55c992ee5fb2fa02..b44f219e7d5d94b96148cca32a912ff9119af2b9 100644
--- a/content/browser/frame_host/render_widget_host_view_guest.cc
+++ b/content/browser/frame_host/render_widget_host_view_guest.cc
@@ -629,6 +629,23 @@ RenderWidgetHostViewGuest::GetOwnerRenderWidgetHostView() const {
guest_->GetOwnerRenderWidgetHostView());
}
+void RenderWidgetHostViewGuest::WheelEventAck(
+ const blink::WebMouseWheelEvent& event,
+ InputEventAckState ack_result) {
+ if (ack_result == INPUT_EVENT_ACK_STATE_NOT_CONSUMED)
+ guest_->ResendEventToEmbedder(event);
+}
+
+void RenderWidgetHostViewGuest::GestureEventAck(
+ const blink::WebGestureEvent& event,
+ InputEventAckState ack_result) {
+ bool not_consumed = INPUT_EVENT_ACK_STATE_NOT_CONSUMED == ack_result;
+ // GestureScrollBegin/End are always consumed by the guest, so we only
+ // forward GestureScrollUpdate.
+ if (event.type == blink::WebInputEvent::GestureScrollUpdate && not_consumed)
+ guest_->ResendEventToEmbedder(event);
+}
+
void RenderWidgetHostViewGuest::OnHandleInputEvent(
RenderWidgetHostImpl* embedder,
int browser_plugin_instance_id,
@@ -683,8 +700,22 @@ void RenderWidgetHostViewGuest::OnHandleInputEvent(
}
if (blink::WebInputEvent::isGestureEventType(event->type)) {
- host_->ForwardGestureEvent(
- *static_cast<const blink::WebGestureEvent*>(event));
+ const blink::WebGestureEvent& gesture_event =
+ *static_cast<const blink::WebGestureEvent*>(event);
+
+ // We don't forward inertial GestureScrollUpdates to the guest anymore
+ // since it now receives GestureFlingStart and will have its own fling
+ // curve generating GestureScrollUpdate events for it.
+ // TODO(wjmaclean): Should we try to avoid creating a fling curve in the
+ // embedder renderer in this case? BrowserPlugin can return 'true' for
+ // handleInputEvent() on a GestureFlingStart, and we could use this as
+ // a signal to let the guest handle the fling, though we'd need to be
+ // sure other plugins would behave appropriately (i.e. return 'false').
+ if (gesture_event.type == blink::WebInputEvent::GestureScrollUpdate &&
+ gesture_event.data.scrollUpdate.inertial) {
+ return;
+ }
+ host_->ForwardGestureEvent(gesture_event);
return;
}
}
« no previous file with comments | « content/browser/frame_host/render_widget_host_view_guest.h ('k') | content/browser/renderer_host/input/gesture_event_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698