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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 595593002: Splitting of layers for correct intersections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host_common_unittest.cc
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index de5f44a4eed90f53bcb010360e51d05a5969fc25..303dbfc12a5b35df9eee0f088a1f4653b342022d 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -6,6 +6,7 @@
#include <algorithm>
#include <set>
+#include <tuple>
enne (OOO) 2015/02/23 23:51:36 This doesn't compile on Android, no matter what th
awoloszyn 2015/02/24 21:28:49 Done.
#include "cc/animation/layer_animation_controller.h"
#include "cc/animation/transform_operations.h"
@@ -7516,110 +7517,6 @@ TEST_F(LayerTreeHostCommonTest, OutOfOrderClippingRequiresRSLLSorting) {
EXPECT_TRUE(render_surface_layer_list.at(2)->render_surface());
}
-TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
- // We rearrange layer list contributions if we have to visit children out of
- // order, but it should be a 'stable' rearrangement. That is, the layer list
- // additions for a single layer should not be reordered, though their position
- // wrt to the contributions due to a sibling may vary.
- //
- // + root
- // + scroll_child
- // + top_content
- // + bottom_content
- // + scroll_parent_border
- // + scroll_parent_clip
- // + scroll_parent
- //
- FakeImplProxy proxy;
- TestSharedBitmapManager shared_bitmap_manager;
- FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
- host_impl.CreatePendingTree();
- scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
- scoped_ptr<LayerImpl> scroll_parent_border =
- LayerImpl::Create(host_impl.active_tree(), 2);
- scoped_ptr<LayerImpl> scroll_parent_clip =
- LayerImpl::Create(host_impl.active_tree(), 3);
- scoped_ptr<LayerImpl> scroll_parent =
- LayerImpl::Create(host_impl.active_tree(), 4);
- scoped_ptr<LayerImpl> scroll_child =
- LayerImpl::Create(host_impl.active_tree(), 5);
- scoped_ptr<LayerImpl> bottom_content =
- LayerImpl::Create(host_impl.active_tree(), 6);
- scoped_ptr<LayerImpl> top_content =
- LayerImpl::Create(host_impl.active_tree(), 7);
-
- scroll_parent_clip->SetMasksToBounds(true);
-
- scroll_child->SetScrollParent(scroll_parent.get());
- scoped_ptr<std::set<LayerImpl*>> scroll_children(new std::set<LayerImpl*>);
- scroll_children->insert(scroll_child.get());
- scroll_parent->SetScrollChildren(scroll_children.release());
-
- scroll_child->SetDrawsContent(true);
- scroll_parent->SetDrawsContent(true);
- top_content->SetDrawsContent(true);
- bottom_content->SetDrawsContent(true);
-
- gfx::Transform identity_transform;
- gfx::Transform top_transform;
- top_transform.Translate3d(0.0, 0.0, 5.0);
- gfx::Transform bottom_transform;
- bottom_transform.Translate3d(0.0, 0.0, 3.0);
-
- SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(),
- gfx::PointF(), gfx::Size(50, 50), true, false,
- true);
- SetLayerPropertiesForTesting(scroll_parent_border.get(), identity_transform,
- gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40),
- true, false, false);
- SetLayerPropertiesForTesting(scroll_parent_clip.get(), identity_transform,
- gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
- true, false, false);
- SetLayerPropertiesForTesting(scroll_parent.get(), identity_transform,
- gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50),
- true, false, false);
- SetLayerPropertiesForTesting(scroll_child.get(), identity_transform,
- gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50),
- true, false, false);
- SetLayerPropertiesForTesting(top_content.get(), top_transform, gfx::Point3F(),
- gfx::PointF(), gfx::Size(50, 50), false, true,
- true);
- SetLayerPropertiesForTesting(bottom_content.get(), bottom_transform,
- gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50),
- false, true, true);
-
- scroll_child->SetShouldFlattenTransform(false);
- scroll_child->Set3dSortingContextId(1);
-
- scroll_child->AddChild(top_content.Pass());
- scroll_child->AddChild(bottom_content.Pass());
- root->AddChild(scroll_child.Pass());
-
- scroll_parent_clip->AddChild(scroll_parent.Pass());
- scroll_parent_border->AddChild(scroll_parent_clip.Pass());
- root->AddChild(scroll_parent_border.Pass());
-
- LayerImplList render_surface_layer_list;
- LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
- root.get(), root->bounds(), &render_surface_layer_list);
-
- LayerTreeHostCommon::CalculateDrawProperties(&inputs);
-
- EXPECT_TRUE(root->render_surface());
-
- // If we don't sort by depth and let the layers get added in the order they
- // would normally be visited in, then layers 6 and 7 will be out of order. In
- // other words, although we've had to shift 5, 6, and 7 to appear before 4
- // in the list (because of the scroll parent relationship), this should not
- // have an effect on the the order of 5, 6, and 7 (which had been reordered
- // due to layer sorting).
- EXPECT_EQ(4u, root->render_surface()->layer_list().size());
- EXPECT_EQ(5, root->render_surface()->layer_list().at(0)->id());
- EXPECT_EQ(6, root->render_surface()->layer_list().at(1)->id());
- EXPECT_EQ(7, root->render_surface()->layer_list().at(2)->id());
- EXPECT_EQ(4, root->render_surface()->layer_list().at(3)->id());
-}
-
TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) {
// This test verifies that a scrolling layer that gets snapped to
// integer coordinates doesn't move a fixed position child.

Powered by Google App Engine
This is Rietveld 408576698