Chromium Code Reviews| Index: cc/trees/layer_tree_host_impl.cc |
| diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc |
| index d47f504871741c890f5daf7280c13c7412cf7e2e..28eba769b00d0bdb3fbd922dcfd5ea7677f221ad 100644 |
| --- a/cc/trees/layer_tree_host_impl.cc |
| +++ b/cc/trees/layer_tree_host_impl.cc |
| @@ -209,6 +209,7 @@ LayerTreeHostImpl::LayerTreeHostImpl( |
| wheel_scrolling_(false), |
| scroll_affects_scroll_handler_(false), |
| scroll_layer_id_when_mouse_over_scrollbar_(Layer::INVALID_ID), |
| + scroll_layer_id_when_mouse_near_scrollbar_(Layer::INVALID_ID), |
| captured_scrollbar_layer_id_(Layer::INVALID_ID), |
| tile_priorities_dirty_(false), |
| settings_(settings), |
| @@ -3256,9 +3257,17 @@ void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
| if (scroll_on_main_thread || !scroll_layer_impl) |
| return; |
| - ScrollbarAnimationController* animation_controller = |
| + if (scroll_layer_impl->id() != scroll_layer_id_when_mouse_near_scrollbar_) { |
| + ScrollbarAnimationController* old_animation_controller = |
| + ScrollbarAnimationControllerForId( |
|
bokan
2016/10/18 15:44:35
Hmm...too much of this logic is starting to creep
sahel
2016/10/19 21:29:17
Done.
|
| + scroll_layer_id_when_mouse_near_scrollbar_); |
| + if (old_animation_controller) |
| + old_animation_controller->DidMouseMoveOffScrollbar(); |
| + } |
| + |
| + ScrollbarAnimationController* new_animation_controller = |
| ScrollbarAnimationControllerForId(scroll_layer_impl->id()); |
| - if (!animation_controller) |
| + if (!new_animation_controller) |
| return; |
| float distance_to_scrollbar = std::numeric_limits<float>::max(); |
| @@ -3268,8 +3277,10 @@ void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
| std::min(distance_to_scrollbar, |
| DeviceSpaceDistanceToLayer(device_viewport_point, scrollbar)); |
| - animation_controller->DidMouseMoveNear(distance_to_scrollbar / |
| - active_tree_->device_scale_factor()); |
| + new_animation_controller->DidMouseMoveNear( |
| + distance_to_scrollbar / active_tree_->device_scale_factor()); |
| + if (new_animation_controller->MouseIsNearScrollbar()) |
| + scroll_layer_id_when_mouse_near_scrollbar_ = scroll_layer_impl->id(); |
| } |
| void LayerTreeHostImpl::HandleMouseOverScrollbar(LayerImpl* layer_impl) { |