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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 child->layer_animation_controller(); | 923 child->layer_animation_controller(); |
924 Animation* animation = controller_impl->GetAnimation(Animation::TRANSFORM); | 924 Animation* animation = controller_impl->GetAnimation(Animation::TRANSFORM); |
925 | 925 |
926 // The animation should be starting for the first frame. | 926 // The animation should be starting for the first frame. |
927 EXPECT_EQ(Animation::STARTING, animation->run_state()); | 927 EXPECT_EQ(Animation::STARTING, animation->run_state()); |
928 | 928 |
929 // And the transform should be propogated to the sync tree layer, at its | 929 // And the transform should be propogated to the sync tree layer, at its |
930 // starting state which is 6,7. | 930 // starting state which is 6,7. |
931 gfx::Transform expected_transform; | 931 gfx::Transform expected_transform; |
932 expected_transform.Translate(6.0, 7.0); | 932 expected_transform.Translate(6.0, 7.0); |
933 EXPECT_EQ(expected_transform, child->draw_transform()); | 933 EXPECT_EQ(expected_transform, child->DrawTransform()); |
934 // And the sync tree layer should know it is animating. | 934 // And the sync tree layer should know it is animating. |
935 EXPECT_TRUE(child->screen_space_transform_is_animating()); | 935 EXPECT_TRUE(child->screen_space_transform_is_animating()); |
936 | 936 |
937 controller_impl->AbortAnimations(Animation::TRANSFORM); | 937 controller_impl->AbortAnimations(Animation::TRANSFORM); |
938 EndTest(); | 938 EndTest(); |
939 } | 939 } |
940 | 940 |
941 void AfterTest() override {} | 941 void AfterTest() override {} |
942 | 942 |
943 FakeContentLayerClient client_; | 943 FakeContentLayerClient client_; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 break; | 1104 break; |
1105 case 1: | 1105 case 1: |
1106 // Animation is started. | 1106 // Animation is started. |
1107 EXPECT_TRUE(child->screen_space_transform_is_animating()); | 1107 EXPECT_TRUE(child->screen_space_transform_is_animating()); |
1108 break; | 1108 break; |
1109 case 2: { | 1109 case 2: { |
1110 // The animation is removed, the transform that was set afterward is | 1110 // The animation is removed, the transform that was set afterward is |
1111 // applied. | 1111 // applied. |
1112 gfx::Transform expected_transform; | 1112 gfx::Transform expected_transform; |
1113 expected_transform.Translate(10.f, 10.f); | 1113 expected_transform.Translate(10.f, 10.f); |
1114 EXPECT_EQ(expected_transform, child->draw_transform()); | 1114 EXPECT_EQ(expected_transform, child->DrawTransform()); |
1115 EXPECT_FALSE(child->screen_space_transform_is_animating()); | 1115 EXPECT_FALSE(child->screen_space_transform_is_animating()); |
1116 EndTest(); | 1116 EndTest(); |
1117 break; | 1117 break; |
1118 } | 1118 } |
1119 default: | 1119 default: |
1120 NOTREACHED(); | 1120 NOTREACHED(); |
1121 } | 1121 } |
1122 } | 1122 } |
1123 | 1123 |
1124 void AfterTest() override {} | 1124 void AfterTest() override {} |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 1243 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
1244 switch (host_impl->sync_tree()->source_frame_number()) { | 1244 switch (host_impl->sync_tree()->source_frame_number()) { |
1245 case 1: | 1245 case 1: |
1246 PostSetNeedsCommitToMainThread(); | 1246 PostSetNeedsCommitToMainThread(); |
1247 break; | 1247 break; |
1248 case 2: | 1248 case 2: |
1249 gfx::Transform expected_transform; | 1249 gfx::Transform expected_transform; |
1250 expected_transform.Translate(5.f, 5.f); | 1250 expected_transform.Translate(5.f, 5.f); |
1251 LayerImpl* layer_impl = | 1251 LayerImpl* layer_impl = |
1252 host_impl->sync_tree()->root_layer()->children()[0].get(); | 1252 host_impl->sync_tree()->root_layer()->children()[0].get(); |
1253 EXPECT_EQ(expected_transform, layer_impl->draw_transform()); | 1253 EXPECT_EQ(expected_transform, layer_impl->DrawTransform()); |
1254 EndTest(); | 1254 EndTest(); |
1255 break; | 1255 break; |
1256 } | 1256 } |
1257 } | 1257 } |
1258 | 1258 |
1259 void UpdateAnimationState(LayerTreeHostImpl* host_impl, | 1259 void UpdateAnimationState(LayerTreeHostImpl* host_impl, |
1260 bool has_unfinished_animation) override { | 1260 bool has_unfinished_animation) override { |
1261 if (host_impl->active_tree()->source_frame_number() == 1 && | 1261 if (host_impl->active_tree()->source_frame_number() == 1 && |
1262 !has_unfinished_animation && !signalled_) { | 1262 !has_unfinished_animation && !signalled_) { |
1263 // The animation has finished, so allow the main thread to commit. | 1263 // The animation has finished, so allow the main thread to commit. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1324 bool called_animation_finished_; | 1324 bool called_animation_finished_; |
1325 FakeContentLayerClient client_; | 1325 FakeContentLayerClient client_; |
1326 scoped_refptr<FakePictureLayer> picture_; | 1326 scoped_refptr<FakePictureLayer> picture_; |
1327 }; | 1327 }; |
1328 | 1328 |
1329 SINGLE_AND_MULTI_THREAD_TEST_F( | 1329 SINGLE_AND_MULTI_THREAD_TEST_F( |
1330 LayerTreeHostAnimationTestNotifyAnimationFinished); | 1330 LayerTreeHostAnimationTestNotifyAnimationFinished); |
1331 | 1331 |
1332 } // namespace | 1332 } // namespace |
1333 } // namespace cc | 1333 } // namespace cc |
OLD | NEW |