| Index: cc/input/scroll_elasticity_helper.cc
|
| diff --git a/cc/input/scroll_elasticity_helper.cc b/cc/input/scroll_elasticity_helper.cc
|
| index 7065e86a4911e236cecbf1912d9e87bd53cbc037..1e9fe7dff9f59fd482a286d89fc8dc5a613ac2aa 100644
|
| --- a/cc/input/scroll_elasticity_helper.cc
|
| +++ b/cc/input/scroll_elasticity_helper.cc
|
| @@ -13,15 +13,13 @@ namespace cc {
|
| class ScrollElasticityHelperImpl : public ScrollElasticityHelper {
|
| public:
|
| explicit ScrollElasticityHelperImpl(LayerTreeHostImpl* layer_tree_host_impl);
|
| - virtual ~ScrollElasticityHelperImpl();
|
| + ~ScrollElasticityHelperImpl() override;
|
|
|
| - // The amount that the view is stretched past the normal allowable bounds.
|
| - // The "overhang" amount.
|
| - gfx::Vector2dF StretchAmount() override;
|
| + gfx::Vector2dF StretchAmount() const override;
|
| void SetStretchAmount(const gfx::Vector2dF& stretch_amount) override;
|
| - bool PinnedInDirection(const gfx::Vector2dF& direction) override;
|
| - bool CanScrollHorizontally() override;
|
| - bool CanScrollVertically() override;
|
| + gfx::ScrollOffset ScrollOffset() const override;
|
| + gfx::ScrollOffset MaxScrollOffset() const override;
|
| + void ScrollBy(const gfx::Vector2dF& delta) override;
|
| void RequestAnimate() override;
|
|
|
| private:
|
| @@ -36,8 +34,8 @@ ScrollElasticityHelperImpl::ScrollElasticityHelperImpl(
|
| ScrollElasticityHelperImpl::~ScrollElasticityHelperImpl() {
|
| }
|
|
|
| -gfx::Vector2dF ScrollElasticityHelperImpl::StretchAmount() {
|
| - return -layer_tree_host_impl_->active_tree()->elastic_overscroll()->Current(
|
| +gfx::Vector2dF ScrollElasticityHelperImpl::StretchAmount() const {
|
| + return layer_tree_host_impl_->active_tree()->elastic_overscroll()->Current(
|
| true);
|
| }
|
|
|
| @@ -47,37 +45,28 @@ void ScrollElasticityHelperImpl::SetStretchAmount(
|
| return;
|
|
|
| layer_tree_host_impl_->active_tree()->elastic_overscroll()->SetCurrent(
|
| - -stretch_amount);
|
| + stretch_amount);
|
| layer_tree_host_impl_->active_tree()->set_needs_update_draw_properties();
|
| layer_tree_host_impl_->SetNeedsCommit();
|
| layer_tree_host_impl_->SetNeedsRedraw();
|
| layer_tree_host_impl_->SetFullRootLayerDamage();
|
| }
|
|
|
| -bool ScrollElasticityHelperImpl::PinnedInDirection(
|
| - const gfx::Vector2dF& direction) {
|
| - gfx::ScrollOffset scroll_offset =
|
| - layer_tree_host_impl_->active_tree()->TotalScrollOffset();
|
| - gfx::ScrollOffset max_scroll_offset =
|
| - layer_tree_host_impl_->active_tree()->TotalMaxScrollOffset();
|
| - bool result = false;
|
| - if (direction.x() < 0)
|
| - result |= scroll_offset.x() <= 0;
|
| - if (direction.x() > 0)
|
| - result |= scroll_offset.x() >= max_scroll_offset.x();
|
| - if (direction.y() < 0)
|
| - result |= scroll_offset.y() <= 0;
|
| - if (direction.y() > 0)
|
| - result |= scroll_offset.y() >= max_scroll_offset.y();
|
| - return result;
|
| +gfx::ScrollOffset ScrollElasticityHelperImpl::ScrollOffset() const {
|
| + return layer_tree_host_impl_->active_tree()->TotalScrollOffset();
|
| }
|
|
|
| -bool ScrollElasticityHelperImpl::CanScrollHorizontally() {
|
| - return layer_tree_host_impl_->active_tree()->TotalMaxScrollOffset().x() > 0;
|
| +gfx::ScrollOffset ScrollElasticityHelperImpl::MaxScrollOffset() const {
|
| + return layer_tree_host_impl_->active_tree()->TotalMaxScrollOffset();
|
| }
|
|
|
| -bool ScrollElasticityHelperImpl::CanScrollVertically() {
|
| - return layer_tree_host_impl_->active_tree()->TotalMaxScrollOffset().y() > 0;
|
| +void ScrollElasticityHelperImpl::ScrollBy(const gfx::Vector2dF& delta) {
|
| + LayerImpl* root_scroll_layer =
|
| + layer_tree_host_impl_->OuterViewportScrollLayer()
|
| + ? layer_tree_host_impl_->OuterViewportScrollLayer()
|
| + : layer_tree_host_impl_->InnerViewportScrollLayer();
|
| + if (root_scroll_layer)
|
| + root_scroll_layer->ScrollBy(delta);
|
| }
|
|
|
| void ScrollElasticityHelperImpl::RequestAnimate() {
|
|
|