| 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.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 3260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3271 size_t expected_push_properties_grandchild3_; | 3271 size_t expected_push_properties_grandchild3_; |
| 3272 }; | 3272 }; |
| 3273 | 3273 |
| 3274 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush | 3274 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush |
| 3275 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3275 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3276 protected: | 3276 protected: |
| 3277 void DidCommitAndDrawFrame() override { | 3277 void DidCommitAndDrawFrame() override { |
| 3278 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3278 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3279 switch (last_source_frame_number) { | 3279 switch (last_source_frame_number) { |
| 3280 case 0: | 3280 case 0: |
| 3281 // All layers except root will need push properties as they are added |
| 3282 // as a child to some other layer which changes their stacking order. |
| 3281 EXPECT_FALSE(root_->needs_push_properties()); | 3283 EXPECT_FALSE(root_->needs_push_properties()); |
| 3282 EXPECT_FALSE(root_->descendant_needs_push_properties()); | |
| 3283 EXPECT_FALSE(child_->needs_push_properties()); | |
| 3284 EXPECT_FALSE(child_->descendant_needs_push_properties()); | |
| 3285 EXPECT_FALSE(grandchild1_->needs_push_properties()); | |
| 3286 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | |
| 3287 EXPECT_FALSE(grandchild2_->needs_push_properties()); | |
| 3288 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | |
| 3289 EXPECT_FALSE(grandchild3_->needs_push_properties()); | |
| 3290 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | |
| 3291 | |
| 3292 layer_tree_host()->SetRootLayer(root_); | |
| 3293 | |
| 3294 EXPECT_TRUE(root_->needs_push_properties()); | |
| 3295 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3284 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3296 EXPECT_TRUE(child_->needs_push_properties()); | 3285 EXPECT_TRUE(child_->needs_push_properties()); |
| 3297 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3286 EXPECT_TRUE(child_->descendant_needs_push_properties()); |
| 3298 EXPECT_TRUE(grandchild1_->needs_push_properties()); | 3287 EXPECT_TRUE(grandchild1_->needs_push_properties()); |
| 3299 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3288 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); |
| 3300 EXPECT_TRUE(grandchild2_->needs_push_properties()); | 3289 EXPECT_TRUE(grandchild2_->needs_push_properties()); |
| 3301 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3290 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); |
| 3302 EXPECT_TRUE(grandchild3_->needs_push_properties()); | 3291 EXPECT_TRUE(grandchild3_->needs_push_properties()); |
| 3303 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3292 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); |
| 3293 |
| 3294 layer_tree_host()->SetRootLayer(root_); |
| 3295 |
| 3296 // Now, even the root will need to push properties. |
| 3297 EXPECT_TRUE(root_->needs_push_properties()); |
| 3298 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3304 break; | 3299 break; |
| 3305 case 1: | 3300 case 1: |
| 3306 EndTest(); | 3301 EndTest(); |
| 3307 break; | 3302 break; |
| 3308 } | 3303 } |
| 3309 } | 3304 } |
| 3310 }; | 3305 }; |
| 3311 | 3306 |
| 3312 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); | 3307 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); |
| 3313 | 3308 |
| (...skipping 3293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6607 EndTest(); | 6602 EndTest(); |
| 6608 } | 6603 } |
| 6609 | 6604 |
| 6610 void AfterTest() override {} | 6605 void AfterTest() override {} |
| 6611 }; | 6606 }; |
| 6612 | 6607 |
| 6613 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); | 6608 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); |
| 6614 | 6609 |
| 6615 } // namespace | 6610 } // namespace |
| 6616 } // namespace cc | 6611 } // namespace cc |
| OLD | NEW |