OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include "cc/animation/animation_curve.h" | 7 #include "cc/animation/animation_curve.h" |
8 #include "cc/animation/layer_animation_controller.h" | 8 #include "cc/animation/layer_animation_controller.h" |
9 #include "cc/animation/scroll_offset_animation_curve.h" | 9 #include "cc/animation/scroll_offset_animation_curve.h" |
10 #include "cc/animation/timing_function.h" | 10 #include "cc/animation/timing_function.h" |
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 scroll_layer_impl->layer_animation_controller()->GetAnimation( | 1082 scroll_layer_impl->layer_animation_controller()->GetAnimation( |
1083 Animation::ScrollOffset); | 1083 Animation::ScrollOffset); |
1084 | 1084 |
1085 if (!animation || animation->run_state() != Animation::Running) { | 1085 if (!animation || animation->run_state() != Animation::Running) { |
1086 host_impl->BlockNotifyReadyToActivateForTesting(false); | 1086 host_impl->BlockNotifyReadyToActivateForTesting(false); |
1087 return; | 1087 return; |
1088 } | 1088 } |
1089 | 1089 |
1090 // Block activation until the running animation has a chance to produce a | 1090 // Block activation until the running animation has a chance to produce a |
1091 // scroll delta. | 1091 // scroll delta. |
1092 gfx::Vector2dF scroll_delta = scroll_layer_impl->ScrollDelta() - | 1092 gfx::Vector2dF scroll_delta = scroll_layer_impl->ScrollDelta(); |
1093 scroll_layer_impl->sent_scroll_delta(); | |
1094 if (scroll_delta.x() < 1.f || scroll_delta.y() < 1.f) | 1093 if (scroll_delta.x() < 1.f || scroll_delta.y() < 1.f) |
1095 return; | 1094 return; |
1096 | 1095 |
1097 host_impl->BlockNotifyReadyToActivateForTesting(false); | 1096 host_impl->BlockNotifyReadyToActivateForTesting(false); |
1098 } | 1097 } |
1099 | 1098 |
1100 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 1099 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
1101 LayerImpl* scroll_layer_impl = | 1100 LayerImpl* scroll_layer_impl = |
1102 host_impl->active_tree()->root_layer()->children()[0]; | 1101 host_impl->active_tree()->root_layer()->children()[0]; |
1103 if (scroll_layer_impl->layer_animation_controller()->GetAnimation( | 1102 if (scroll_layer_impl->layer_animation_controller()->GetAnimation( |
1104 Animation::ScrollOffset)) | 1103 Animation::ScrollOffset)) |
1105 return; | 1104 return; |
1106 | 1105 |
1107 EXPECT_EQ(final_postion_, scroll_layer_impl->TotalScrollOffset()); | 1106 EXPECT_EQ(final_postion_, scroll_layer_impl->CurrentScrollOffset()); |
1108 EndTest(); | 1107 EndTest(); |
1109 } | 1108 } |
1110 | 1109 |
1111 void AfterTest() override { | 1110 void AfterTest() override { |
1112 EXPECT_EQ(final_postion_, scroll_layer_->scroll_offset()); | 1111 EXPECT_EQ(final_postion_, scroll_layer_->scroll_offset()); |
1113 } | 1112 } |
1114 | 1113 |
1115 private: | 1114 private: |
1116 FakeContentLayerClient client_; | 1115 FakeContentLayerClient client_; |
1117 scoped_refptr<FakeContentLayer> scroll_layer_; | 1116 scoped_refptr<FakeContentLayer> scroll_layer_; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 private: | 1264 private: |
1266 scoped_refptr<Layer> content_; | 1265 scoped_refptr<Layer> content_; |
1267 int num_swap_buffers_; | 1266 int num_swap_buffers_; |
1268 }; | 1267 }; |
1269 | 1268 |
1270 SINGLE_AND_MULTI_THREAD_TEST_F( | 1269 SINGLE_AND_MULTI_THREAD_TEST_F( |
1271 LayerTreeHostAnimationTestAddAnimationAfterAnimating); | 1270 LayerTreeHostAnimationTestAddAnimationAfterAnimating); |
1272 | 1271 |
1273 } // namespace | 1272 } // namespace |
1274 } // namespace cc | 1273 } // namespace cc |
OLD | NEW |