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

Unified Diff: cc/layers/layer_position_constraint_unittest.cc

Issue 2840143002: [cc] Change semantics of fixed-pos container layer
Patch Set: add back inner viewport container layer as fixed-pos container Created 3 years, 8 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/layers/layer_position_constraint_unittest.cc
diff --git a/cc/layers/layer_position_constraint_unittest.cc b/cc/layers/layer_position_constraint_unittest.cc
index 1afc4554cf0c29fca8eaa4bfa3178743e580d3cb..32fa24fb737633662c31c930c54a8ff04c859987 100644
--- a/cc/layers/layer_position_constraint_unittest.cc
+++ b/cc/layers/layer_position_constraint_unittest.cc
@@ -118,10 +118,11 @@ class LayerPositionConstraintTest : public testing::Test {
root_->SetBounds(clip_bounds);
inner_viewport_container_layer_->SetMasksToBounds(true);
+ inner_viewport_container_layer_->SetIsContainerForFixedPositionLayers(true);
scroll_layer_->SetScrollClipLayerId(inner_viewport_container_layer_->id());
- scroll_layer_->SetIsContainerForFixedPositionLayers(true);
outer_viewport_container_layer_->SetMasksToBounds(true);
+ outer_viewport_container_layer_->SetIsContainerForFixedPositionLayers(true);
child_->SetScrollClipLayerId(outer_viewport_container_layer_->id());
grand_child_->SetScrollClipLayerId(outer_viewport_container_layer_->id());
@@ -211,7 +212,6 @@ TEST_F(LayerPositionConstraintTest,
ScrollCompensationForFixedPositionLayerWithDirectContainer) {
// This test checks for correct scroll compensation when the fixed-position
// container is the direct parent of the fixed-position layer.
- child_->SetIsContainerForFixedPositionLayers(true);
grand_child_->SetPositionConstraint(fixed_to_top_left_);
CommitAndUpdateImplPointers();
@@ -278,7 +278,6 @@ TEST_F(LayerPositionConstraintTest,
ScrollCompensationForFixedPositionLayerWithDistantContainer) {
// This test checks for correct scroll compensation when the fixed-position
// container is NOT the direct parent of the fixed-position layer.
- child_->SetIsContainerForFixedPositionLayers(true);
grand_child_->SetPosition(gfx::PointF(8.f, 6.f));
great_grand_child_->SetPositionConstraint(fixed_to_top_left_);
@@ -430,7 +429,6 @@ TEST_F(LayerPositionConstraintTest,
// container contributes to a different render surface than the fixed-position
// layer. In this case, the surface draw transforms also have to be accounted
// for when checking the scroll delta.
- child_->SetIsContainerForFixedPositionLayers(true);
grand_child_->SetPosition(gfx::PointF(8.f, 6.f));
grand_child_->SetForceRenderSurfaceForTesting(true);
great_grand_child_->SetPositionConstraint(fixed_to_top_left_);
@@ -556,7 +554,6 @@ TEST_F(LayerPositionConstraintTest,
great_grand_child_->AddChild(fixed_position_child);
// Actually set up the scenario here.
- child_->SetIsContainerForFixedPositionLayers(true);
grand_child_->SetPosition(gfx::PointF(8.f, 6.f));
grand_child_->SetForceRenderSurfaceForTesting(true);
great_grand_child_->SetPosition(gfx::PointF(40.f, 60.f));
@@ -831,7 +828,6 @@ TEST_F(LayerPositionConstraintTest,
// should be treated like a layer that contributes to a render target, and
// that render target is completely irrelevant; it should not affect the
// scroll compensation.
- child_->SetIsContainerForFixedPositionLayers(true);
child_->SetForceRenderSurfaceForTesting(true);
grand_child_->SetPositionConstraint(fixed_to_top_left_);
@@ -913,11 +909,7 @@ TEST_F(LayerPositionConstraintTest,
// This test checks the scenario where a fixed-position layer also happens to
// be a container itself for a descendant fixed position layer. In particular,
// the layer should not accidentally be fixed to itself.
- child_->SetIsContainerForFixedPositionLayers(true);
grand_child_->SetPositionConstraint(fixed_to_top_left_);
-
- // This should not confuse the grand_child. If correct, the grand_child would
- // still be considered fixed to its container (i.e. "child").
grand_child_->SetIsContainerForFixedPositionLayers(true);
CommitAndUpdateImplPointers();
@@ -985,7 +977,6 @@ TEST_F(LayerPositionConstraintTest,
// In this situation, the parent fixed-position layer will receive
// the scroll compensation, and the child fixed-position layer does not
// need to compensate further.
- child_->SetIsContainerForFixedPositionLayers(true);
grand_child_->SetPositionConstraint(fixed_to_top_left_);
// Note carefully - great_grand_child is fixed to bottom right, to test
@@ -1049,9 +1040,8 @@ TEST_F(LayerPositionConstraintTest,
make_scoped_refptr(new LayerWithForcedDrawsContent());
great_grand_child_->AddChild(great_great_grand_child);
- child_->SetIsContainerForFixedPositionLayers(true);
grand_child_->SetPositionConstraint(fixed_to_top_left_);
- great_grand_child_->SetIsContainerForFixedPositionLayers(true);
+ grand_child_->SetIsContainerForFixedPositionLayers(true);
great_grand_child_->SetScrollClipLayerId(root_->id());
great_great_grand_child->SetPositionConstraint(fixed_to_top_left_);
« no previous file with comments | « cc/layers/layer.h ('k') | cc/test/layer_tree_test.cc » ('j') | cc/test/layer_tree_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698