| 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 2728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2949 base::TimeDelta delayed_by) { | 2947 base::TimeDelta delayed_by) { |
| 2950 InputHandler::ScrollStatus scroll_status; | 2948 InputHandler::ScrollStatus scroll_status; |
| 2951 scroll_status.main_thread_scrolling_reasons = | 2949 scroll_status.main_thread_scrolling_reasons = |
| 2952 MainThreadScrollingReason::kNotScrollingOnMain; | 2950 MainThreadScrollingReason::kNotScrollingOnMain; |
| 2953 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; | 2951 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; |
| 2954 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); | 2952 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); |
| 2955 | 2953 |
| 2956 if (scroll_node) { | 2954 if (scroll_node) { |
| 2957 // Flash the overlay scrollbar even if the scroll dalta is 0. | 2955 // Flash the overlay scrollbar even if the scroll dalta is 0. |
| 2958 ScrollbarAnimationController* animation_controller = | 2956 ScrollbarAnimationController* animation_controller = |
| 2959 ScrollbarAnimationControllerForId(scroll_node->owning_layer_id); | 2957 ScrollbarAnimationControllerForElementId(scroll_node->element_id); |
| 2960 | 2958 |
| 2961 if (animation_controller) | 2959 if (animation_controller) |
| 2962 animation_controller->WillUpdateScroll(); | 2960 animation_controller->WillUpdateScroll(); |
| 2963 | 2961 |
| 2964 gfx::Vector2dF delta = scroll_delta; | 2962 gfx::Vector2dF delta = scroll_delta; |
| 2965 if (!scroll_node->user_scrollable_horizontal) | 2963 if (!scroll_node->user_scrollable_horizontal) |
| 2966 delta.set_x(0); | 2964 delta.set_x(0); |
| 2967 if (!scroll_node->user_scrollable_vertical) | 2965 if (!scroll_node->user_scrollable_vertical) |
| 2968 delta.set_y(0); | 2966 delta.set_y(0); |
| 2969 | 2967 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 3000 scroll_node->id != scroll_animating_latched_node_id_) { | 2998 scroll_node->id != scroll_animating_latched_node_id_) { |
| 3001 continue; | 2999 continue; |
| 3002 } | 3000 } |
| 3003 | 3001 |
| 3004 bool scrolls_main_viewport_scroll_layer = | 3002 bool scrolls_main_viewport_scroll_layer = |
| 3005 viewport()->MainScrollLayer() && | 3003 viewport()->MainScrollLayer() && |
| 3006 viewport()->MainScrollLayer()->scroll_tree_index() == scroll_node->id; | 3004 viewport()->MainScrollLayer()->scroll_tree_index() == scroll_node->id; |
| 3007 if (scrolls_main_viewport_scroll_layer) { | 3005 if (scrolls_main_viewport_scroll_layer) { |
| 3008 // Flash the overlay scrollbar even if the scroll dalta is 0. | 3006 // Flash the overlay scrollbar even if the scroll dalta is 0. |
| 3009 ScrollbarAnimationController* animation_controller = | 3007 ScrollbarAnimationController* animation_controller = |
| 3010 ScrollbarAnimationControllerForId(scroll_node->owning_layer_id); | 3008 ScrollbarAnimationControllerForElementId(scroll_node->element_id); |
| 3011 | 3009 |
| 3012 if (animation_controller) | 3010 if (animation_controller) |
| 3013 animation_controller->WillUpdateScroll(); | 3011 animation_controller->WillUpdateScroll(); |
| 3014 | 3012 |
| 3015 gfx::Vector2dF scrolled = | 3013 gfx::Vector2dF scrolled = |
| 3016 viewport()->ScrollAnimated(pending_delta, delayed_by); | 3014 viewport()->ScrollAnimated(pending_delta, delayed_by); |
| 3017 // Viewport::ScrollAnimated returns pending_delta as long as it starts | 3015 // Viewport::ScrollAnimated returns pending_delta as long as it starts |
| 3018 // an animation. | 3016 // an animation. |
| 3019 if (scrolled == pending_delta) { | 3017 if (scrolled == pending_delta) { |
| 3020 scroll_animating_latched_node_id_ = scroll_node->id; | 3018 scroll_animating_latched_node_id_ = scroll_node->id; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3260 DCHECK(scroll_state); | 3258 DCHECK(scroll_state); |
| 3261 | 3259 |
| 3262 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); | 3260 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); |
| 3263 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; | 3261 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; |
| 3264 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); | 3262 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); |
| 3265 | 3263 |
| 3266 if (!scroll_node) | 3264 if (!scroll_node) |
| 3267 return InputHandlerScrollResult(); | 3265 return InputHandlerScrollResult(); |
| 3268 | 3266 |
| 3269 ScrollbarAnimationController* animation_controller = | 3267 ScrollbarAnimationController* animation_controller = |
| 3270 ScrollbarAnimationControllerForId(scroll_node->owning_layer_id); | 3268 ScrollbarAnimationControllerForElementId(scroll_node->element_id); |
| 3271 | 3269 |
| 3272 if (animation_controller) | 3270 if (animation_controller) |
| 3273 animation_controller->WillUpdateScroll(); | 3271 animation_controller->WillUpdateScroll(); |
| 3274 | 3272 |
| 3275 float initial_top_controls_offset = | 3273 float initial_top_controls_offset = |
| 3276 browser_controls_offset_manager_->ControlsTopOffset(); | 3274 browser_controls_offset_manager_->ControlsTopOffset(); |
| 3277 | 3275 |
| 3278 scroll_state->set_delta_consumed_for_scroll_sequence( | 3276 scroll_state->set_delta_consumed_for_scroll_sequence( |
| 3279 did_lock_scrolling_layer_); | 3277 did_lock_scrolling_layer_); |
| 3280 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); | 3278 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3400 | 3398 |
| 3401 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( | 3399 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( |
| 3402 layer_impl->ScreenSpaceTransform(), gfx::RectF(layer_impl_bounds)); | 3400 layer_impl->ScreenSpaceTransform(), gfx::RectF(layer_impl_bounds)); |
| 3403 | 3401 |
| 3404 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( | 3402 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( |
| 3405 device_viewport_point); | 3403 device_viewport_point); |
| 3406 } | 3404 } |
| 3407 | 3405 |
| 3408 void LayerTreeHostImpl::MouseDown() { | 3406 void LayerTreeHostImpl::MouseDown() { |
| 3409 ScrollbarAnimationController* animation_controller = | 3407 ScrollbarAnimationController* animation_controller = |
| 3410 ScrollbarAnimationControllerForId(scroll_layer_id_mouse_currently_over_); | 3408 ScrollbarAnimationControllerForElementId( |
| 3409 scroll_element_id_mouse_currently_over_); |
| 3411 if (animation_controller) { | 3410 if (animation_controller) { |
| 3412 animation_controller->DidMouseDown(); | 3411 animation_controller->DidMouseDown(); |
| 3413 scroll_layer_id_mouse_currently_captured_ = | 3412 scroll_element_id_mouse_currently_captured_ = |
| 3414 scroll_layer_id_mouse_currently_over_; | 3413 scroll_element_id_mouse_currently_over_; |
| 3415 } | 3414 } |
| 3416 } | 3415 } |
| 3417 | 3416 |
| 3418 void LayerTreeHostImpl::MouseUp() { | 3417 void LayerTreeHostImpl::MouseUp() { |
| 3419 if (scroll_layer_id_mouse_currently_captured_ != Layer::INVALID_ID) { | 3418 if (scroll_element_id_mouse_currently_captured_) { |
| 3420 ScrollbarAnimationController* animation_controller = | 3419 ScrollbarAnimationController* animation_controller = |
| 3421 ScrollbarAnimationControllerForId( | 3420 ScrollbarAnimationControllerForElementId( |
| 3422 scroll_layer_id_mouse_currently_captured_); | 3421 scroll_element_id_mouse_currently_captured_); |
| 3423 | 3422 |
| 3424 scroll_layer_id_mouse_currently_captured_ = Layer::INVALID_ID; | 3423 scroll_element_id_mouse_currently_captured_ = ElementId(); |
| 3425 | 3424 |
| 3426 if (animation_controller) | 3425 if (animation_controller) |
| 3427 animation_controller->DidMouseUp(); | 3426 animation_controller->DidMouseUp(); |
| 3428 } | 3427 } |
| 3429 } | 3428 } |
| 3430 | 3429 |
| 3431 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { | 3430 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
| 3432 gfx::PointF device_viewport_point = gfx::ScalePoint( | 3431 gfx::PointF device_viewport_point = gfx::ScalePoint( |
| 3433 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | 3432 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); |
| 3434 LayerImpl* layer_impl = | 3433 LayerImpl* layer_impl = |
| 3435 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | 3434 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); |
| 3436 | 3435 |
| 3437 // Check if mouse is over a scrollbar or not. | 3436 // Check if mouse is over a scrollbar or not. |
| 3438 // TODO(sahel): get rid of this extera checking when | 3437 // TODO(sahel): get rid of this extera checking when |
| 3439 // FindScrollLayerForDeviceViewportPoint finds the proper layer for | 3438 // FindScrollLayerForDeviceViewportPoint finds the proper layer for |
| 3440 // scrolling on main thread when mouse is over scrollbar as well. | 3439 // scrolling on main thread when mouse is over scrollbar as well. |
| 3441 int new_id = Layer::INVALID_ID; | 3440 ElementId new_element_id; |
| 3442 if (layer_impl && layer_impl->ToScrollbarLayer()) | 3441 if (layer_impl && layer_impl->ToScrollbarLayer()) |
| 3443 new_id = layer_impl->ToScrollbarLayer()->ScrollLayerId(); | 3442 new_element_id = layer_impl->ToScrollbarLayer()->scroll_element_id(); |
| 3444 if (new_id == Layer::INVALID_ID) { | 3443 if (!new_element_id) { |
| 3445 bool scroll_on_main_thread = false; | 3444 bool scroll_on_main_thread = false; |
| 3446 uint32_t main_thread_scrolling_reasons; | 3445 uint32_t main_thread_scrolling_reasons; |
| 3447 LayerImpl* scroll_layer_impl = FindScrollLayerForDeviceViewportPoint( | 3446 LayerImpl* scroll_layer_impl = FindScrollLayerForDeviceViewportPoint( |
| 3448 device_viewport_point, InputHandler::TOUCHSCREEN, layer_impl, | 3447 device_viewport_point, InputHandler::TOUCHSCREEN, layer_impl, |
| 3449 &scroll_on_main_thread, &main_thread_scrolling_reasons); | 3448 &scroll_on_main_thread, &main_thread_scrolling_reasons); |
| 3450 | 3449 |
| 3451 // Scrollbars for the viewport are registered with the outer viewport layer. | 3450 // Scrollbars for the viewport are registered with the outer viewport layer. |
| 3452 if (scroll_layer_impl == InnerViewportScrollLayer()) | 3451 if (scroll_layer_impl == InnerViewportScrollLayer()) |
| 3453 scroll_layer_impl = OuterViewportScrollLayer(); | 3452 scroll_layer_impl = OuterViewportScrollLayer(); |
| 3454 | 3453 |
| 3455 new_id = scroll_layer_impl ? scroll_layer_impl->id() : Layer::INVALID_ID; | 3454 if (scroll_layer_impl) |
| 3455 new_element_id = scroll_layer_impl->element_id(); |
| 3456 } | 3456 } |
| 3457 | 3457 |
| 3458 if (new_id != scroll_layer_id_mouse_currently_over_) { | 3458 if (new_element_id != scroll_element_id_mouse_currently_over_) { |
| 3459 ScrollbarAnimationController* old_animation_controller = | 3459 ScrollbarAnimationController* old_animation_controller = |
| 3460 ScrollbarAnimationControllerForId( | 3460 ScrollbarAnimationControllerForElementId( |
| 3461 scroll_layer_id_mouse_currently_over_); | 3461 scroll_element_id_mouse_currently_over_); |
| 3462 if (old_animation_controller) { | 3462 if (old_animation_controller) { |
| 3463 old_animation_controller->DidMouseLeave(); | 3463 old_animation_controller->DidMouseLeave(); |
| 3464 } | 3464 } |
| 3465 scroll_layer_id_mouse_currently_over_ = new_id; | 3465 scroll_element_id_mouse_currently_over_ = new_element_id; |
| 3466 } | 3466 } |
| 3467 | 3467 |
| 3468 ScrollbarAnimationController* new_animation_controller = | 3468 ScrollbarAnimationController* new_animation_controller = |
| 3469 ScrollbarAnimationControllerForId(new_id); | 3469 ScrollbarAnimationControllerForElementId(new_element_id); |
| 3470 if (!new_animation_controller) | 3470 if (!new_animation_controller) |
| 3471 return; | 3471 return; |
| 3472 | 3472 |
| 3473 for (ScrollbarLayerImplBase* scrollbar : ScrollbarsFor(new_id)) { | 3473 int new_layer_id = active_tree_->LayerIdByElementId(new_element_id); |
| 3474 for (ScrollbarLayerImplBase* scrollbar : |
| 3475 active_tree_->ScrollbarsFor(new_layer_id)) { |
| 3474 new_animation_controller->DidMouseMoveNear( | 3476 new_animation_controller->DidMouseMoveNear( |
| 3475 scrollbar->orientation(), | 3477 scrollbar->orientation(), |
| 3476 DeviceSpaceDistanceToLayer(device_viewport_point, scrollbar) / | 3478 DeviceSpaceDistanceToLayer(device_viewport_point, scrollbar) / |
| 3477 active_tree_->device_scale_factor()); | 3479 active_tree_->device_scale_factor()); |
| 3478 } | 3480 } |
| 3479 } | 3481 } |
| 3480 | 3482 |
| 3481 void LayerTreeHostImpl::MouseLeave() { | 3483 void LayerTreeHostImpl::MouseLeave() { |
| 3482 for (auto& pair : scrollbar_animation_controllers_) | 3484 for (auto& pair : scrollbar_animation_controllers_) |
| 3483 pair.second->DidMouseLeave(); | 3485 pair.second->DidMouseLeave(); |
| 3484 scroll_layer_id_mouse_currently_over_ = Layer::INVALID_ID; | 3486 scroll_element_id_mouse_currently_over_ = ElementId(); |
| 3485 } | 3487 } |
| 3486 | 3488 |
| 3487 void LayerTreeHostImpl::PinchGestureBegin() { | 3489 void LayerTreeHostImpl::PinchGestureBegin() { |
| 3488 pinch_gesture_active_ = true; | 3490 pinch_gesture_active_ = true; |
| 3489 client_->RenewTreePriority(); | 3491 client_->RenewTreePriority(); |
| 3490 pinch_gesture_end_should_clear_scrolling_node_ = !CurrentlyScrollingNode(); | 3492 pinch_gesture_end_should_clear_scrolling_node_ = !CurrentlyScrollingNode(); |
| 3491 | 3493 |
| 3492 active_tree_->SetCurrentlyScrollingNode(OuterViewportScrollNode()); | 3494 active_tree_->SetCurrentlyScrollingNode(OuterViewportScrollNode()); |
| 3493 browser_controls_offset_manager_->PinchBegin(); | 3495 browser_controls_offset_manager_->PinchBegin(); |
| 3494 } | 3496 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3543 tree_impl->InnerViewportScrollLayer() | 3545 tree_impl->InnerViewportScrollLayer() |
| 3544 ? tree_impl->InnerViewportScrollLayer()->id() | 3546 ? tree_impl->InnerViewportScrollLayer()->id() |
| 3545 : Layer::INVALID_ID; | 3547 : Layer::INVALID_ID; |
| 3546 | 3548 |
| 3547 tree_impl->property_trees()->scroll_tree.CollectScrollDeltas( | 3549 tree_impl->property_trees()->scroll_tree.CollectScrollDeltas( |
| 3548 scroll_info, inner_viewport_layer_id); | 3550 scroll_info, inner_viewport_layer_id); |
| 3549 } | 3551 } |
| 3550 | 3552 |
| 3551 static void CollectScrollbarUpdates( | 3553 static void CollectScrollbarUpdates( |
| 3552 ScrollAndScaleSet* scroll_info, | 3554 ScrollAndScaleSet* scroll_info, |
| 3553 std::unordered_map<int, std::unique_ptr<ScrollbarAnimationController>>* | 3555 std::unordered_map<ElementId, |
| 3554 controllers) { | 3556 std::unique_ptr<ScrollbarAnimationController>, |
| 3557 ElementIdHash>* controllers) { |
| 3555 scroll_info->scrollbars.reserve(controllers->size()); | 3558 scroll_info->scrollbars.reserve(controllers->size()); |
| 3556 for (auto& pair : *controllers) { | 3559 for (auto& pair : *controllers) { |
| 3557 scroll_info->scrollbars.push_back(LayerTreeHostCommon::ScrollbarsUpdateInfo( | 3560 scroll_info->scrollbars.push_back(LayerTreeHostCommon::ScrollbarsUpdateInfo( |
| 3558 pair.first, pair.second->ScrollbarsHidden())); | 3561 pair.first, pair.second->ScrollbarsHidden())); |
| 3559 } | 3562 } |
| 3560 } | 3563 } |
| 3561 | 3564 |
| 3562 std::unique_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { | 3565 std::unique_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { |
| 3563 std::unique_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); | 3566 std::unique_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); |
| 3564 | 3567 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3688 if (active_tree_->root_layer_for_testing()) { | 3691 if (active_tree_->root_layer_for_testing()) { |
| 3689 std::unique_ptr<base::Value> json( | 3692 std::unique_ptr<base::Value> json( |
| 3690 active_tree_->root_layer_for_testing()->LayerTreeAsJson()); | 3693 active_tree_->root_layer_for_testing()->LayerTreeAsJson()); |
| 3691 base::JSONWriter::WriteWithOptions( | 3694 base::JSONWriter::WriteWithOptions( |
| 3692 *json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &str); | 3695 *json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &str); |
| 3693 } | 3696 } |
| 3694 return str; | 3697 return str; |
| 3695 } | 3698 } |
| 3696 | 3699 |
| 3697 void LayerTreeHostImpl::RegisterScrollbarAnimationController( | 3700 void LayerTreeHostImpl::RegisterScrollbarAnimationController( |
| 3698 int scroll_layer_id) { | 3701 int scroll_layer_id, |
| 3702 ElementId scroll_element_id) { |
| 3699 if (settings().scrollbar_animator == LayerTreeSettings::NO_ANIMATOR) | 3703 if (settings().scrollbar_animator == LayerTreeSettings::NO_ANIMATOR) |
| 3700 return; | 3704 return; |
| 3701 if (ScrollbarAnimationControllerForId(scroll_layer_id)) | 3705 if (ScrollbarAnimationControllerForElementId(scroll_element_id)) |
| 3702 return; | 3706 return; |
| 3703 scrollbar_animation_controllers_[scroll_layer_id] = | 3707 scrollbar_animation_controllers_[scroll_element_id] = |
| 3704 active_tree_->CreateScrollbarAnimationController(scroll_layer_id); | 3708 active_tree_->CreateScrollbarAnimationController(scroll_layer_id); |
| 3705 } | 3709 } |
| 3706 | 3710 |
| 3707 void LayerTreeHostImpl::UnregisterScrollbarAnimationController( | 3711 void LayerTreeHostImpl::UnregisterScrollbarAnimationController( |
| 3708 int scroll_layer_id) { | 3712 ElementId scroll_element_id) { |
| 3709 scrollbar_animation_controllers_.erase(scroll_layer_id); | 3713 scrollbar_animation_controllers_.erase(scroll_element_id); |
| 3710 } | 3714 } |
| 3711 | 3715 |
| 3712 ScrollbarAnimationController* | 3716 ScrollbarAnimationController* |
| 3713 LayerTreeHostImpl::ScrollbarAnimationControllerForId( | 3717 LayerTreeHostImpl::ScrollbarAnimationControllerForElementId( |
| 3714 int scroll_layer_id) const { | 3718 ElementId scroll_element_id) const { |
| 3715 // The viewport layers have only one set of scrollbars and their controller | 3719 // The viewport layers have only one set of scrollbars and their controller |
| 3716 // is registered with the outer viewport. | 3720 // is registered with the outer viewport. |
| 3717 if (InnerViewportScrollLayer() && OuterViewportScrollLayer() && | 3721 if (InnerViewportScrollLayer() && OuterViewportScrollLayer() && |
| 3718 scroll_layer_id == InnerViewportScrollLayer()->id()) | 3722 scroll_element_id == InnerViewportScrollLayer()->element_id()) |
| 3719 scroll_layer_id = OuterViewportScrollLayer()->id(); | 3723 scroll_element_id = OuterViewportScrollLayer()->element_id(); |
| 3720 auto i = scrollbar_animation_controllers_.find(scroll_layer_id); | 3724 auto i = scrollbar_animation_controllers_.find(scroll_element_id); |
| 3721 if (i == scrollbar_animation_controllers_.end()) | 3725 if (i == scrollbar_animation_controllers_.end()) |
| 3722 return nullptr; | 3726 return nullptr; |
| 3723 return i->second.get(); | 3727 return i->second.get(); |
| 3724 } | 3728 } |
| 3725 | 3729 |
| 3726 void LayerTreeHostImpl::PostDelayedScrollbarAnimationTask( | 3730 void LayerTreeHostImpl::PostDelayedScrollbarAnimationTask( |
| 3727 const base::Closure& task, | 3731 const base::Closure& task, |
| 3728 base::TimeDelta delay) { | 3732 base::TimeDelta delay) { |
| 3729 client_->PostDelayedAnimationTaskOnImplThread(task, delay); | 3733 client_->PostDelayedAnimationTaskOnImplThread(task, delay); |
| 3730 } | 3734 } |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4299 } | 4303 } |
| 4300 | 4304 |
| 4301 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { | 4305 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { |
| 4302 if (is_wheel_scroll) | 4306 if (is_wheel_scroll) |
| 4303 has_scrolled_by_wheel_ = true; | 4307 has_scrolled_by_wheel_ = true; |
| 4304 else | 4308 else |
| 4305 has_scrolled_by_touch_ = true; | 4309 has_scrolled_by_touch_ = true; |
| 4306 } | 4310 } |
| 4307 | 4311 |
| 4308 } // namespace cc | 4312 } // namespace cc |
| OLD | NEW |