OLD | NEW |
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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 6959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6970 sticky_pos_impl->ScreenSpaceTransform().To2dTranslation()); | 6970 sticky_pos_impl->ScreenSpaceTransform().To2dTranslation()); |
6971 | 6971 |
6972 // Once we scroll past its initial location, it sticks there. | 6972 // Once we scroll past its initial location, it sticks there. |
6973 SetScrollOffsetDelta(scroller_impl, gfx::Vector2dF(0.f, 150.f)); | 6973 SetScrollOffsetDelta(scroller_impl, gfx::Vector2dF(0.f, 150.f)); |
6974 ExecuteCalculateDrawProperties(root_impl); | 6974 ExecuteCalculateDrawProperties(root_impl); |
6975 EXPECT_VECTOR2DF_EQ( | 6975 EXPECT_VECTOR2DF_EQ( |
6976 gfx::Vector2dF(0.f, 0.f), | 6976 gfx::Vector2dF(0.f, 0.f), |
6977 sticky_pos_impl->ScreenSpaceTransform().To2dTranslation()); | 6977 sticky_pos_impl->ScreenSpaceTransform().To2dTranslation()); |
6978 } | 6978 } |
6979 | 6979 |
6980 TEST_F(LayerTreeHostCommonTest, StickyPositionBottomHideTopControls) { | 6980 TEST_F(LayerTreeHostCommonTest, StickyPositionBottomHideBrowserControls) { |
6981 scoped_refptr<Layer> root = Layer::Create(); | 6981 scoped_refptr<Layer> root = Layer::Create(); |
6982 scoped_refptr<Layer> scroller = Layer::Create(); | 6982 scoped_refptr<Layer> scroller = Layer::Create(); |
6983 scoped_refptr<Layer> sticky_pos = Layer::Create(); | 6983 scoped_refptr<Layer> sticky_pos = Layer::Create(); |
6984 root->AddChild(scroller); | 6984 root->AddChild(scroller); |
6985 scroller->AddChild(sticky_pos); | 6985 scroller->AddChild(sticky_pos); |
6986 host()->SetRootLayer(root); | 6986 host()->SetRootLayer(root); |
6987 scroller->SetScrollClipLayerId(root->id()); | 6987 scroller->SetScrollClipLayerId(root->id()); |
6988 host()->GetLayerTree()->RegisterViewportLayers(nullptr, root, scroller, | 6988 host()->GetLayerTree()->RegisterViewportLayers(nullptr, root, scroller, |
6989 nullptr); | 6989 nullptr); |
6990 | 6990 |
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8357 &task_graph_runner); | 8357 &task_graph_runner); |
8358 | 8358 |
8359 // Set two layers: the root layer clips it's child, | 8359 // Set two layers: the root layer clips it's child, |
8360 // the child draws its content. | 8360 // the child draws its content. |
8361 | 8361 |
8362 gfx::Size root_size = gfx::Size(300, 500); | 8362 gfx::Size root_size = gfx::Size(300, 500); |
8363 | 8363 |
8364 // Sublayer should be bigger than the root enlarged by bounds_delta. | 8364 // Sublayer should be bigger than the root enlarged by bounds_delta. |
8365 gfx::Size sublayer_size = gfx::Size(300, 1000); | 8365 gfx::Size sublayer_size = gfx::Size(300, 1000); |
8366 | 8366 |
8367 // Device viewport accomidated the root and the top controls. | 8367 // Device viewport accomidated the root and the browser controls. |
8368 gfx::Size device_viewport_size = gfx::Size(300, 600); | 8368 gfx::Size device_viewport_size = gfx::Size(300, 600); |
8369 | 8369 |
8370 host_impl.SetViewportSize(device_viewport_size); | 8370 host_impl.SetViewportSize(device_viewport_size); |
8371 host_impl.active_tree()->SetRootLayerForTesting( | 8371 host_impl.active_tree()->SetRootLayerForTesting( |
8372 LayerImpl::Create(host_impl.active_tree(), 1)); | 8372 LayerImpl::Create(host_impl.active_tree(), 1)); |
8373 | 8373 |
8374 LayerImpl* root = host_impl.active_tree()->root_layer_for_testing(); | 8374 LayerImpl* root = host_impl.active_tree()->root_layer_for_testing(); |
8375 root->SetBounds(root_size); | 8375 root->SetBounds(root_size); |
8376 root->SetMasksToBounds(true); | 8376 root->SetMasksToBounds(true); |
8377 | 8377 |
(...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10339 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10339 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
10340 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10340 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
10341 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10341 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
10342 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10342 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
10343 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10343 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
10344 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10344 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
10345 } | 10345 } |
10346 | 10346 |
10347 } // namespace | 10347 } // namespace |
10348 } // namespace cc | 10348 } // namespace cc |
OLD | NEW |