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 <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 2455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2466 return ScrollIgnored; | 2466 return ScrollIgnored; |
2467 | 2467 |
2468 ScrollOffsetAnimationCurve* curve = | 2468 ScrollOffsetAnimationCurve* curve = |
2469 animation->curve()->ToScrollOffsetAnimationCurve(); | 2469 animation->curve()->ToScrollOffsetAnimationCurve(); |
2470 | 2470 |
2471 gfx::ScrollOffset new_target = | 2471 gfx::ScrollOffset new_target = |
2472 gfx::ScrollOffsetWithDelta(curve->target_value(), scroll_delta); | 2472 gfx::ScrollOffsetWithDelta(curve->target_value(), scroll_delta); |
2473 new_target.SetToMax(gfx::ScrollOffset()); | 2473 new_target.SetToMax(gfx::ScrollOffset()); |
2474 new_target.SetToMin(layer_impl->MaxScrollOffset()); | 2474 new_target.SetToMin(layer_impl->MaxScrollOffset()); |
2475 | 2475 |
2476 curve->UpdateTarget(animation->TrimTimeToCurrentIteration( | 2476 curve->UpdateTarget( |
2477 CurrentBeginFrameArgs().frame_time), | 2477 animation->TrimTimeToCurrentIteration( |
2478 new_target); | 2478 CurrentBeginFrameArgs().frame_time).InSecondsF(), |
| 2479 new_target); |
2479 | 2480 |
2480 return ScrollStarted; | 2481 return ScrollStarted; |
2481 } | 2482 } |
2482 // ScrollAnimated is only used for wheel scrolls. We use the same bubbling | 2483 // ScrollAnimated is only used for wheel scrolls. We use the same bubbling |
2483 // behavior as ScrollBy to determine which layer to animate, but we do not | 2484 // behavior as ScrollBy to determine which layer to animate, but we do not |
2484 // do the Android-specific things in ScrollBy like showing top controls. | 2485 // do the Android-specific things in ScrollBy like showing top controls. |
2485 InputHandler::ScrollStatus scroll_status = ScrollBegin(viewport_point, Wheel); | 2486 InputHandler::ScrollStatus scroll_status = ScrollBegin(viewport_point, Wheel); |
2486 if (scroll_status == ScrollStarted) { | 2487 if (scroll_status == ScrollStarted) { |
2487 gfx::Vector2dF pending_delta = scroll_delta; | 2488 gfx::Vector2dF pending_delta = scroll_delta; |
2488 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl; | 2489 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl; |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3520 } | 3521 } |
3521 | 3522 |
3522 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3523 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3523 std::vector<PictureLayerImpl*>::iterator it = | 3524 std::vector<PictureLayerImpl*>::iterator it = |
3524 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3525 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3525 DCHECK(it != picture_layers_.end()); | 3526 DCHECK(it != picture_layers_.end()); |
3526 picture_layers_.erase(it); | 3527 picture_layers_.erase(it); |
3527 } | 3528 } |
3528 | 3529 |
3529 } // namespace cc | 3530 } // namespace cc |
OLD | NEW |