| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 if (!settings_.touch_hit_testing) | 483 if (!settings_.touch_hit_testing) |
| 484 return true; | 484 return true; |
| 485 if (!EnsureRenderSurfaceLayerList()) | 485 if (!EnsureRenderSurfaceLayerList()) |
| 486 return false; | 486 return false; |
| 487 | 487 |
| 488 gfx::PointF device_viewport_point = | 488 gfx::PointF device_viewport_point = |
| 489 gfx::ScalePoint(viewport_point, device_scale_factor_); | 489 gfx::ScalePoint(viewport_point, device_scale_factor_); |
| 490 | 490 |
| 491 LayerImpl* layer_impl = | 491 LayerImpl* layer_impl = |
| 492 LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion( | 492 LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion( |
| 493 device_viewport_point, | 493 device_viewport_point, active_tree_->root_layer()); |
| 494 active_tree_->RenderSurfaceLayerList()); | |
| 495 return layer_impl != NULL; | 494 return layer_impl != NULL; |
| 496 } | 495 } |
| 497 | 496 |
| 498 scoped_ptr<SwapPromiseMonitor> | 497 scoped_ptr<SwapPromiseMonitor> |
| 499 LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor( | 498 LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor( |
| 500 ui::LatencyInfo* latency) { | 499 ui::LatencyInfo* latency) { |
| 501 return scoped_ptr<SwapPromiseMonitor>( | 500 return scoped_ptr<SwapPromiseMonitor>( |
| 502 new LatencyInfoSwapPromiseMonitor(latency, NULL, this)); | 501 new LatencyInfoSwapPromiseMonitor(latency, NULL, this)); |
| 503 } | 502 } |
| 504 | 503 |
| (...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2191 | 2190 |
| 2192 DCHECK(!CurrentlyScrollingLayer()); | 2191 DCHECK(!CurrentlyScrollingLayer()); |
| 2193 ClearCurrentlyScrollingLayer(); | 2192 ClearCurrentlyScrollingLayer(); |
| 2194 | 2193 |
| 2195 if (!EnsureRenderSurfaceLayerList()) | 2194 if (!EnsureRenderSurfaceLayerList()) |
| 2196 return ScrollIgnored; | 2195 return ScrollIgnored; |
| 2197 | 2196 |
| 2198 gfx::PointF device_viewport_point = gfx::ScalePoint(viewport_point, | 2197 gfx::PointF device_viewport_point = gfx::ScalePoint(viewport_point, |
| 2199 device_scale_factor_); | 2198 device_scale_factor_); |
| 2200 LayerImpl* layer_impl = LayerTreeHostCommon::FindLayerThatIsHitByPoint( | 2199 LayerImpl* layer_impl = LayerTreeHostCommon::FindLayerThatIsHitByPoint( |
| 2201 device_viewport_point, | 2200 device_viewport_point, active_tree_->root_layer()); |
| 2202 active_tree_->RenderSurfaceLayerList()); | |
| 2203 | 2201 |
| 2204 if (layer_impl) { | 2202 if (layer_impl) { |
| 2205 LayerImpl* scroll_layer_impl = | 2203 LayerImpl* scroll_layer_impl = |
| 2206 LayerTreeHostCommon::FindFirstScrollingLayerThatIsHitByPoint( | 2204 LayerTreeHostCommon::FindFirstScrollingLayerThatIsHitByPoint( |
| 2207 device_viewport_point, active_tree_->RenderSurfaceLayerList()); | 2205 device_viewport_point, active_tree_->root_layer()); |
| 2208 if (scroll_layer_impl && !HasScrollAncestor(layer_impl, scroll_layer_impl)) | 2206 if (scroll_layer_impl && !HasScrollAncestor(layer_impl, scroll_layer_impl)) |
| 2209 return ScrollUnknown; | 2207 return ScrollUnknown; |
| 2210 } | 2208 } |
| 2211 | 2209 |
| 2212 bool scroll_on_main_thread = false; | 2210 bool scroll_on_main_thread = false; |
| 2213 LayerImpl* potentially_scrolling_layer_impl = | 2211 LayerImpl* potentially_scrolling_layer_impl = |
| 2214 FindScrollLayerForDeviceViewportPoint(device_viewport_point, | 2212 FindScrollLayerForDeviceViewportPoint(device_viewport_point, |
| 2215 type, | 2213 type, |
| 2216 layer_impl, | 2214 layer_impl, |
| 2217 &scroll_on_main_thread, | 2215 &scroll_on_main_thread, |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2566 } | 2564 } |
| 2567 | 2565 |
| 2568 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { | 2566 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
| 2569 if (!EnsureRenderSurfaceLayerList()) | 2567 if (!EnsureRenderSurfaceLayerList()) |
| 2570 return; | 2568 return; |
| 2571 | 2569 |
| 2572 gfx::PointF device_viewport_point = gfx::ScalePoint(viewport_point, | 2570 gfx::PointF device_viewport_point = gfx::ScalePoint(viewport_point, |
| 2573 device_scale_factor_); | 2571 device_scale_factor_); |
| 2574 | 2572 |
| 2575 LayerImpl* layer_impl = LayerTreeHostCommon::FindLayerThatIsHitByPoint( | 2573 LayerImpl* layer_impl = LayerTreeHostCommon::FindLayerThatIsHitByPoint( |
| 2576 device_viewport_point, | 2574 device_viewport_point, active_tree_->root_layer()); |
| 2577 active_tree_->RenderSurfaceLayerList()); | |
| 2578 if (HandleMouseOverScrollbar(layer_impl, device_viewport_point)) | 2575 if (HandleMouseOverScrollbar(layer_impl, device_viewport_point)) |
| 2579 return; | 2576 return; |
| 2580 | 2577 |
| 2581 if (scroll_layer_id_when_mouse_over_scrollbar_) { | 2578 if (scroll_layer_id_when_mouse_over_scrollbar_) { |
| 2582 LayerImpl* scroll_layer_impl = active_tree_->LayerById( | 2579 LayerImpl* scroll_layer_impl = active_tree_->LayerById( |
| 2583 scroll_layer_id_when_mouse_over_scrollbar_); | 2580 scroll_layer_id_when_mouse_over_scrollbar_); |
| 2584 | 2581 |
| 2585 // The check for a null scroll_layer_impl below was added to see if it will | 2582 // The check for a null scroll_layer_impl below was added to see if it will |
| 2586 // eliminate the crashes described in http://crbug.com/326635. | 2583 // eliminate the crashes described in http://crbug.com/326635. |
| 2587 // TODO(wjmaclean) Add a unit test if this fixes the crashes. | 2584 // TODO(wjmaclean) Add a unit test if this fixes the crashes. |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3129 swap_promise_monitor_.erase(monitor); | 3126 swap_promise_monitor_.erase(monitor); |
| 3130 } | 3127 } |
| 3131 | 3128 |
| 3132 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3129 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
| 3133 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3130 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
| 3134 for (; it != swap_promise_monitor_.end(); it++) | 3131 for (; it != swap_promise_monitor_.end(); it++) |
| 3135 (*it)->OnSetNeedsRedrawOnImpl(); | 3132 (*it)->OnSetNeedsRedrawOnImpl(); |
| 3136 } | 3133 } |
| 3137 | 3134 |
| 3138 } // namespace cc | 3135 } // namespace cc |
| OLD | NEW |