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

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

Issue 1675963002: Move MaxScrollOffset to property_trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove comment. Created 4 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 unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | cc/trees/property_tree.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_task_runner_provider.h" 10 #include "cc/test/fake_impl_task_runner_provider.h"
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 } 1672 }
1673 1673
1674 float device_scale_factor = 3.f; 1674 float device_scale_factor = 3.f;
1675 float page_scale_factor = 5.f; 1675 float page_scale_factor = 5.f;
1676 float max_page_scale_factor = 10.f; 1676 float max_page_scale_factor = 10.f;
1677 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( 1677 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize(
1678 root->bounds(), device_scale_factor * page_scale_factor); 1678 root->bounds(), device_scale_factor * page_scale_factor);
1679 host_impl().SetViewportSize(scaled_bounds_for_root); 1679 host_impl().SetViewportSize(scaled_bounds_for_root);
1680 1680
1681 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); 1681 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor);
1682 host_impl().active_tree()->SetRootLayer(std::move(root));
1683 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1,
1684 Layer::INVALID_ID);
1685 host_impl().active_tree()->BuildPropertyTreesForTesting();
1682 host_impl().active_tree()->PushPageScaleFromMainThread( 1686 host_impl().active_tree()->PushPageScaleFromMainThread(
1683 page_scale_factor, page_scale_factor, max_page_scale_factor); 1687 page_scale_factor, page_scale_factor, max_page_scale_factor);
1684 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); 1688 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor);
1685 host_impl().active_tree()->SetRootLayer(std::move(root));
1686 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1,
1687 Layer::INVALID_ID);
1688 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 1689 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1689 1690
1690 // Sanity check the scenario we just created. 1691 // Sanity check the scenario we just created.
1691 // The visible content rect for test_layer is actually 100x100, even though 1692 // The visible content rect for test_layer is actually 100x100, even though
1692 // its layout size is 50x50, positioned at 25x25. 1693 // its layout size is 50x50, positioned at 25x25.
1693 LayerImpl* test_layer = 1694 LayerImpl* test_layer =
1694 host_impl().active_tree()->root_layer()->children()[0].get(); 1695 host_impl().active_tree()->root_layer()->children()[0].get();
1695 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 1696 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
1696 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 1697 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
1697 1698
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
2237 root->AddChild(std::move(sub_layer)); 2238 root->AddChild(std::move(sub_layer));
2238 } 2239 }
2239 2240
2240 float device_scale_factor = 3.f; 2241 float device_scale_factor = 3.f;
2241 float page_scale_factor = 5.f; 2242 float page_scale_factor = 5.f;
2242 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( 2243 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize(
2243 root->bounds(), device_scale_factor * page_scale_factor); 2244 root->bounds(), device_scale_factor * page_scale_factor);
2244 host_impl().SetViewportSize(scaled_bounds_for_root); 2245 host_impl().SetViewportSize(scaled_bounds_for_root);
2245 2246
2246 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); 2247 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor);
2247 host_impl().active_tree()->PushPageScaleFromMainThread(
2248 page_scale_factor, page_scale_factor, page_scale_factor);
2249 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); 2248 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor);
2250 host_impl().active_tree()->SetRootLayer(std::move(root)); 2249 host_impl().active_tree()->SetRootLayer(std::move(root));
2251 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1, 2250 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1,
2252 Layer::INVALID_ID); 2251 Layer::INVALID_ID);
2252 host_impl().active_tree()->BuildPropertyTreesForTesting();
2253 host_impl().active_tree()->PushPageScaleFromMainThread(
2254 page_scale_factor, page_scale_factor, page_scale_factor);
2255 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor);
2253 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 2256 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
2254 2257
2255 // Sanity check the scenario we just created. 2258 // Sanity check the scenario we just created.
2256 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 2259 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
2257 2260
2258 LayerSelection input; 2261 LayerSelection input;
2259 input.start.type = SELECTION_BOUND_LEFT; 2262 input.start.type = SELECTION_BOUND_LEFT;
2260 input.start.edge_top = gfx::Point(10, 10); 2263 input.start.edge_top = gfx::Point(10, 10);
2261 input.start.edge_bottom = gfx::Point(10, 30); 2264 input.start.edge_bottom = gfx::Point(10, 30);
2262 input.start.layer_id = root_layer_id; 2265 input.start.layer_id = root_layer_id;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 TEST_F(LayerTreeImplTest, DeviceScaleFactorNeedsDrawPropertiesUpdate) { 2376 TEST_F(LayerTreeImplTest, DeviceScaleFactorNeedsDrawPropertiesUpdate) {
2374 host_impl().active_tree()->SetDeviceScaleFactor(1.f); 2377 host_impl().active_tree()->SetDeviceScaleFactor(1.f);
2375 host_impl().active_tree()->UpdateDrawProperties(false); 2378 host_impl().active_tree()->UpdateDrawProperties(false);
2376 EXPECT_FALSE(host_impl().active_tree()->needs_update_draw_properties()); 2379 EXPECT_FALSE(host_impl().active_tree()->needs_update_draw_properties());
2377 host_impl().active_tree()->SetDeviceScaleFactor(2.f); 2380 host_impl().active_tree()->SetDeviceScaleFactor(2.f);
2378 EXPECT_TRUE(host_impl().active_tree()->needs_update_draw_properties()); 2381 EXPECT_TRUE(host_impl().active_tree()->needs_update_draw_properties());
2379 } 2382 }
2380 2383
2381 } // namespace 2384 } // namespace
2382 } // namespace cc 2385 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | cc/trees/property_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698