Chromium Code Reviews| 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..afb4140d315b3badf167bf2525c51d028c46b23d 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); |
| @@ -1176,6 +1170,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 +2116,12 @@ 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()) { |
| + // TODO(wjmaclean); if AreCrossProcessFramesPossible() returns true, |
| + // can we safely assume that any existing delegate will have an |
| + // InputEventRouter? Also, is the call to AreCrossProcessFramesPossible() |
| + // expensive? If so, can the result be stored in a bool? |
|
kenrb
2015/11/02 16:04:22
I don't think we can assume a non-null return from
wjmaclean
2015/11/02 19:23:10
Ok, good to know.
|
| + if (SiteIsolationPolicy::AreCrossProcessFramesPossible() && |
| + host_->delegate() && host_->delegate()->GetInputEventRouter()) { |
| host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( |
| this, &mouse_wheel_event); |
|
tdresser
2015/11/02 15:38:25
Could we refactor this into
ShouldRouteEvent and R
wjmaclean
2015/11/02 19:23:10
ShouldRouteEvent() was fairly easy, since we can k
tdresser
2015/11/02 21:10:19
This looks good to me.
|
| } else { |
| @@ -2129,7 +2140,9 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
| blink::WebMouseEvent mouse_event = MakeWebMouseEvent(*event); |
| ModifyEventMovementAndCoords(&mouse_event); |
| - if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { |
| + // TODO(wjmaclean): ditto the TODO above. |
| + if (SiteIsolationPolicy::AreCrossProcessFramesPossible() && |
| + host_->delegate() && host_->delegate()->GetInputEventRouter()) { |
| 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 (host_->delegate() && host_->delegate()->GetInputEventRouter()) { |
| + host_->delegate()->GetInputEventRouter()->RouteTouchEvent( |
| + this, &touch_event, *event->latency()); |
| + } else { |
| + ProcessTouchEvent(touch_event, *event->latency()); |
| + } |
| } |
| void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { |