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 2920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2931 | 2931 |
2932 gfx::ScrollOffset current_offset = | 2932 gfx::ScrollOffset current_offset = |
2933 scroll_tree.current_scroll_offset(scroll_node->owning_layer_id); | 2933 scroll_tree.current_scroll_offset(scroll_node->owning_layer_id); |
2934 gfx::ScrollOffset target_offset = scroll_tree.ClampScrollOffsetToLimits( | 2934 gfx::ScrollOffset target_offset = scroll_tree.ClampScrollOffsetToLimits( |
2935 current_offset + gfx::ScrollOffset(delta), scroll_node); | 2935 current_offset + gfx::ScrollOffset(delta), scroll_node); |
2936 DCHECK_EQ( | 2936 DCHECK_EQ( |
2937 ElementId( | 2937 ElementId( |
2938 active_tree()->LayerById(scroll_node->owning_layer_id)->element_id()), | 2938 active_tree()->LayerById(scroll_node->owning_layer_id)->element_id()), |
2939 scroll_node->element_id); | 2939 scroll_node->element_id); |
2940 | 2940 |
| 2941 // Start the animation one full frame in. Without any offset, the animation |
| 2942 // doesn't start until next frame, increasing latency, and preventing our |
| 2943 // input latency tracking architecture from working. |
| 2944 base::TimeDelta animation_start_offset = CurrentBeginFrameArgs().interval; |
| 2945 |
2941 mutator_host_->ImplOnlyScrollAnimationCreate( | 2946 mutator_host_->ImplOnlyScrollAnimationCreate( |
2942 scroll_node->element_id, target_offset, current_offset, delayed_by); | 2947 scroll_node->element_id, target_offset, current_offset, delayed_by, |
| 2948 animation_start_offset); |
2943 | 2949 |
2944 SetNeedsOneBeginImplFrame(); | 2950 SetNeedsOneBeginImplFrame(); |
2945 | 2951 |
2946 return true; | 2952 return true; |
2947 } | 2953 } |
2948 | 2954 |
2949 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated( | 2955 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated( |
2950 const gfx::Point& viewport_point, | 2956 const gfx::Point& viewport_point, |
2951 const gfx::Vector2dF& scroll_delta, | 2957 const gfx::Vector2dF& scroll_delta, |
2952 base::TimeDelta delayed_by) { | 2958 base::TimeDelta delayed_by) { |
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4303 | 4309 |
4304 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { | 4310 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { |
4305 if (!element_id) | 4311 if (!element_id) |
4306 return; | 4312 return; |
4307 if (ScrollbarAnimationController* animation_controller = | 4313 if (ScrollbarAnimationController* animation_controller = |
4308 ScrollbarAnimationControllerForElementId(element_id)) | 4314 ScrollbarAnimationControllerForElementId(element_id)) |
4309 animation_controller->DidScrollUpdate(); | 4315 animation_controller->DidScrollUpdate(); |
4310 } | 4316 } |
4311 | 4317 |
4312 } // namespace cc | 4318 } // namespace cc |
OLD | NEW |