| 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 2672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2683 // in input_handler_proxy instead. | 2683 // in input_handler_proxy instead. |
| 2684 wheel_scrolling_ = IsWheelBasedScroll(type); | 2684 wheel_scrolling_ = IsWheelBasedScroll(type); |
| 2685 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); | 2685 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); |
| 2686 // Invoke |DistributeScrollDelta| even with zero delta and velocity to ensure | 2686 // Invoke |DistributeScrollDelta| even with zero delta and velocity to ensure |
| 2687 // scroll customization callbacks are invoked. | 2687 // scroll customization callbacks are invoked. |
| 2688 DistributeScrollDelta(scroll_state); | 2688 DistributeScrollDelta(scroll_state); |
| 2689 | 2689 |
| 2690 client_->RenewTreePriority(); | 2690 client_->RenewTreePriority(); |
| 2691 RecordCompositorSlowScrollMetric(type, CC_THREAD); | 2691 RecordCompositorSlowScrollMetric(type, CC_THREAD); |
| 2692 | 2692 |
| 2693 UpdateScrollSourceInfo(wheel_scrolling_); |
| 2694 |
| 2693 return scroll_status; | 2695 return scroll_status; |
| 2694 } | 2696 } |
| 2695 | 2697 |
| 2696 InputHandler::ScrollStatus LayerTreeHostImpl::RootScrollBegin( | 2698 InputHandler::ScrollStatus LayerTreeHostImpl::RootScrollBegin( |
| 2697 ScrollState* scroll_state, | 2699 ScrollState* scroll_state, |
| 2698 InputHandler::ScrollInputType type) { | 2700 InputHandler::ScrollInputType type) { |
| 2699 TRACE_EVENT0("cc", "LayerTreeHostImpl::RootScrollBegin"); | 2701 TRACE_EVENT0("cc", "LayerTreeHostImpl::RootScrollBegin"); |
| 2700 | 2702 |
| 2701 ClearCurrentlyScrollingNode(); | 2703 ClearCurrentlyScrollingNode(); |
| 2702 | 2704 |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3479 CollectScrollDeltas(scroll_info.get(), active_tree_.get()); | 3481 CollectScrollDeltas(scroll_info.get(), active_tree_.get()); |
| 3480 CollectScrollbarUpdates(scroll_info.get(), &scrollbar_animation_controllers_); | 3482 CollectScrollbarUpdates(scroll_info.get(), &scrollbar_animation_controllers_); |
| 3481 scroll_info->page_scale_delta = | 3483 scroll_info->page_scale_delta = |
| 3482 active_tree_->page_scale_factor()->PullDeltaForMainThread(); | 3484 active_tree_->page_scale_factor()->PullDeltaForMainThread(); |
| 3483 scroll_info->top_controls_delta = | 3485 scroll_info->top_controls_delta = |
| 3484 active_tree()->top_controls_shown_ratio()->PullDeltaForMainThread(); | 3486 active_tree()->top_controls_shown_ratio()->PullDeltaForMainThread(); |
| 3485 scroll_info->elastic_overscroll_delta = | 3487 scroll_info->elastic_overscroll_delta = |
| 3486 active_tree_->elastic_overscroll()->PullDeltaForMainThread(); | 3488 active_tree_->elastic_overscroll()->PullDeltaForMainThread(); |
| 3487 scroll_info->swap_promises.swap(swap_promises_for_main_thread_scroll_update_); | 3489 scroll_info->swap_promises.swap(swap_promises_for_main_thread_scroll_update_); |
| 3488 | 3490 |
| 3491 // Record and reset scroll_source_info_; |
| 3492 scroll_info->scroll_source_info = scroll_source_info_; |
| 3493 scroll_source_info_ = ScrollSourceInfo::NONE; |
| 3494 |
| 3489 return scroll_info; | 3495 return scroll_info; |
| 3490 } | 3496 } |
| 3491 | 3497 |
| 3492 void LayerTreeHostImpl::SetFullViewportDamage() { | 3498 void LayerTreeHostImpl::SetFullViewportDamage() { |
| 3493 SetViewportDamage(gfx::Rect(DrawViewportSize())); | 3499 SetViewportDamage(gfx::Rect(DrawViewportSize())); |
| 3494 } | 3500 } |
| 3495 | 3501 |
| 3496 bool LayerTreeHostImpl::AnimatePageScale(base::TimeTicks monotonic_time) { | 3502 bool LayerTreeHostImpl::AnimatePageScale(base::TimeTicks monotonic_time) { |
| 3497 if (!page_scale_animation_) | 3503 if (!page_scale_animation_) |
| 3498 return false; | 3504 return false; |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4181 if (is_visible) { | 4187 if (is_visible) { |
| 4182 worker_context_visibility_ = | 4188 worker_context_visibility_ = |
| 4183 worker_context->CacheController()->ClientBecameVisible(); | 4189 worker_context->CacheController()->ClientBecameVisible(); |
| 4184 } else { | 4190 } else { |
| 4185 worker_context->CacheController()->ClientBecameNotVisible( | 4191 worker_context->CacheController()->ClientBecameNotVisible( |
| 4186 std::move(worker_context_visibility_)); | 4192 std::move(worker_context_visibility_)); |
| 4187 } | 4193 } |
| 4188 } | 4194 } |
| 4189 } | 4195 } |
| 4190 | 4196 |
| 4197 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { |
| 4198 switch (scroll_source_info_) { |
| 4199 case ScrollSourceInfo::NONE: |
| 4200 scroll_source_info_ = is_wheel_scroll |
| 4201 ? ScrollSourceInfo::SCROLLED_BY_WHEEL |
| 4202 : ScrollSourceInfo::SCROLLED_BY_TOUCH; |
| 4203 break; |
| 4204 case ScrollSourceInfo::SCROLLED_BY_TOUCH: |
| 4205 scroll_source_info_ = is_wheel_scroll |
| 4206 ? ScrollSourceInfo::SCROLLED_BY_TOUCH_AND_WHEEL |
| 4207 : ScrollSourceInfo::SCROLLED_BY_TOUCH; |
| 4208 break; |
| 4209 case ScrollSourceInfo::SCROLLED_BY_WHEEL: |
| 4210 scroll_source_info_ = is_wheel_scroll |
| 4211 ? ScrollSourceInfo::SCROLLED_BY_WHEEL |
| 4212 : ScrollSourceInfo::SCROLLED_BY_TOUCH_AND_WHEEL; |
| 4213 break; |
| 4214 case ScrollSourceInfo::SCROLLED_BY_TOUCH_AND_WHEEL: |
| 4215 break; |
| 4216 } |
| 4217 } |
| 4218 |
| 4191 } // namespace cc | 4219 } // namespace cc |
| OLD | NEW |