| 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 2530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2541 const gfx::PointF& device_viewport_point, | 2541 const gfx::PointF& device_viewport_point, |
| 2542 InputHandler::ScrollInputType type, | 2542 InputHandler::ScrollInputType type, |
| 2543 LayerImpl* layer_impl, | 2543 LayerImpl* layer_impl, |
| 2544 bool* scroll_on_main_thread, | 2544 bool* scroll_on_main_thread, |
| 2545 uint32_t* main_thread_scrolling_reasons) const { | 2545 uint32_t* main_thread_scrolling_reasons) const { |
| 2546 DCHECK(scroll_on_main_thread); | 2546 DCHECK(scroll_on_main_thread); |
| 2547 DCHECK(main_thread_scrolling_reasons); | 2547 DCHECK(main_thread_scrolling_reasons); |
| 2548 *main_thread_scrolling_reasons = | 2548 *main_thread_scrolling_reasons = |
| 2549 MainThreadScrollingReason::kNotScrollingOnMain; | 2549 MainThreadScrollingReason::kNotScrollingOnMain; |
| 2550 | 2550 |
| 2551 // Falling back to the root scroll layer ensures generation of root overscroll |
| 2552 // notifications. The inner viewport layer represents the viewport during |
| 2553 // scrolling. |
| 2554 if (!layer_impl) |
| 2555 layer_impl = InnerViewportScrollLayer(); |
| 2556 |
| 2551 // Walk up the hierarchy and look for a scrollable layer. | 2557 // Walk up the hierarchy and look for a scrollable layer. |
| 2552 LayerImpl* potentially_scrolling_layer_impl = NULL; | 2558 LayerImpl* potentially_scrolling_layer_impl = NULL; |
| 2553 if (layer_impl) { | 2559 if (layer_impl) { |
| 2554 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; | 2560 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; |
| 2555 ScrollNode* scroll_node = scroll_tree.Node(layer_impl->scroll_tree_index()); | 2561 ScrollNode* scroll_node = scroll_tree.Node(layer_impl->scroll_tree_index()); |
| 2556 for (; scroll_tree.parent(scroll_node); | 2562 for (; scroll_tree.parent(scroll_node); |
| 2557 scroll_node = scroll_tree.parent(scroll_node)) { | 2563 scroll_node = scroll_tree.parent(scroll_node)) { |
| 2558 // The content layer can also block attempts to scroll outside the main | 2564 // The content layer can also block attempts to scroll outside the main |
| 2559 // thread. | 2565 // thread. |
| 2560 ScrollStatus status = | 2566 ScrollStatus status = |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2573 return NULL; | 2579 return NULL; |
| 2574 } | 2580 } |
| 2575 | 2581 |
| 2576 if (status.thread == InputHandler::SCROLL_ON_IMPL_THREAD && | 2582 if (status.thread == InputHandler::SCROLL_ON_IMPL_THREAD && |
| 2577 !potentially_scrolling_layer_impl) { | 2583 !potentially_scrolling_layer_impl) { |
| 2578 potentially_scrolling_layer_impl = | 2584 potentially_scrolling_layer_impl = |
| 2579 active_tree_->LayerById(scroll_node->owner_id); | 2585 active_tree_->LayerById(scroll_node->owner_id); |
| 2580 } | 2586 } |
| 2581 } | 2587 } |
| 2582 } | 2588 } |
| 2583 // Falling back to the root scroll layer ensures generation of root overscroll | |
| 2584 // notifications while preventing scroll updates from being unintentionally | |
| 2585 // forwarded to the main thread. The inner viewport layer represents the | |
| 2586 // viewport during scrolling. | |
| 2587 if (!potentially_scrolling_layer_impl) | |
| 2588 potentially_scrolling_layer_impl = InnerViewportScrollLayer(); | |
| 2589 | 2589 |
| 2590 // The inner viewport layer represents the viewport. | 2590 // The inner viewport layer represents the viewport. |
| 2591 if (potentially_scrolling_layer_impl == OuterViewportScrollLayer()) | 2591 if (potentially_scrolling_layer_impl == OuterViewportScrollLayer()) |
| 2592 potentially_scrolling_layer_impl = InnerViewportScrollLayer(); | 2592 potentially_scrolling_layer_impl = InnerViewportScrollLayer(); |
| 2593 | 2593 |
| 2594 return potentially_scrolling_layer_impl; | 2594 return potentially_scrolling_layer_impl; |
| 2595 } | 2595 } |
| 2596 | 2596 |
| 2597 // Similar to LayerImpl::HasAncestor, but walks up the scroll parents. | 2597 // Similar to LayerImpl::HasAncestor, but walks up the scroll parents. |
| 2598 static bool HasScrollAncestor(LayerImpl* child, LayerImpl* scroll_ancestor) { | 2598 static bool HasScrollAncestor(LayerImpl* child, LayerImpl* scroll_ancestor) { |
| (...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4008 return task_runner_provider_->HasImplThread(); | 4008 return task_runner_provider_->HasImplThread(); |
| 4009 } | 4009 } |
| 4010 | 4010 |
| 4011 bool LayerTreeHostImpl::CommitToActiveTree() const { | 4011 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 4012 // In single threaded mode we skip the pending tree and commit directly to the | 4012 // In single threaded mode we skip the pending tree and commit directly to the |
| 4013 // active tree. | 4013 // active tree. |
| 4014 return !task_runner_provider_->HasImplThread(); | 4014 return !task_runner_provider_->HasImplThread(); |
| 4015 } | 4015 } |
| 4016 | 4016 |
| 4017 } // namespace cc | 4017 } // namespace cc |
| OLD | NEW |