| Index: cc/trees/layer_tree_host_unittest.cc
|
| diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
|
| index bd303e3fae4189621c7725d230ce2f3273fd2fce..a6facc6b8484cdc072c06e7cbd0156b81c0ac8c5 100644
|
| --- a/cc/trees/layer_tree_host_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_unittest.cc
|
| @@ -1774,16 +1774,13 @@ class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers
|
| // Device scale factor should come over to impl.
|
| EXPECT_NEAR(impl->active_tree()->device_scale_factor(), 1.5f, 0.00001f);
|
|
|
| - // Both layers are on impl.
|
| - ASSERT_EQ(1u, impl->active_tree()->root_layer()->children().size());
|
| -
|
| // Device viewport is scaled.
|
| EXPECT_EQ(gfx::Size(60, 60), impl->DrawViewportSize());
|
|
|
| FakePictureLayerImpl* root =
|
| static_cast<FakePictureLayerImpl*>(impl->active_tree()->root_layer());
|
| FakePictureLayerImpl* child = static_cast<FakePictureLayerImpl*>(
|
| - impl->active_tree()->root_layer()->children()[0]);
|
| + impl->active_tree()->LayerById(child_layer_->id()));
|
|
|
| // Positions remain in layout pixels.
|
| EXPECT_EQ(gfx::PointF(), root->position());
|
| @@ -2871,90 +2868,84 @@ class LayerTreeHostTestImplLayersPushProperties
|
| ++expected_push_properties_grandchild2_impl_;
|
| break;
|
| case 6:
|
| - // First child is removed. Structure of the tree changes here so swap
|
| - // some of the values. child_impl becomes child2_impl.
|
| - expected_push_properties_child_impl_ =
|
| - expected_push_properties_child2_impl_;
|
| - expected_push_properties_child2_impl_ = 0;
|
| - // grandchild_impl becomes grandchild2_impl.
|
| - expected_push_properties_grandchild_impl_ =
|
| - expected_push_properties_grandchild2_impl_;
|
| - expected_push_properties_grandchild2_impl_ = 0;
|
| + // First child is removed. Structure of the tree changes.
|
| + expected_push_properties_child_impl_ = 0;
|
| + expected_push_properties_grandchild_impl_ = 0;
|
|
|
| - // grandchild_impl is now the leaf that always pushes. It is pushed.
|
| - ++expected_push_properties_grandchild_impl_;
|
| + // The leaf that always pushes is pushed.
|
| + ++expected_push_properties_grandchild2_impl_;
|
| break;
|
| case 7:
|
| // The leaf that always pushes is pushed.
|
| - ++expected_push_properties_grandchild_impl_;
|
| + ++expected_push_properties_grandchild2_impl_;
|
|
|
| // Child is added back. New layers are initialized.
|
| - ++expected_push_properties_grandchild2_impl_;
|
| - ++expected_push_properties_child2_impl_;
|
| + ++expected_push_properties_grandchild_impl_;
|
| + ++expected_push_properties_child_impl_;
|
| break;
|
| case 8:
|
| // Leaf is removed.
|
| - expected_push_properties_grandchild2_impl_ = 0;
|
| + expected_push_properties_grandchild_impl_ = 0;
|
|
|
| // Always pushing.
|
| - ++expected_push_properties_grandchild_impl_;
|
| + ++expected_push_properties_grandchild2_impl_;
|
| break;
|
| case 9:
|
| // Leaf is added back
|
| - ++expected_push_properties_grandchild2_impl_;
|
| + ++expected_push_properties_grandchild_impl_;
|
|
|
| // The leaf that always pushes is pushed.
|
| - ++expected_push_properties_grandchild_impl_;
|
| + ++expected_push_properties_grandchild2_impl_;
|
| break;
|
| case 10:
|
| // The leaf that always pushes is pushed.
|
| - ++expected_push_properties_grandchild_impl_;
|
| + ++expected_push_properties_grandchild2_impl_;
|
| break;
|
| case 11:
|
| // The leaf that always pushes is pushed.
|
| - ++expected_push_properties_grandchild_impl_;
|
| + ++expected_push_properties_grandchild2_impl_;
|
| break;
|
| case 12:
|
| // The leaf that always pushes is pushed.
|
| - ++expected_push_properties_grandchild_impl_;
|
| + ++expected_push_properties_grandchild2_impl_;
|
|
|
| // This child position was changed. So the subtree needs to push
|
| // properties.
|
| - ++expected_push_properties_child2_impl_;
|
| - ++expected_push_properties_grandchild2_impl_;
|
| + ++expected_push_properties_child_impl_;
|
| + ++expected_push_properties_grandchild_impl_;
|
| break;
|
| case 13:
|
| // The position of this child was changed.
|
| - ++expected_push_properties_child_impl_;
|
| + ++expected_push_properties_child2_impl_;
|
|
|
| // The leaf that always pushes is pushed.
|
| - ++expected_push_properties_grandchild_impl_;
|
| + ++expected_push_properties_grandchild2_impl_;
|
| break;
|
| case 14:
|
| // Second child is removed from tree. Don't discard counts because
|
| // they are added back before commit.
|
|
|
| // The leaf that always pushes is pushed.
|
| - ++expected_push_properties_grandchild_impl_;
|
| + ++expected_push_properties_grandchild2_impl_;
|
|
|
| // Second child added back.
|
| - ++expected_push_properties_child2_impl_;
|
| - ++expected_push_properties_grandchild2_impl_;
|
| + ++expected_push_properties_child_impl_;
|
| + ++expected_push_properties_grandchild_impl_;
|
|
|
| break;
|
| case 15:
|
| // The position of this child was changed.
|
| - ++expected_push_properties_grandchild2_impl_;
|
| + ++expected_push_properties_grandchild_impl_;
|
|
|
| // The leaf that always pushes is pushed.
|
| - ++expected_push_properties_grandchild_impl_;
|
| + ++expected_push_properties_grandchild2_impl_;
|
| break;
|
| case 16:
|
| // Second child is invalidated with SetNeedsDisplay
|
| - ++expected_push_properties_child2_impl_;
|
| + ++expected_push_properties_child_impl_;
|
|
|
| // The leaf that always pushed is pushed.
|
| - ++expected_push_properties_grandchild_impl_;
|
| + ++expected_push_properties_grandchild2_impl_;
|
| break;
|
| }
|
|
|
| @@ -2969,23 +2960,24 @@ class LayerTreeHostTestImplLayersPushProperties
|
| root_impl_ = static_cast<PushPropertiesCountingLayerImpl*>(
|
| host_impl->RootLayer());
|
|
|
| - if (root_impl_ && root_impl_->children().size() > 0) {
|
| + LayerTreeImpl* impl = root_impl_->layer_tree_impl();
|
| + if (impl->LayerById(child_->id())) {
|
| child_impl_ = static_cast<PushPropertiesCountingLayerImpl*>(
|
| - root_impl_->children()[0]);
|
| + impl->LayerById(child_->id()));
|
|
|
| - if (child_impl_ && child_impl_->children().size() > 0)
|
| + if (impl->LayerById(grandchild_->id()))
|
| grandchild_impl_ = static_cast<PushPropertiesCountingLayerImpl*>(
|
| - child_impl_->children()[0]);
|
| + impl->LayerById(grandchild_->id()));
|
| }
|
|
|
| - if (root_impl_ && root_impl_->children().size() > 1) {
|
| + if (impl->LayerById(child2_->id())) {
|
| child2_impl_ = static_cast<PushPropertiesCountingLayerImpl*>(
|
| - root_impl_->children()[1]);
|
| + impl->LayerById(child2_->id()));
|
|
|
| - if (child2_impl_ && child2_impl_->children().size() > 0)
|
| + if (impl->LayerById(leaf_always_pushing_layer_->id()))
|
| leaf_always_pushing_layer_impl_ =
|
| static_cast<PushPropertiesCountingLayerImpl*>(
|
| - child2_impl_->children()[0]);
|
| + impl->LayerById(leaf_always_pushing_layer_->id()));
|
| }
|
|
|
| if (root_impl_)
|
| @@ -3702,9 +3694,7 @@ class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest {
|
| }
|
|
|
| void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
|
| - LayerImpl* root = impl->active_tree()->root_layer();
|
| - LayerImpl* parent = root->children()[0];
|
| - LayerImpl* child = parent->children()[0];
|
| + LayerImpl* child = impl->active_tree()->LayerById(child_layer_->id());
|
|
|
| switch (impl->active_tree()->source_frame_number()) {
|
| case 1:
|
|
|