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 bbb79c967405304c7bb46b1823dfea04d09bf7f0..4a41489f6f4ec6bf6d24c7c5051065d6dc82485a 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
@@ -44,6 +44,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" |
@@ -450,6 +451,7 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host, |
: host_(RenderWidgetHostImpl::From(host)), |
window_(new aura::Window(this)), |
delegated_frame_host_(new DelegatedFrameHost(this)), |
+ has_started_rendering_(false), |
in_shutdown_(false), |
in_bounds_changed_(false), |
is_fullscreen_(false), |
@@ -487,14 +489,6 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host, |
window_->set_layer_owner_delegate(delegated_frame_host_.get()); |
gfx::Screen::GetScreenFor(window_)->AddObserver(this); |
- // Let the page-level input event router know about our surface ID |
- // namespace for surface-based hit testing. |
- if (UseSurfacesEnabled() && host_->delegate() && |
- host_->delegate()->GetInputEventRouter()) { |
- host_->delegate()->GetInputEventRouter()->AddSurfaceIdNamespaceOwner( |
- GetSurfaceIdNamespace(), this); |
- } |
- |
bool overscroll_enabled = base::CommandLine::ForCurrentProcess()-> |
GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; |
SetOverscrollControllerEnabled(overscroll_enabled); |
@@ -843,6 +837,13 @@ bool RenderWidgetHostViewAura::CanRendererHandleEvent( |
return true; |
} |
+bool RenderWidgetHostViewAura::ShouldRouteEvent(const ui::Event* event) const { |
+ bool result = host_->delegate() && host_->delegate()->GetInputEventRouter(); |
+ if (event->IsMouseEvent()) |
+ result = result && SiteIsolationPolicy::AreCrossProcessFramesPossible(); |
+ return result; |
+} |
+ |
void RenderWidgetHostViewAura::HandleParentBoundsChanged() { |
SnapToPhysicalPixelBoundary(); |
#if defined(OS_WIN) |
@@ -1176,6 +1177,18 @@ void RenderWidgetHostViewAura::OnSwapCompositorFrame( |
last_scroll_offset_ = frame->metadata.root_scroll_offset; |
if (!frame->delegated_frame_data) |
return; |
+ |
+ if (!has_started_rendering_) { |
+ // Let the page-level input event router know about our surface ID |
+ // namespace for surface-based hit testing. |
+ if (UseSurfacesEnabled() && host_->delegate() && |
+ host_->delegate()->GetInputEventRouter()) { |
+ host_->delegate()->GetInputEventRouter()->AddSurfaceIdNamespaceOwner( |
+ GetSurfaceIdNamespace(), this); |
+ } |
+ has_started_rendering_ = true; |
+ } |
+ |
delegated_frame_host_->SwapDelegatedFrame( |
output_surface_id, frame->delegated_frame_data.Pass(), |
frame->metadata.device_scale_factor, frame->metadata.latency_info, |
@@ -2110,7 +2123,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 { |
@@ -2129,7 +2142,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 { |
@@ -2193,6 +2206,12 @@ void RenderWidgetHostViewAura::ProcessMouseWheelEvent( |
host_->ForwardWheelEvent(event); |
} |
+void RenderWidgetHostViewAura::ProcessTouchEvent( |
+ const blink::WebTouchEvent& event, |
+ const ui::LatencyInfo& latency) { |
+ host_->ForwardTouchEventWithLatencyInfo(event, latency); |
+} |
+ |
void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { |
TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); |
@@ -2259,7 +2278,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) { |