Chromium Code Reviews| Index: cc/layer_tree_host_impl.cc |
| diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc |
| index cddbec75d02a5a56574fb679414dd5b457445962..a7e6685a03357e6fa4267ee59bb67e25d5240e07 100644 |
| --- a/cc/layer_tree_host_impl.cc |
| +++ b/cc/layer_tree_host_impl.cc |
| @@ -1255,7 +1255,8 @@ static gfx::Vector2dF scrollLayerWithLocalDelta(LayerImpl& layerImpl, gfx::Vecto |
| } |
| bool LayerTreeHostImpl::scrollBy(const gfx::Point& viewportPoint, |
| - const gfx::Vector2d& scrollDelta) |
| + const gfx::Vector2d& scrollDelta, |
| + bool scrollByPage) |
| { |
| TRACE_EVENT0("cc", "LayerTreeHostImpl::scrollBy"); |
| if (!currentlyScrollingLayer()) |
| @@ -1272,6 +1273,10 @@ bool LayerTreeHostImpl::scrollBy(const gfx::Point& viewportPoint, |
| if (m_settings.pageScalePinchZoomEnabled && layerImpl == rootScrollLayer()) |
| viewport = &m_pinchZoomViewport; |
| gfx::Vector2dF appliedDelta; |
| + gfx::Size visibleScrollArea = layerImpl->visibleScrollArea(); |
| + if (scrollByPage) |
| + pendingDelta = gfx::ScaleVector2d(pendingDelta, visibleScrollArea.width(), visibleScrollArea.height()); |
|
jamesr
2013/03/06 23:50:37
This seems a bit strange. scrollByPage is only va
|
| + |
| if (m_topControlsManager && layerImpl == rootScrollLayer()) |
| pendingDelta = m_topControlsManager->ScrollBy(pendingDelta); |
| @@ -1281,6 +1286,13 @@ bool LayerTreeHostImpl::scrollBy(const gfx::Point& viewportPoint, |
| } else |
| appliedDelta = scrollLayerWithLocalDelta(*layerImpl, pendingDelta); |
| + if (scrollByPage) { |
| + if (visibleScrollArea.width() != 0.0) |
| + appliedDelta.set_x(appliedDelta.x() / visibleScrollArea.width()); |
| + if (visibleScrollArea.height() != 0.0) |
| + appliedDelta.set_y(appliedDelta.y() / visibleScrollArea.height()); |
| + } |
| + |
| // If the layer wasn't able to move, try the next one in the hierarchy. |
| float moveThresholdSquared = 0.1f * 0.1f; |
| if (appliedDelta.LengthSquared() < moveThresholdSquared) |