| 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 3419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3430 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { | 3430 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
| 3431 gfx::PointF device_viewport_point = gfx::ScalePoint( | 3431 gfx::PointF device_viewport_point = gfx::ScalePoint( |
| 3432 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | 3432 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); |
| 3433 LayerImpl* layer_impl = | 3433 LayerImpl* layer_impl = |
| 3434 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | 3434 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); |
| 3435 | 3435 |
| 3436 // Check if mouse is over a scrollbar or not. | 3436 // Check if mouse is over a scrollbar or not. |
| 3437 // TODO(sahel): get rid of this extera checking when | 3437 // TODO(sahel): get rid of this extera checking when |
| 3438 // FindScrollNodeForDeviceViewportPoint finds the proper node for scrolling on | 3438 // FindScrollNodeForDeviceViewportPoint finds the proper node for scrolling on |
| 3439 // the main thread when the mouse is over a scrollbar as well. | 3439 // the main thread when the mouse is over a scrollbar as well. |
| 3440 ElementId scroll_element_id; | 3440 ElementId scroll_element_id = 0; |
| 3441 if (layer_impl && layer_impl->ToScrollbarLayer()) | 3441 if (layer_impl && layer_impl->ToScrollbarLayer()) |
| 3442 scroll_element_id = layer_impl->ToScrollbarLayer()->scroll_element_id(); | 3442 scroll_element_id = layer_impl->ToScrollbarLayer()->scroll_element_id(); |
| 3443 if (!scroll_element_id) { | 3443 if (!scroll_element_id) { |
| 3444 bool scroll_on_main_thread = false; | 3444 bool scroll_on_main_thread = false; |
| 3445 uint32_t main_thread_scrolling_reasons; | 3445 uint32_t main_thread_scrolling_reasons; |
| 3446 auto* scroll_node = FindScrollNodeForDeviceViewportPoint( | 3446 auto* scroll_node = FindScrollNodeForDeviceViewportPoint( |
| 3447 device_viewport_point, InputHandler::TOUCHSCREEN, layer_impl, | 3447 device_viewport_point, InputHandler::TOUCHSCREEN, layer_impl, |
| 3448 &scroll_on_main_thread, &main_thread_scrolling_reasons); | 3448 &scroll_on_main_thread, &main_thread_scrolling_reasons); |
| 3449 if (scroll_node) | 3449 if (scroll_node) |
| 3450 scroll_element_id = scroll_node->element_id; | 3450 scroll_element_id = scroll_node->element_id; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3539 ? tree_impl->InnerViewportScrollLayer()->id() | 3539 ? tree_impl->InnerViewportScrollLayer()->id() |
| 3540 : Layer::INVALID_ID; | 3540 : Layer::INVALID_ID; |
| 3541 | 3541 |
| 3542 tree_impl->property_trees()->scroll_tree.CollectScrollDeltas( | 3542 tree_impl->property_trees()->scroll_tree.CollectScrollDeltas( |
| 3543 scroll_info, inner_viewport_layer_id); | 3543 scroll_info, inner_viewport_layer_id); |
| 3544 } | 3544 } |
| 3545 | 3545 |
| 3546 static void CollectScrollbarUpdates( | 3546 static void CollectScrollbarUpdates( |
| 3547 ScrollAndScaleSet* scroll_info, | 3547 ScrollAndScaleSet* scroll_info, |
| 3548 std::unordered_map<ElementId, | 3548 std::unordered_map<ElementId, |
| 3549 std::unique_ptr<ScrollbarAnimationController>, | 3549 std::unique_ptr<ScrollbarAnimationController>>* |
| 3550 ElementIdHash>* controllers) { | 3550 controllers) { |
| 3551 scroll_info->scrollbars.reserve(controllers->size()); | 3551 scroll_info->scrollbars.reserve(controllers->size()); |
| 3552 for (auto& pair : *controllers) { | 3552 for (auto& pair : *controllers) { |
| 3553 scroll_info->scrollbars.push_back(LayerTreeHostCommon::ScrollbarsUpdateInfo( | 3553 scroll_info->scrollbars.push_back(LayerTreeHostCommon::ScrollbarsUpdateInfo( |
| 3554 pair.first, pair.second->ScrollbarsHidden())); | 3554 pair.first, pair.second->ScrollbarsHidden())); |
| 3555 } | 3555 } |
| 3556 } | 3556 } |
| 3557 | 3557 |
| 3558 std::unique_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { | 3558 std::unique_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { |
| 3559 std::unique_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); | 3559 std::unique_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); |
| 3560 | 3560 |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4301 | 4301 |
| 4302 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { | 4302 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { |
| 4303 if (!element_id) | 4303 if (!element_id) |
| 4304 return; | 4304 return; |
| 4305 if (ScrollbarAnimationController* animation_controller = | 4305 if (ScrollbarAnimationController* animation_controller = |
| 4306 ScrollbarAnimationControllerForElementId(element_id)) | 4306 ScrollbarAnimationControllerForElementId(element_id)) |
| 4307 animation_controller->DidScrollUpdate(); | 4307 animation_controller->DidScrollUpdate(); |
| 4308 } | 4308 } |
| 4309 | 4309 |
| 4310 } // namespace cc | 4310 } // namespace cc |
| OLD | NEW |