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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 2840433002: Move LayerImpl's bounds_delta to property trees (Closed)
Patch Set: Document ViewportBoundsDelta better 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
« no previous file with comments | « cc/test/fake_layer_tree_host.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 51ef650997dcd8bed83a2cde931694d836b9c304..6c96b6a903d5530222b9af873f5e4e8f308192a7 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -7343,7 +7343,7 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionBottomInnerViewportDelta) {
// We start to hide the toolbar, but not far enough that the sticky element
// should be moved up yet.
- root_impl->SetBoundsDelta(gfx::Vector2dF(0.f, -10.f));
+ root_impl->SetViewportBoundsDelta(gfx::Vector2dF(0.f, -10.f));
ExecuteCalculateDrawProperties(root_impl, 1.f, 1.f, root_impl, inner_scroll,
nullptr);
EXPECT_VECTOR2DF_EQ(
@@ -7351,7 +7351,7 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionBottomInnerViewportDelta) {
sticky_pos_impl->ScreenSpaceTransform().To2dTranslation());
// On hiding more of the toolbar the sticky element starts to stick.
- root_impl->SetBoundsDelta(gfx::Vector2dF(0.f, -20.f));
+ root_impl->SetViewportBoundsDelta(gfx::Vector2dF(0.f, -20.f));
ExecuteCalculateDrawProperties(root_impl, 1.f, 1.f, root_impl, inner_scroll,
nullptr);
EXPECT_VECTOR2DF_EQ(
@@ -7360,7 +7360,7 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionBottomInnerViewportDelta) {
// On hiding more the sticky element stops moving as it has reached its
// limit.
- root_impl->SetBoundsDelta(gfx::Vector2dF(0.f, -30.f));
+ root_impl->SetViewportBoundsDelta(gfx::Vector2dF(0.f, -30.f));
ExecuteCalculateDrawProperties(root_impl, 1.f, 1.f, root_impl, inner_scroll,
nullptr);
EXPECT_VECTOR2DF_EQ(
@@ -7420,7 +7420,7 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionBottomOuterViewportDelta) {
// We start to hide the toolbar, but not far enough that the sticky element
// should be moved up yet.
- outer_clip_impl->SetBoundsDelta(gfx::Vector2dF(0.f, -10.f));
+ outer_clip_impl->SetViewportBoundsDelta(gfx::Vector2dF(0.f, -10.f));
ExecuteCalculateDrawProperties(root_impl, 1.f, 1.f, root_impl, inner_scroll,
outer_scroll);
EXPECT_VECTOR2DF_EQ(
@@ -7428,7 +7428,7 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionBottomOuterViewportDelta) {
sticky_pos_impl->ScreenSpaceTransform().To2dTranslation());
// On hiding more of the toolbar the sticky element starts to stick.
- outer_clip_impl->SetBoundsDelta(gfx::Vector2dF(0.f, -20.f));
+ outer_clip_impl->SetViewportBoundsDelta(gfx::Vector2dF(0.f, -20.f));
ExecuteCalculateDrawProperties(root_impl, 1.f, 1.f, root_impl, inner_scroll,
outer_scroll);
@@ -7438,7 +7438,7 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionBottomOuterViewportDelta) {
gfx::Vector2dF(0.f, 60.f),
sticky_pos_impl->ScreenSpaceTransform().To2dTranslation());
- outer_clip_impl->SetBoundsDelta(gfx::Vector2dF(0.f, -30.f));
+ outer_clip_impl->SetViewportBoundsDelta(gfx::Vector2dF(0.f, -30.f));
ExecuteCalculateDrawProperties(root_impl, 1.f, 1.f, root_impl, inner_scroll,
outer_scroll);
@@ -8857,7 +8857,7 @@ TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) {
EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_layer_rect());
}
-TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) {
+TEST_F(LayerTreeHostCommonTest, ViewportBoundsDeltaAffectVisibleContentRect) {
FakeImplTaskRunnerProvider task_runner_provider;
TestTaskGraphRunner task_graph_runner;
FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
@@ -8881,6 +8881,11 @@ TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) {
root->SetBounds(root_size);
root->SetMasksToBounds(true);
+ // Make root the inner viewport scroll layer. This ensures the later call to
+ // |SetViewportBoundsDelta| will be on a viewport layer.
+ host_impl.active_tree()->SetViewportLayersFromIds(
+ Layer::INVALID_ID, Layer::INVALID_ID, root->id(), Layer::INVALID_ID);
+
root->test_properties()->AddChild(
LayerImpl::Create(host_impl.active_tree(), 2));
@@ -8897,7 +8902,7 @@ TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) {
LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
EXPECT_EQ(gfx::Rect(root_size), sublayer->visible_layer_rect());
- root->SetBoundsDelta(gfx::Vector2dF(0.0, 50.0));
+ root->SetViewportBoundsDelta(gfx::Vector2dF(0.0, 50.0));
LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
gfx::Rect affected_by_delta(0, 0, root_size.width(),
@@ -8905,7 +8910,7 @@ TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) {
EXPECT_EQ(affected_by_delta, sublayer->visible_layer_rect());
}
-TEST_F(LayerTreeHostCommonTest, NodesAffectedByBoundsDeltaGetUpdated) {
+TEST_F(LayerTreeHostCommonTest, NodesAffectedByViewportBoundsDeltaGetUpdated) {
scoped_refptr<Layer> root = Layer::Create();
scoped_refptr<Layer> inner_viewport_container_layer = Layer::Create();
scoped_refptr<Layer> inner_viewport_scroll_layer = Layer::Create();
« no previous file with comments | « cc/test/fake_layer_tree_host.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698