| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" | 5 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
| 6 | 6 |
| 7 #include "cc/quads/surface_draw_quad.h" | 7 #include "cc/quads/surface_draw_quad.h" |
| 8 #include "cc/surfaces/surface_id_allocator.h" | 8 #include "cc/surfaces/surface_id_allocator.h" |
| 9 #include "cc/surfaces/surface_manager.h" | 9 #include "cc/surfaces/surface_manager.h" |
| 10 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 10 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 11 #include "content/common/frame_messages.h" | 11 #include "content/common/frame_messages.h" |
| 12 #include "third_party/WebKit/public/web/WebInputEvent.h" | 12 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 RenderWidgetHostInputEventRouter::HittestDelegate::HittestDelegate( | 16 RenderWidgetHostInputEventRouter::HittestDelegate::HittestDelegate( |
| 17 const std::unordered_map<cc::SurfaceId, HittestData, cc::SurfaceIdHash>& | 17 const std::unordered_map<cc::SurfaceId, HittestData, cc::SurfaceIdHash>& |
| 18 hittest_data) | 18 hittest_data) |
| 19 : hittest_data_(hittest_data) {} | 19 : hittest_data_(hittest_data) {} |
| 20 | 20 |
| 21 bool RenderWidgetHostInputEventRouter::HittestDelegate::RejectHitTarget( | 21 bool RenderWidgetHostInputEventRouter::HittestDelegate::RejectHitTarget( |
| 22 const cc::SurfaceDrawQuad* surface_quad, | 22 const cc::SurfaceDrawQuad* surface_quad, |
| 23 const gfx::Point& point_in_quad_space) { | 23 const gfx::Point& point_in_quad_space) { |
| 24 auto it = hittest_data_.find(surface_quad->surface_id); | 24 auto it = hittest_data_.find(surface_quad->surface_id); |
| 25 if (it != hittest_data_.end() && it->second.ignored_for_hittest) | 25 if (it != hittest_data_.end() && it->second.ignored_for_hittest) |
| 26 return true; | 26 return true; |
| 27 return false; | 27 return false; |
| 28 } | 28 } |
| 29 | 29 |
| 30 bool RenderWidgetHostInputEventRouter::HittestDelegate::AcceptHitTarget( |
| 31 const cc::SurfaceDrawQuad* surface_quad, |
| 32 const gfx::Point& point_in_quad_space) { |
| 33 auto it = hittest_data_.find(surface_quad->surface_id); |
| 34 if (it != hittest_data_.end() && !it->second.ignored_for_hittest) |
| 35 return true; |
| 36 return false; |
| 37 } |
| 38 |
| 30 RenderWidgetHostInputEventRouter::RenderWidgetHostInputEventRouter() | 39 RenderWidgetHostInputEventRouter::RenderWidgetHostInputEventRouter() |
| 31 : active_touches_(0) {} | 40 : active_touches_(0) {} |
| 32 | 41 |
| 33 RenderWidgetHostInputEventRouter::~RenderWidgetHostInputEventRouter() { | 42 RenderWidgetHostInputEventRouter::~RenderWidgetHostInputEventRouter() { |
| 34 owner_map_.clear(); | 43 owner_map_.clear(); |
| 35 } | 44 } |
| 36 | 45 |
| 37 RenderWidgetHostViewBase* RenderWidgetHostInputEventRouter::FindEventTarget( | 46 RenderWidgetHostViewBase* RenderWidgetHostInputEventRouter::FindEventTarget( |
| 38 RenderWidgetHostViewBase* root_view, | 47 RenderWidgetHostViewBase* root_view, |
| 39 const gfx::Point& point, | 48 const gfx::Point& point, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 if (owner_map_.find(cc::SurfaceIdAllocator::NamespaceForId( | 178 if (owner_map_.find(cc::SurfaceIdAllocator::NamespaceForId( |
| 170 params.surface_id)) == owner_map_.end()) { | 179 params.surface_id)) == owner_map_.end()) { |
| 171 return; | 180 return; |
| 172 } | 181 } |
| 173 HittestData data; | 182 HittestData data; |
| 174 data.ignored_for_hittest = params.ignored_for_hittest; | 183 data.ignored_for_hittest = params.ignored_for_hittest; |
| 175 hittest_data_[params.surface_id] = data; | 184 hittest_data_[params.surface_id] = data; |
| 176 } | 185 } |
| 177 | 186 |
| 178 } // namespace content | 187 } // namespace content |
| OLD | NEW |