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 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 if (scroll_delta.x() < 1.f || scroll_delta.y() < 1.f) | 1093 if (scroll_delta.x() < 1.f || scroll_delta.y() < 1.f) |
1094 return; | 1094 return; |
1095 | 1095 |
1096 host_impl->BlockNotifyReadyToActivateForTesting(false); | 1096 host_impl->BlockNotifyReadyToActivateForTesting(false); |
1097 } | 1097 } |
1098 | 1098 |
| 1099 void WillActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
| 1100 if (!host_impl->settings().impl_side_painting) |
| 1101 return; |
| 1102 if (host_impl->pending_tree()->source_frame_number() != 1) |
| 1103 return; |
| 1104 LayerImpl* scroll_layer_impl = |
| 1105 host_impl->pending_tree()->root_layer()->children()[0]; |
| 1106 EXPECT_EQ(final_postion_, scroll_layer_impl->CurrentScrollOffset()); |
| 1107 } |
| 1108 |
1099 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 1109 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
| 1110 if (host_impl->active_tree()->source_frame_number() != 1) |
| 1111 return; |
1100 LayerImpl* scroll_layer_impl = | 1112 LayerImpl* scroll_layer_impl = |
1101 host_impl->active_tree()->root_layer()->children()[0]; | 1113 host_impl->active_tree()->root_layer()->children()[0]; |
1102 if (scroll_layer_impl->layer_animation_controller()->GetAnimation( | |
1103 Animation::ScrollOffset)) | |
1104 return; | |
1105 | |
1106 EXPECT_EQ(final_postion_, scroll_layer_impl->CurrentScrollOffset()); | 1114 EXPECT_EQ(final_postion_, scroll_layer_impl->CurrentScrollOffset()); |
1107 EndTest(); | 1115 EndTest(); |
1108 } | 1116 } |
1109 | 1117 |
1110 void AfterTest() override { | 1118 void AfterTest() override { |
1111 EXPECT_EQ(final_postion_, scroll_layer_->scroll_offset()); | 1119 EXPECT_EQ(final_postion_, scroll_layer_->scroll_offset()); |
1112 } | 1120 } |
1113 | 1121 |
1114 private: | 1122 private: |
1115 FakeContentLayerClient client_; | 1123 FakeContentLayerClient client_; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 private: | 1272 private: |
1265 scoped_refptr<Layer> content_; | 1273 scoped_refptr<Layer> content_; |
1266 int num_swap_buffers_; | 1274 int num_swap_buffers_; |
1267 }; | 1275 }; |
1268 | 1276 |
1269 SINGLE_AND_MULTI_THREAD_TEST_F( | 1277 SINGLE_AND_MULTI_THREAD_TEST_F( |
1270 LayerTreeHostAnimationTestAddAnimationAfterAnimating); | 1278 LayerTreeHostAnimationTestAddAnimationAfterAnimating); |
1271 | 1279 |
1272 } // namespace | 1280 } // namespace |
1273 } // namespace cc | 1281 } // namespace cc |
OLD | NEW |