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 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2459 return ScrollIgnored; | 2459 return ScrollIgnored; |
2460 | 2460 |
2461 ScrollOffsetAnimationCurve* curve = | 2461 ScrollOffsetAnimationCurve* curve = |
2462 animation->curve()->ToScrollOffsetAnimationCurve(); | 2462 animation->curve()->ToScrollOffsetAnimationCurve(); |
2463 | 2463 |
2464 gfx::ScrollOffset new_target = | 2464 gfx::ScrollOffset new_target = |
2465 gfx::ScrollOffsetWithDelta(curve->target_value(), scroll_delta); | 2465 gfx::ScrollOffsetWithDelta(curve->target_value(), scroll_delta); |
2466 new_target.SetToMax(gfx::ScrollOffset()); | 2466 new_target.SetToMax(gfx::ScrollOffset()); |
2467 new_target.SetToMin(layer_impl->MaxScrollOffset()); | 2467 new_target.SetToMin(layer_impl->MaxScrollOffset()); |
2468 | 2468 |
2469 curve->UpdateTarget(animation->TrimTimeToCurrentIteration( | 2469 curve->UpdateTarget( |
2470 CurrentBeginFrameArgs().frame_time), | 2470 animation->TrimTimeToCurrentIteration( |
2471 new_target); | 2471 CurrentBeginFrameArgs().frame_time).InSecondsF(), |
| 2472 new_target); |
2472 | 2473 |
2473 return ScrollStarted; | 2474 return ScrollStarted; |
2474 } | 2475 } |
2475 // ScrollAnimated is only used for wheel scrolls. We use the same bubbling | 2476 // ScrollAnimated is only used for wheel scrolls. We use the same bubbling |
2476 // behavior as ScrollBy to determine which layer to animate, but we do not | 2477 // behavior as ScrollBy to determine which layer to animate, but we do not |
2477 // do the Android-specific things in ScrollBy like showing top controls. | 2478 // do the Android-specific things in ScrollBy like showing top controls. |
2478 InputHandler::ScrollStatus scroll_status = ScrollBegin(viewport_point, Wheel); | 2479 InputHandler::ScrollStatus scroll_status = ScrollBegin(viewport_point, Wheel); |
2479 if (scroll_status == ScrollStarted) { | 2480 if (scroll_status == ScrollStarted) { |
2480 gfx::Vector2dF pending_delta = scroll_delta; | 2481 gfx::Vector2dF pending_delta = scroll_delta; |
2481 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl; | 2482 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl; |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3516 } | 3517 } |
3517 | 3518 |
3518 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3519 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3519 std::vector<PictureLayerImpl*>::iterator it = | 3520 std::vector<PictureLayerImpl*>::iterator it = |
3520 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3521 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3521 DCHECK(it != picture_layers_.end()); | 3522 DCHECK(it != picture_layers_.end()); |
3522 picture_layers_.erase(it); | 3523 picture_layers_.erase(it); |
3523 } | 3524 } |
3524 | 3525 |
3525 } // namespace cc | 3526 } // namespace cc |
OLD | NEW |