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

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

Issue 2417783005: [Master/Overview CL] Make PageScaleFactor work for oopif subframe.
Patch Set: Rebase to master@{#429656}. Created 4 years, 1 month 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
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 "base/macros.h" 7 #include "base/macros.h"
8 #include "cc/animation/mutable_properties.h" 8 #include "cc/animation/mutable_properties.h"
9 #include "cc/layers/heads_up_display_layer_impl.h" 9 #include "cc/layers/heads_up_display_layer_impl.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 float max_page_scale_factor = 10.f; 1487 float max_page_scale_factor = 10.f;
1488 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( 1488 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize(
1489 root->bounds(), device_scale_factor * page_scale_factor); 1489 root->bounds(), device_scale_factor * page_scale_factor);
1490 host_impl().SetViewportSize(scaled_bounds_for_root); 1490 host_impl().SetViewportSize(scaled_bounds_for_root);
1491 1491
1492 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); 1492 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor);
1493 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1, 1493 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1,
1494 Layer::INVALID_ID); 1494 Layer::INVALID_ID);
1495 host_impl().active_tree()->BuildLayerListAndPropertyTreesForTesting(); 1495 host_impl().active_tree()->BuildLayerListAndPropertyTreesForTesting();
1496 host_impl().active_tree()->PushPageScaleFromMainThread( 1496 host_impl().active_tree()->PushPageScaleFromMainThread(
1497 page_scale_factor, page_scale_factor, max_page_scale_factor); 1497 page_scale_factor, 1.f, page_scale_factor, max_page_scale_factor);
1498 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); 1498 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor);
1499 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 1499 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1500 1500
1501 // Sanity check the scenario we just created. 1501 // Sanity check the scenario we just created.
1502 // The visible content rect for test_layer is actually 100x100, even though 1502 // The visible content rect for test_layer is actually 100x100, even though
1503 // its layout size is 50x50, positioned at 25x25. 1503 // its layout size is 50x50, positioned at 25x25.
1504 LayerImpl* test_layer = root->test_properties()->children[0]; 1504 LayerImpl* test_layer = root->test_properties()->children[0];
1505 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 1505 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
1506 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); 1506 ASSERT_EQ(1u, root->render_surface()->layer_list().size());
1507 1507
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 float max_page_scale_factor = 1.f; 1713 float max_page_scale_factor = 1.f;
1714 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( 1714 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize(
1715 root->bounds(), device_scale_factor * page_scale_factor); 1715 root->bounds(), device_scale_factor * page_scale_factor);
1716 host_impl().SetViewportSize(scaled_bounds_for_root); 1716 host_impl().SetViewportSize(scaled_bounds_for_root);
1717 1717
1718 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); 1718 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor);
1719 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1, 1719 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1,
1720 Layer::INVALID_ID); 1720 Layer::INVALID_ID);
1721 host_impl().active_tree()->BuildLayerListAndPropertyTreesForTesting(); 1721 host_impl().active_tree()->BuildLayerListAndPropertyTreesForTesting();
1722 host_impl().active_tree()->PushPageScaleFromMainThread( 1722 host_impl().active_tree()->PushPageScaleFromMainThread(
1723 page_scale_factor, page_scale_factor, max_page_scale_factor); 1723 page_scale_factor, 1.f, page_scale_factor, max_page_scale_factor);
1724 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); 1724 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor);
1725 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 1725 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1726 1726
1727 // Sanity check the scenario we just created. 1727 // Sanity check the scenario we just created.
1728 ASSERT_EQ(2u, RenderSurfaceLayerList().size()); 1728 ASSERT_EQ(2u, RenderSurfaceLayerList().size());
1729 1729
1730 // Hit checking for a point outside the layer should return a null pointer. 1730 // Hit checking for a point outside the layer should return a null pointer.
1731 // Despite the child layer being very large, it should be clipped to the root 1731 // Despite the child layer being very large, it should be clipped to the root
1732 // layer's bounds. 1732 // layer's bounds.
1733 gfx::PointF test_point(24.f, 24.f); 1733 gfx::PointF test_point(24.f, 24.f);
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
2113 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( 2113 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize(
2114 root->bounds(), device_scale_factor * page_scale_factor); 2114 root->bounds(), device_scale_factor * page_scale_factor);
2115 host_impl().SetViewportSize(scaled_bounds_for_root); 2115 host_impl().SetViewportSize(scaled_bounds_for_root);
2116 2116
2117 host_impl().active_tree()->SetViewportLayersFromIds(0, root->id(), 0, 0); 2117 host_impl().active_tree()->SetViewportLayersFromIds(0, root->id(), 0, 0);
2118 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); 2118 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor);
2119 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); 2119 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor);
2120 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1, 2120 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1,
2121 Layer::INVALID_ID); 2121 Layer::INVALID_ID);
2122 host_impl().active_tree()->PushPageScaleFromMainThread( 2122 host_impl().active_tree()->PushPageScaleFromMainThread(
2123 page_scale_factor, page_scale_factor, page_scale_factor); 2123 page_scale_factor, page_scale_factor, page_scale_factor,
2124 page_scale_factor);
2124 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); 2125 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor);
2125 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 2126 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
2126 2127
2127 // Sanity check the scenario we just created. 2128 // Sanity check the scenario we just created.
2128 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 2129 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
2129 2130
2130 LayerSelection input; 2131 LayerSelection input;
2131 input.start.type = gfx::SelectionBound::LEFT; 2132 input.start.type = gfx::SelectionBound::LEFT;
2132 input.start.edge_top = gfx::Point(10, 10); 2133 input.start.edge_top = gfx::Point(10, 10);
2133 input.start.edge_bottom = gfx::Point(10, 30); 2134 input.start.edge_bottom = gfx::Point(10, 30);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
2404 auto weak_promise = promise->AsWeakPtr(); 2405 auto weak_promise = promise->AsWeakPtr();
2405 host_impl().active_tree()->QueueSwapPromise(std::move(promise)); 2406 host_impl().active_tree()->QueueSwapPromise(std::move(promise));
2406 host_impl().active_tree()->BreakSwapPromises( 2407 host_impl().active_tree()->BreakSwapPromises(
2407 SwapPromise::DidNotSwapReason::SWAP_FAILS); 2408 SwapPromise::DidNotSwapReason::SWAP_FAILS);
2408 EXPECT_FALSE(weak_promise); 2409 EXPECT_FALSE(weak_promise);
2409 } 2410 }
2410 } 2411 }
2411 2412
2412 } // namespace 2413 } // namespace
2413 } // namespace cc 2414 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | content/browser/renderer_host/render_widget_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698