Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1139573004: Reset property tree indices when layer is removed from layer tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "cc/animation/layer_animation_controller.h" 10 #include "cc/animation/layer_animation_controller.h"
(...skipping 9579 matching lines...) Expand 10 before | Expand all | Expand 10 after
9590 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); 9590 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
9591 host->SetRootLayer(root); 9591 host->SetRootLayer(root);
9592 9592
9593 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 0); 9593 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 0);
9594 ExecuteCalculateDrawProperties(root.get()); 9594 ExecuteCalculateDrawProperties(root.get());
9595 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 1); 9595 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 1);
9596 child->SetHaveWheelEventHandlers(false); 9596 child->SetHaveWheelEventHandlers(false);
9597 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 0); 9597 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 0);
9598 } 9598 }
9599 9599
9600 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) {
9601 gfx::Transform identity;
9602 gfx::Transform translate_z;
9603 translate_z.Translate3d(0, 0, 10);
9604
9605 scoped_refptr<Layer> root = Layer::Create();
9606 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(),
9607 gfx::PointF(), gfx::Size(800, 800), true, false);
9608
9609 scoped_refptr<Layer> child = Layer::Create();
9610 SetLayerPropertiesForTesting(child.get(), translate_z, gfx::Point3F(),
9611 gfx::PointF(), gfx::Size(100, 100), true, false);
9612
9613 root->AddChild(child);
9614
9615 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
9616 host->SetRootLayer(root);
9617
9618 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
9619 EXPECT_NE(-1, child->transform_tree_index());
9620
9621 child->RemoveFromParent();
9622
9623 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
9624 EXPECT_EQ(-1, child->transform_tree_index());
9625 }
9626
9600 } // namespace 9627 } // namespace
9601 } // namespace cc 9628 } // namespace cc
OLDNEW
« cc/layers/layer.cc ('K') | « cc/layers/layer.cc ('k') | cc/trees/property_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698