| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 need_update_gpu_rasterization_status_(false), | 199 need_update_gpu_rasterization_status_(false), |
| 200 content_is_suitable_for_gpu_rasterization_(true), | 200 content_is_suitable_for_gpu_rasterization_(true), |
| 201 has_gpu_rasterization_trigger_(false), | 201 has_gpu_rasterization_trigger_(false), |
| 202 use_gpu_rasterization_(false), | 202 use_gpu_rasterization_(false), |
| 203 use_msaa_(false), | 203 use_msaa_(false), |
| 204 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), | 204 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), |
| 205 input_handler_client_(NULL), | 205 input_handler_client_(NULL), |
| 206 did_lock_scrolling_layer_(false), | 206 did_lock_scrolling_layer_(false), |
| 207 wheel_scrolling_(false), | 207 wheel_scrolling_(false), |
| 208 scroll_affects_scroll_handler_(false), | 208 scroll_affects_scroll_handler_(false), |
| 209 scroll_layer_id_mouse_currently_over_(Layer::INVALID_ID), | |
| 210 scroll_layer_id_mouse_currently_captured_(Layer::INVALID_ID), | |
| 211 tile_priorities_dirty_(false), | 209 tile_priorities_dirty_(false), |
| 212 settings_(settings), | 210 settings_(settings), |
| 213 visible_(false), | 211 visible_(false), |
| 214 cached_managed_memory_policy_(settings.gpu_memory_policy), | 212 cached_managed_memory_policy_(settings.gpu_memory_policy), |
| 215 is_synchronous_single_threaded_(!task_runner_provider->HasImplThread() && | 213 is_synchronous_single_threaded_(!task_runner_provider->HasImplThread() && |
| 216 !settings.single_thread_proxy_scheduler), | 214 !settings.single_thread_proxy_scheduler), |
| 217 // Must be initialized after is_synchronous_single_threaded_ and | 215 // Must be initialized after is_synchronous_single_threaded_ and |
| 218 // task_runner_provider_. | 216 // task_runner_provider_. |
| 219 tile_manager_(this, | 217 tile_manager_(this, |
| 220 GetTaskRunner(), | 218 GetTaskRunner(), |
| (...skipping 2711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2932 base::TimeDelta delayed_by) { | 2930 base::TimeDelta delayed_by) { |
| 2933 InputHandler::ScrollStatus scroll_status; | 2931 InputHandler::ScrollStatus scroll_status; |
| 2934 scroll_status.main_thread_scrolling_reasons = | 2932 scroll_status.main_thread_scrolling_reasons = |
| 2935 MainThreadScrollingReason::kNotScrollingOnMain; | 2933 MainThreadScrollingReason::kNotScrollingOnMain; |
| 2936 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; | 2934 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; |
| 2937 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); | 2935 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); |
| 2938 | 2936 |
| 2939 if (scroll_node) { | 2937 if (scroll_node) { |
| 2940 // Flash the overlay scrollbar even if the scroll dalta is 0. | 2938 // Flash the overlay scrollbar even if the scroll dalta is 0. |
| 2941 ScrollbarAnimationController* animation_controller = | 2939 ScrollbarAnimationController* animation_controller = |
| 2942 ScrollbarAnimationControllerForId(scroll_node->owning_layer_id); | 2940 ScrollbarAnimationControllerForElementId(scroll_node->element_id); |
| 2943 | 2941 |
| 2944 if (animation_controller) | 2942 if (animation_controller) |
| 2945 animation_controller->WillUpdateScroll(); | 2943 animation_controller->WillUpdateScroll(); |
| 2946 | 2944 |
| 2947 gfx::Vector2dF delta = scroll_delta; | 2945 gfx::Vector2dF delta = scroll_delta; |
| 2948 if (!scroll_node->user_scrollable_horizontal) | 2946 if (!scroll_node->user_scrollable_horizontal) |
| 2949 delta.set_x(0); | 2947 delta.set_x(0); |
| 2950 if (!scroll_node->user_scrollable_vertical) | 2948 if (!scroll_node->user_scrollable_vertical) |
| 2951 delta.set_y(0); | 2949 delta.set_y(0); |
| 2952 | 2950 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2983 scroll_node->id != scroll_animating_latched_node_id_) { | 2981 scroll_node->id != scroll_animating_latched_node_id_) { |
| 2984 continue; | 2982 continue; |
| 2985 } | 2983 } |
| 2986 | 2984 |
| 2987 bool scrolls_main_viewport_scroll_layer = | 2985 bool scrolls_main_viewport_scroll_layer = |
| 2988 viewport()->MainScrollLayer() && | 2986 viewport()->MainScrollLayer() && |
| 2989 viewport()->MainScrollLayer()->scroll_tree_index() == scroll_node->id; | 2987 viewport()->MainScrollLayer()->scroll_tree_index() == scroll_node->id; |
| 2990 if (scrolls_main_viewport_scroll_layer) { | 2988 if (scrolls_main_viewport_scroll_layer) { |
| 2991 // Flash the overlay scrollbar even if the scroll dalta is 0. | 2989 // Flash the overlay scrollbar even if the scroll dalta is 0. |
| 2992 ScrollbarAnimationController* animation_controller = | 2990 ScrollbarAnimationController* animation_controller = |
| 2993 ScrollbarAnimationControllerForId(scroll_node->owning_layer_id); | 2991 ScrollbarAnimationControllerForElementId(scroll_node->element_id); |
| 2994 | 2992 |
| 2995 if (animation_controller) | 2993 if (animation_controller) |
| 2996 animation_controller->WillUpdateScroll(); | 2994 animation_controller->WillUpdateScroll(); |
| 2997 | 2995 |
| 2998 gfx::Vector2dF scrolled = | 2996 gfx::Vector2dF scrolled = |
| 2999 viewport()->ScrollAnimated(pending_delta, delayed_by); | 2997 viewport()->ScrollAnimated(pending_delta, delayed_by); |
| 3000 // Viewport::ScrollAnimated returns pending_delta as long as it starts | 2998 // Viewport::ScrollAnimated returns pending_delta as long as it starts |
| 3001 // an animation. | 2999 // an animation. |
| 3002 if (scrolled == pending_delta) { | 3000 if (scrolled == pending_delta) { |
| 3003 scroll_animating_latched_node_id_ = scroll_node->id; | 3001 scroll_animating_latched_node_id_ = scroll_node->id; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3243 DCHECK(scroll_state); | 3241 DCHECK(scroll_state); |
| 3244 | 3242 |
| 3245 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); | 3243 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); |
| 3246 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; | 3244 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; |
| 3247 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); | 3245 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); |
| 3248 | 3246 |
| 3249 if (!scroll_node) | 3247 if (!scroll_node) |
| 3250 return InputHandlerScrollResult(); | 3248 return InputHandlerScrollResult(); |
| 3251 | 3249 |
| 3252 ScrollbarAnimationController* animation_controller = | 3250 ScrollbarAnimationController* animation_controller = |
| 3253 ScrollbarAnimationControllerForId(scroll_node->owning_layer_id); | 3251 ScrollbarAnimationControllerForElementId(scroll_node->element_id); |
| 3254 | 3252 |
| 3255 if (animation_controller) | 3253 if (animation_controller) |
| 3256 animation_controller->WillUpdateScroll(); | 3254 animation_controller->WillUpdateScroll(); |
| 3257 | 3255 |
| 3258 float initial_top_controls_offset = | 3256 float initial_top_controls_offset = |
| 3259 browser_controls_offset_manager_->ControlsTopOffset(); | 3257 browser_controls_offset_manager_->ControlsTopOffset(); |
| 3260 | 3258 |
| 3261 scroll_state->set_delta_consumed_for_scroll_sequence( | 3259 scroll_state->set_delta_consumed_for_scroll_sequence( |
| 3262 did_lock_scrolling_layer_); | 3260 did_lock_scrolling_layer_); |
| 3263 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); | 3261 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3383 | 3381 |
| 3384 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( | 3382 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( |
| 3385 layer_impl->ScreenSpaceTransform(), gfx::RectF(layer_impl_bounds)); | 3383 layer_impl->ScreenSpaceTransform(), gfx::RectF(layer_impl_bounds)); |
| 3386 | 3384 |
| 3387 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( | 3385 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( |
| 3388 device_viewport_point); | 3386 device_viewport_point); |
| 3389 } | 3387 } |
| 3390 | 3388 |
| 3391 void LayerTreeHostImpl::MouseDown() { | 3389 void LayerTreeHostImpl::MouseDown() { |
| 3392 ScrollbarAnimationController* animation_controller = | 3390 ScrollbarAnimationController* animation_controller = |
| 3393 ScrollbarAnimationControllerForId(scroll_layer_id_mouse_currently_over_); | 3391 ScrollbarAnimationControllerForElementId( |
| 3392 scroll_element_id_mouse_currently_over_); |
| 3394 if (animation_controller) { | 3393 if (animation_controller) { |
| 3395 animation_controller->DidMouseDown(); | 3394 animation_controller->DidMouseDown(); |
| 3396 scroll_layer_id_mouse_currently_captured_ = | 3395 scroll_element_id_mouse_currently_captured_ = |
| 3397 scroll_layer_id_mouse_currently_over_; | 3396 scroll_element_id_mouse_currently_over_; |
| 3398 } | 3397 } |
| 3399 } | 3398 } |
| 3400 | 3399 |
| 3401 void LayerTreeHostImpl::MouseUp() { | 3400 void LayerTreeHostImpl::MouseUp() { |
| 3402 if (scroll_layer_id_mouse_currently_captured_ != Layer::INVALID_ID) { | 3401 if (scroll_element_id_mouse_currently_captured_) { |
| 3403 ScrollbarAnimationController* animation_controller = | 3402 ScrollbarAnimationController* animation_controller = |
| 3404 ScrollbarAnimationControllerForId( | 3403 ScrollbarAnimationControllerForElementId( |
| 3405 scroll_layer_id_mouse_currently_captured_); | 3404 scroll_element_id_mouse_currently_captured_); |
| 3406 | 3405 |
| 3407 scroll_layer_id_mouse_currently_captured_ = Layer::INVALID_ID; | 3406 scroll_element_id_mouse_currently_captured_ = ElementId(); |
| 3408 | 3407 |
| 3409 if (animation_controller) | 3408 if (animation_controller) |
| 3410 animation_controller->DidMouseUp(); | 3409 animation_controller->DidMouseUp(); |
| 3411 } | 3410 } |
| 3412 } | 3411 } |
| 3413 | 3412 |
| 3414 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { | 3413 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
| 3415 gfx::PointF device_viewport_point = gfx::ScalePoint( | 3414 gfx::PointF device_viewport_point = gfx::ScalePoint( |
| 3416 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | 3415 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); |
| 3417 LayerImpl* layer_impl = | 3416 LayerImpl* layer_impl = |
| 3418 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | 3417 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); |
| 3419 | 3418 |
| 3420 // Check if mouse is over a scrollbar or not. | 3419 // Check if mouse is over a scrollbar or not. |
| 3421 // TODO(sahel): get rid of this extera checking when | 3420 // TODO(sahel): get rid of this extera checking when |
| 3422 // FindScrollLayerForDeviceViewportPoint finds the proper layer for | 3421 // FindScrollLayerForDeviceViewportPoint finds the proper layer for |
| 3423 // scrolling on main thread when mouse is over scrollbar as well. | 3422 // scrolling on main thread when mouse is over scrollbar as well. |
| 3424 int new_id = Layer::INVALID_ID; | 3423 ElementId new_element_id; |
| 3425 if (layer_impl && layer_impl->ToScrollbarLayer()) | 3424 if (layer_impl && layer_impl->ToScrollbarLayer()) |
| 3426 new_id = layer_impl->ToScrollbarLayer()->ScrollLayerId(); | 3425 new_element_id = layer_impl->ToScrollbarLayer()->scroll_element_id(); |
| 3427 if (new_id == Layer::INVALID_ID) { | 3426 if (!new_element_id) { |
| 3428 bool scroll_on_main_thread = false; | 3427 bool scroll_on_main_thread = false; |
| 3429 uint32_t main_thread_scrolling_reasons; | 3428 uint32_t main_thread_scrolling_reasons; |
| 3430 LayerImpl* scroll_layer_impl = FindScrollLayerForDeviceViewportPoint( | 3429 LayerImpl* scroll_layer_impl = FindScrollLayerForDeviceViewportPoint( |
| 3431 device_viewport_point, InputHandler::TOUCHSCREEN, layer_impl, | 3430 device_viewport_point, InputHandler::TOUCHSCREEN, layer_impl, |
| 3432 &scroll_on_main_thread, &main_thread_scrolling_reasons); | 3431 &scroll_on_main_thread, &main_thread_scrolling_reasons); |
| 3433 | 3432 |
| 3434 // Scrollbars for the viewport are registered with the outer viewport layer. | 3433 // Scrollbars for the viewport are registered with the outer viewport layer. |
| 3435 if (scroll_layer_impl == InnerViewportScrollLayer()) | 3434 if (scroll_layer_impl == InnerViewportScrollLayer()) |
| 3436 scroll_layer_impl = OuterViewportScrollLayer(); | 3435 scroll_layer_impl = OuterViewportScrollLayer(); |
| 3437 | 3436 |
| 3438 new_id = scroll_layer_impl ? scroll_layer_impl->id() : Layer::INVALID_ID; | 3437 if (scroll_layer_impl) |
| 3438 new_element_id = scroll_layer_impl->element_id(); |
| 3439 } | 3439 } |
| 3440 | 3440 |
| 3441 if (new_id != scroll_layer_id_mouse_currently_over_) { | 3441 if (new_element_id != scroll_element_id_mouse_currently_over_) { |
| 3442 ScrollbarAnimationController* old_animation_controller = | 3442 ScrollbarAnimationController* old_animation_controller = |
| 3443 ScrollbarAnimationControllerForId( | 3443 ScrollbarAnimationControllerForElementId( |
| 3444 scroll_layer_id_mouse_currently_over_); | 3444 scroll_element_id_mouse_currently_over_); |
| 3445 if (old_animation_controller) { | 3445 if (old_animation_controller) { |
| 3446 old_animation_controller->DidMouseLeave(); | 3446 old_animation_controller->DidMouseLeave(); |
| 3447 } | 3447 } |
| 3448 scroll_layer_id_mouse_currently_over_ = new_id; | 3448 scroll_element_id_mouse_currently_over_ = new_element_id; |
| 3449 } | 3449 } |
| 3450 | 3450 |
| 3451 ScrollbarAnimationController* new_animation_controller = | 3451 ScrollbarAnimationController* new_animation_controller = |
| 3452 ScrollbarAnimationControllerForId(new_id); | 3452 ScrollbarAnimationControllerForElementId(new_element_id); |
| 3453 if (!new_animation_controller) | 3453 if (!new_animation_controller) |
| 3454 return; | 3454 return; |
| 3455 | 3455 |
| 3456 for (ScrollbarLayerImplBase* scrollbar : ScrollbarsFor(new_id)) { | 3456 int new_layer_id = active_tree_->LayerIdByElementId(new_element_id); |
| 3457 for (ScrollbarLayerImplBase* scrollbar : |
| 3458 active_tree_->ScrollbarsFor(new_layer_id)) { |
| 3457 new_animation_controller->DidMouseMoveNear( | 3459 new_animation_controller->DidMouseMoveNear( |
| 3458 scrollbar->orientation(), | 3460 scrollbar->orientation(), |
| 3459 DeviceSpaceDistanceToLayer(device_viewport_point, scrollbar) / | 3461 DeviceSpaceDistanceToLayer(device_viewport_point, scrollbar) / |
| 3460 active_tree_->device_scale_factor()); | 3462 active_tree_->device_scale_factor()); |
| 3461 } | 3463 } |
| 3462 } | 3464 } |
| 3463 | 3465 |
| 3464 void LayerTreeHostImpl::MouseLeave() { | 3466 void LayerTreeHostImpl::MouseLeave() { |
| 3465 for (auto& pair : scrollbar_animation_controllers_) | 3467 for (auto& pair : scrollbar_animation_controllers_) |
| 3466 pair.second->DidMouseLeave(); | 3468 pair.second->DidMouseLeave(); |
| 3467 scroll_layer_id_mouse_currently_over_ = Layer::INVALID_ID; | 3469 scroll_element_id_mouse_currently_over_ = ElementId(); |
| 3468 } | 3470 } |
| 3469 | 3471 |
| 3470 void LayerTreeHostImpl::PinchGestureBegin() { | 3472 void LayerTreeHostImpl::PinchGestureBegin() { |
| 3471 pinch_gesture_active_ = true; | 3473 pinch_gesture_active_ = true; |
| 3472 client_->RenewTreePriority(); | 3474 client_->RenewTreePriority(); |
| 3473 pinch_gesture_end_should_clear_scrolling_node_ = !CurrentlyScrollingNode(); | 3475 pinch_gesture_end_should_clear_scrolling_node_ = !CurrentlyScrollingNode(); |
| 3474 | 3476 |
| 3475 active_tree_->SetCurrentlyScrollingNode(OuterViewportScrollNode()); | 3477 active_tree_->SetCurrentlyScrollingNode(OuterViewportScrollNode()); |
| 3476 browser_controls_offset_manager_->PinchBegin(); | 3478 browser_controls_offset_manager_->PinchBegin(); |
| 3477 } | 3479 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3526 tree_impl->InnerViewportScrollLayer() | 3528 tree_impl->InnerViewportScrollLayer() |
| 3527 ? tree_impl->InnerViewportScrollLayer()->id() | 3529 ? tree_impl->InnerViewportScrollLayer()->id() |
| 3528 : Layer::INVALID_ID; | 3530 : Layer::INVALID_ID; |
| 3529 | 3531 |
| 3530 tree_impl->property_trees()->scroll_tree.CollectScrollDeltas( | 3532 tree_impl->property_trees()->scroll_tree.CollectScrollDeltas( |
| 3531 scroll_info, inner_viewport_layer_id); | 3533 scroll_info, inner_viewport_layer_id); |
| 3532 } | 3534 } |
| 3533 | 3535 |
| 3534 static void CollectScrollbarUpdates( | 3536 static void CollectScrollbarUpdates( |
| 3535 ScrollAndScaleSet* scroll_info, | 3537 ScrollAndScaleSet* scroll_info, |
| 3536 std::unordered_map<int, std::unique_ptr<ScrollbarAnimationController>>* | 3538 std::unordered_map<ElementId, |
| 3537 controllers) { | 3539 std::unique_ptr<ScrollbarAnimationController>, |
| 3540 ElementIdHash>* controllers) { |
| 3538 scroll_info->scrollbars.reserve(controllers->size()); | 3541 scroll_info->scrollbars.reserve(controllers->size()); |
| 3539 for (auto& pair : *controllers) { | 3542 for (auto& pair : *controllers) { |
| 3540 scroll_info->scrollbars.push_back(LayerTreeHostCommon::ScrollbarsUpdateInfo( | 3543 scroll_info->scrollbars.push_back(LayerTreeHostCommon::ScrollbarsUpdateInfo( |
| 3541 pair.first, pair.second->ScrollbarsHidden())); | 3544 pair.first, pair.second->ScrollbarsHidden())); |
| 3542 } | 3545 } |
| 3543 } | 3546 } |
| 3544 | 3547 |
| 3545 std::unique_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { | 3548 std::unique_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { |
| 3546 std::unique_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); | 3549 std::unique_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); |
| 3547 | 3550 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3671 if (active_tree_->root_layer_for_testing()) { | 3674 if (active_tree_->root_layer_for_testing()) { |
| 3672 std::unique_ptr<base::Value> json( | 3675 std::unique_ptr<base::Value> json( |
| 3673 active_tree_->root_layer_for_testing()->LayerTreeAsJson()); | 3676 active_tree_->root_layer_for_testing()->LayerTreeAsJson()); |
| 3674 base::JSONWriter::WriteWithOptions( | 3677 base::JSONWriter::WriteWithOptions( |
| 3675 *json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &str); | 3678 *json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &str); |
| 3676 } | 3679 } |
| 3677 return str; | 3680 return str; |
| 3678 } | 3681 } |
| 3679 | 3682 |
| 3680 void LayerTreeHostImpl::RegisterScrollbarAnimationController( | 3683 void LayerTreeHostImpl::RegisterScrollbarAnimationController( |
| 3681 int scroll_layer_id) { | 3684 int scroll_layer_id, |
| 3685 ElementId scroll_element_id) { |
| 3682 if (settings().scrollbar_animator == LayerTreeSettings::NO_ANIMATOR) | 3686 if (settings().scrollbar_animator == LayerTreeSettings::NO_ANIMATOR) |
| 3683 return; | 3687 return; |
| 3684 if (ScrollbarAnimationControllerForId(scroll_layer_id)) | 3688 if (ScrollbarAnimationControllerForElementId(scroll_element_id)) |
| 3685 return; | 3689 return; |
| 3686 scrollbar_animation_controllers_[scroll_layer_id] = | 3690 scrollbar_animation_controllers_[scroll_element_id] = |
| 3687 active_tree_->CreateScrollbarAnimationController(scroll_layer_id); | 3691 active_tree_->CreateScrollbarAnimationController(scroll_layer_id); |
| 3688 } | 3692 } |
| 3689 | 3693 |
| 3690 void LayerTreeHostImpl::UnregisterScrollbarAnimationController( | 3694 void LayerTreeHostImpl::UnregisterScrollbarAnimationController( |
| 3691 int scroll_layer_id) { | 3695 ElementId scroll_element_id) { |
| 3692 scrollbar_animation_controllers_.erase(scroll_layer_id); | 3696 scrollbar_animation_controllers_.erase(scroll_element_id); |
| 3693 } | 3697 } |
| 3694 | 3698 |
| 3695 ScrollbarAnimationController* | 3699 ScrollbarAnimationController* |
| 3696 LayerTreeHostImpl::ScrollbarAnimationControllerForId( | 3700 LayerTreeHostImpl::ScrollbarAnimationControllerForElementId( |
| 3697 int scroll_layer_id) const { | 3701 ElementId scroll_element_id) const { |
| 3698 // The viewport layers have only one set of scrollbars and their controller | 3702 // The viewport layers have only one set of scrollbars and their controller |
| 3699 // is registered with the outer viewport. | 3703 // is registered with the outer viewport. |
| 3700 if (InnerViewportScrollLayer() && OuterViewportScrollLayer() && | 3704 if (InnerViewportScrollLayer() && OuterViewportScrollLayer() && |
| 3701 scroll_layer_id == InnerViewportScrollLayer()->id()) | 3705 scroll_element_id == InnerViewportScrollLayer()->element_id()) |
| 3702 scroll_layer_id = OuterViewportScrollLayer()->id(); | 3706 scroll_element_id = OuterViewportScrollLayer()->element_id(); |
| 3703 auto i = scrollbar_animation_controllers_.find(scroll_layer_id); | 3707 auto i = scrollbar_animation_controllers_.find(scroll_element_id); |
| 3704 if (i == scrollbar_animation_controllers_.end()) | 3708 if (i == scrollbar_animation_controllers_.end()) |
| 3705 return nullptr; | 3709 return nullptr; |
| 3706 return i->second.get(); | 3710 return i->second.get(); |
| 3707 } | 3711 } |
| 3708 | 3712 |
| 3709 void LayerTreeHostImpl::PostDelayedScrollbarAnimationTask( | 3713 void LayerTreeHostImpl::PostDelayedScrollbarAnimationTask( |
| 3710 const base::Closure& task, | 3714 const base::Closure& task, |
| 3711 base::TimeDelta delay) { | 3715 base::TimeDelta delay) { |
| 3712 client_->PostDelayedAnimationTaskOnImplThread(task, delay); | 3716 client_->PostDelayedAnimationTaskOnImplThread(task, delay); |
| 3713 } | 3717 } |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4282 } | 4286 } |
| 4283 | 4287 |
| 4284 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { | 4288 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { |
| 4285 if (is_wheel_scroll) | 4289 if (is_wheel_scroll) |
| 4286 has_scrolled_by_wheel_ = true; | 4290 has_scrolled_by_wheel_ = true; |
| 4287 else | 4291 else |
| 4288 has_scrolled_by_touch_ = true; | 4292 has_scrolled_by_touch_ = true; |
| 4289 } | 4293 } |
| 4290 | 4294 |
| 4291 } // namespace cc | 4295 } // namespace cc |
| OLD | NEW |