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

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

Issue 595593002: Splitting of layers for correct intersections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed the static that was only used in ony place anyway Created 5 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_impl.h" 5 #include "cc/trees/layer_tree_impl.h"
6 6
7 #include "cc/layers/heads_up_display_layer_impl.h" 7 #include "cc/layers/heads_up_display_layer_impl.h"
8 #include "cc/layers/layer.h" 8 #include "cc/layers/layer.h"
9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
10 #include "cc/test/fake_impl_proxy.h" 10 #include "cc/test/fake_impl_proxy.h"
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 host_impl().SetViewportSize(root->bounds()); 913 host_impl().SetViewportSize(root->bounds());
914 host_impl().active_tree()->SetRootLayer(root.Pass()); 914 host_impl().active_tree()->SetRootLayer(root.Pass());
915 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 915 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
916 916
917 // Sanity check the scenario we just created. 917 // Sanity check the scenario we just created.
918 ASSERT_TRUE(child1); 918 ASSERT_TRUE(child1);
919 ASSERT_TRUE(child2); 919 ASSERT_TRUE(child2);
920 ASSERT_TRUE(grand_child1); 920 ASSERT_TRUE(grand_child1);
921 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 921 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
922 922
923 RenderSurfaceImpl* root_render_surface =
924 host_impl().active_tree()->root_layer()->render_surface();
925 ASSERT_EQ(4u, root_render_surface->layer_list().size());
926 ASSERT_EQ(3, root_render_surface->layer_list().at(0)->id());
927 ASSERT_EQ(1, root_render_surface->layer_list().at(1)->id());
928 ASSERT_EQ(2, root_render_surface->layer_list().at(2)->id());
929 ASSERT_EQ(4, root_render_surface->layer_list().at(3)->id());
930
931 // Nothing overlaps the root_layer at (1, 1), so hit testing there should find 923 // Nothing overlaps the root_layer at (1, 1), so hit testing there should find
932 // the root layer. 924 // the root layer.
933 gfx::Point test_point = gfx::Point(1, 1); 925 gfx::Point test_point = gfx::Point(1, 1);
934 LayerImpl* result_layer = 926 LayerImpl* result_layer =
935 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 927 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
936 ASSERT_TRUE(result_layer); 928 ASSERT_TRUE(result_layer);
937 EXPECT_EQ(1, result_layer->id()); 929 EXPECT_EQ(1, result_layer->id());
938 930
939 // At (15, 15), child1 and root are the only layers. child1 is expected to be 931 // At (15, 15), child1 and root are the only layers. child1 is expected to be
940 // on top. 932 // on top.
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); 2149 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers());
2158 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); 2150 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
2159 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); 2151 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2));
2160 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); 2152 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3));
2161 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); 2153 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4));
2162 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); 2154 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers());
2163 } 2155 }
2164 2156
2165 } // namespace 2157 } // namespace
2166 } // namespace cc 2158 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698