Index: content/browser/renderer_host/render_widget_host_view_aura.cc |
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc |
index fd2a94cc979e71b8b871e920f7832448e75735c9..6a1d012a6e95094b6fa4b1d1406b24ad4b23f49e 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
@@ -45,6 +45,7 @@ |
#include "content/browser/renderer_host/web_input_event_aura.h" |
#include "content/common/gpu/client/gl_helper.h" |
#include "content/common/gpu/gpu_messages.h" |
+#include "content/common/site_isolation_policy.h" |
#include "content/common/view_messages.h" |
#include "content/public/browser/content_browser_client.h" |
#include "content/public/browser/overscroll_configuration.h" |
@@ -857,6 +858,19 @@ bool RenderWidgetHostViewAura::CanRendererHandleEvent( |
return true; |
} |
+bool RenderWidgetHostViewAura::ShouldRouteEvent(const ui::Event* event) const { |
+ // We should route an event in two cases: |
+ // 1) If cross-process frames are possible, then we route the event. |
Charlie Reis
2015/12/10 21:58:14
This doesn't seem to be what the code below is doi
wjmaclean
2015/12/10 22:44:14
Perhaps I've badly worded the comment. Prior to th
|
+ // 2) Even if (1) is not satisfied, we still route the event if we have |
+ // an input event router: at present this only happens for touch events, |
+ // and is required in order that pinch-zoom works properly for |
+ // WebViews. |
+ bool result = host_->delegate() && host_->delegate()->GetInputEventRouter(); |
Charlie Reis
2015/12/10 21:58:15
This looks like it will almost always be true (unl
wjmaclean
2015/12/10 22:44:14
Yes. But |result| can be set false if we are deali
|
+ if (event->IsMouseEvent()) |
+ result = result && SiteIsolationPolicy::AreCrossProcessFramesPossible(); |
Charlie Reis
2015/12/10 21:58:15
On a related note, we should confirm whether AreCr
wjmaclean
2015/12/10 22:44:14
OK. This code is based on the existing logic, so i
|
+ return result; |
+} |
+ |
void RenderWidgetHostViewAura::HandleParentBoundsChanged() { |
SnapToPhysicalPixelBoundary(); |
#if defined(OS_WIN) |
@@ -2127,7 +2141,7 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
blink::WebMouseWheelEvent mouse_wheel_event = |
MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); |
if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) { |
- if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { |
+ if (ShouldRouteEvent(event)) { |
host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( |
this, &mouse_wheel_event); |
} else { |
@@ -2146,7 +2160,7 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
blink::WebMouseEvent mouse_event = MakeWebMouseEvent(*event); |
ModifyEventMovementAndCoords(&mouse_event); |
- if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { |
+ if (ShouldRouteEvent(event)) { |
host_->delegate()->GetInputEventRouter()->RouteMouseEvent(this, |
&mouse_event); |
} else { |
@@ -2219,6 +2233,12 @@ void RenderWidgetHostViewAura::ProcessMouseWheelEvent( |
host_->ForwardWheelEvent(event); |
} |
+void RenderWidgetHostViewAura::ProcessTouchEvent( |
+ const blink::WebTouchEvent& event, |
+ const ui::LatencyInfo& latency) { |
+ host_->ForwardTouchEventWithLatencyInfo(event, latency); |
+} |
+ |
void RenderWidgetHostViewAura::TransformPointToLocalCoordSpace( |
const gfx::Point& point, |
cc::SurfaceId original_surface, |
@@ -2293,7 +2313,12 @@ void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { |
// Set unchanged touch point to StateStationary for touchmove and |
// touchcancel to make sure only send one ack per WebTouchEvent. |
MarkUnchangedTouchPointsAsStationary(&touch_event, event->touch_id()); |
- host_->ForwardTouchEventWithLatencyInfo(touch_event, *event->latency()); |
+ if (ShouldRouteEvent(event)) { |
+ host_->delegate()->GetInputEventRouter()->RouteTouchEvent( |
+ this, &touch_event, *event->latency()); |
+ } else { |
+ ProcessTouchEvent(touch_event, *event->latency()); |
+ } |
} |
void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { |