diff options
author | Alexandre Elias <aelias@chromium.org> | 2014-08-26 15:13:03 -0700 |
---|---|---|
committer | Alexandre Elias <aelias@chromium.org> | 2014-08-26 22:14:01 +0000 |
commit | 644ba7e892cfc1045d9e8c7b5eced6a4797fa37c (patch) | |
tree | 4a67e8676e6efa4d132cfe9d2bd68858cf159f76 | |
parent | 121b13c6646ce4aa986a3e0c4d2e32e3dd931d5b (diff) | |
download | chromium_src-644ba7e892cfc1045d9e8c7b5eced6a4797fa37c.zip chromium_src-644ba7e892cfc1045d9e8c7b5eced6a4797fa37c.tar.gz chromium_src-644ba7e892cfc1045d9e8c7b5eced6a4797fa37c.tar.bz2 |
Fix spurious 1px scrolling.
In the case when the temporary_impl_bounds_ variable is set to
ComputeInnerViewportContainerSize() (which is device_viewport_size_ /
device_scale_factor()) the value should be rounded up, to match
ContentViewCoreImpl::GetViewportSizeDip(). The incorrect rounding
is causing the layer to be scrollable when the physical width
is not cleanly divisible by the dpi scale.
TBR=mkosiba
BUG=405580
Review URL: https://codereview.chromium.org/496473002
Cr-Commit-Position: refs/heads/master@{#291035}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291035 0039d316-1c4b-4281-b951-d872f2087c98
(cherry picked from commit a6d2ffe824c67836dea019cf82ed630de33f5231)
Review URL: https://codereview.chromium.org/505373003
Cr-Commit-Position: refs/branch-heads/2125@{#114}
Cr-Branched-From: b68026d94bda36dd106a3d91a098719f952a9477-refs/heads/master@{#290040}
-rw-r--r-- | cc/layers/layer_impl.cc | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl_unittest.cc | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index e6e60f5..87cb2f8 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc @@ -771,7 +771,7 @@ bool LayerImpl::IsActive() const { // TODO(wjmaclean) Convert so that bounds returns SizeF. gfx::Size LayerImpl::bounds() const { - return ToFlooredSize(temporary_impl_bounds_); + return ToCeiledSize(temporary_impl_bounds_); } void LayerImpl::SetBounds(const gfx::Size& bounds) { diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 167b65a..f01d0f9 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -3040,6 +3040,21 @@ TEST_F(LayerTreeHostImplTest, ScrollScaledLayer) { wheel_scroll_delta); } +TEST_F(LayerTreeHostImplTest, ScrollViewportRounding) { + int width = 332; + int height = 20; + int scale = 3; + SetupScrollAndContentsLayers(gfx::Size(width, height)); + host_impl_->SetViewportSize(gfx::Size(width * scale - 1, height * scale)); + host_impl_->SetDeviceScaleFactor(scale); + host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, 0.5f, 4.f); + + LayerImpl* inner_viewport_scroll_layer = + host_impl_->active_tree()->InnerViewportScrollLayer(); + EXPECT_EQ(gfx::Vector2d(0, 0), + inner_viewport_scroll_layer->MaxScrollOffset()); +} + class TestScrollOffsetDelegate : public LayerScrollOffsetDelegate { public: TestScrollOffsetDelegate() |