| 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 flags. |
| 3492 scroll_info->has_scrolled_by_wheel = has_scrolled_by_wheel_; |
| 3493 scroll_info->has_scrolled_by_touch = has_scrolled_by_touch_; |
| 3494 has_scrolled_by_wheel_ = has_scrolled_by_touch_ = false; |
| 3495 |
| 3489 return scroll_info; | 3496 return scroll_info; |
| 3490 } | 3497 } |
| 3491 | 3498 |
| 3492 void LayerTreeHostImpl::SetFullViewportDamage() { | 3499 void LayerTreeHostImpl::SetFullViewportDamage() { |
| 3493 SetViewportDamage(gfx::Rect(DrawViewportSize())); | 3500 SetViewportDamage(gfx::Rect(DrawViewportSize())); |
| 3494 } | 3501 } |
| 3495 | 3502 |
| 3496 bool LayerTreeHostImpl::AnimatePageScale(base::TimeTicks monotonic_time) { | 3503 bool LayerTreeHostImpl::AnimatePageScale(base::TimeTicks monotonic_time) { |
| 3497 if (!page_scale_animation_) | 3504 if (!page_scale_animation_) |
| 3498 return false; | 3505 return false; |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4181 if (is_visible) { | 4188 if (is_visible) { |
| 4182 worker_context_visibility_ = | 4189 worker_context_visibility_ = |
| 4183 worker_context->CacheController()->ClientBecameVisible(); | 4190 worker_context->CacheController()->ClientBecameVisible(); |
| 4184 } else { | 4191 } else { |
| 4185 worker_context->CacheController()->ClientBecameNotVisible( | 4192 worker_context->CacheController()->ClientBecameNotVisible( |
| 4186 std::move(worker_context_visibility_)); | 4193 std::move(worker_context_visibility_)); |
| 4187 } | 4194 } |
| 4188 } | 4195 } |
| 4189 } | 4196 } |
| 4190 | 4197 |
| 4198 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { |
| 4199 if (is_wheel_scroll) |
| 4200 has_scrolled_by_wheel_ = true; |
| 4201 else |
| 4202 has_scrolled_by_touch_ = true; |
| 4203 } |
| 4204 |
| 4191 } // namespace cc | 4205 } // namespace cc |
| OLD | NEW |