diff options
author | bokan@chromium.org <bokan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-30 14:37:07 +0000 |
---|---|---|
committer | bokan@chromium.org <bokan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-30 14:37:07 +0000 |
commit | 289c907525e4f7845af05fcf86fab56fdffdc691 (patch) | |
tree | 3cccf72b21882bc4ef41189d0d57ec9fe87c3b03 /cc | |
parent | ba5ab466714f13975934449ce772adb4268cd9b7 (diff) | |
download | chromium_src-289c907525e4f7845af05fcf86fab56fdffdc691.zip chromium_src-289c907525e4f7845af05fcf86fab56fdffdc691.tar.gz chromium_src-289c907525e4f7845af05fcf86fab56fdffdc691.tar.bz2 |
Added compositor test for viewport container bounds clobbering behavior.
Added a new test to make sure that if the inner viewport container layer has
'masks_to_bounds' set, as it does on non-Android platforms, the inner viewport
container layer's size isn't clobbered by the viewport size.
BUG=
Review URL: https://codereview.chromium.org/254133005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267202 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/trees/layer_tree_host_impl_unittest.cc | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index fc7645d..b9c35f6 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -946,6 +946,61 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoom) { } } +TEST_F(LayerTreeHostImplTest, MasksToBoundsDoesntClobberInnerContainerSize) { + SetupScrollAndContentsLayers(gfx::Size(100, 100)); + host_impl_->SetViewportSize(gfx::Size(50, 50)); + DrawFrame(); + + LayerImpl* scroll_layer = host_impl_->InnerViewportScrollLayer(); + LayerImpl* container_layer = scroll_layer->scroll_clip_layer(); + DCHECK(scroll_layer); + + float min_page_scale = 1.f; + float max_page_scale = 4.f; + host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, + min_page_scale, + max_page_scale); + + // If the container's masks_to_bounds is false, the viewport size should + // overwrite the inner viewport container layer's size. + { + EXPECT_EQ(gfx::Size(50, 50), + container_layer->bounds()); + container_layer->SetMasksToBounds(false); + + container_layer->SetBounds(gfx::Size(30, 25)); + EXPECT_EQ(gfx::Size(30, 25), + container_layer->bounds()); + + // This should cause a reset of the inner viewport container layer's bounds. + host_impl_->DidChangeTopControlsPosition(); + + EXPECT_EQ(gfx::Size(50, 50), + container_layer->bounds()); + } + + host_impl_->SetViewportSize(gfx::Size(50, 50)); + container_layer->SetBounds(gfx::Size(50, 50)); + + // If the container's masks_to_bounds is true, the viewport size should + // *NOT* overwrite the inner viewport container layer's size. + { + EXPECT_EQ(gfx::Size(50, 50), + container_layer->bounds()); + container_layer->SetMasksToBounds(true); + + container_layer->SetBounds(gfx::Size(30, 25)); + EXPECT_EQ(gfx::Size(30, 25), + container_layer->bounds()); + + // This should cause a reset of the inner viewport container layer's bounds. + host_impl_->DidChangeTopControlsPosition(); + + EXPECT_EQ(gfx::Size(30, 25), + container_layer->bounds()); + } +} + TEST_F(LayerTreeHostImplTest, PinchGesture) { SetupScrollAndContentsLayers(gfx::Size(100, 100)); host_impl_->SetViewportSize(gfx::Size(50, 50)); |