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

Side by Side Diff: cc/input/scroll_elasticity_helper.cc

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months 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
« no previous file with comments | « cc/input/scroll_elasticity_helper.h ('k') | cc/layers/content_layer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/input/scroll_elasticity_helper.h" 5 #include "cc/input/scroll_elasticity_helper.h"
6 6
7 #include "cc/layers/layer_impl.h" 7 #include "cc/layers/layer_impl.h"
8 #include "cc/trees/layer_tree_host_impl.h" 8 #include "cc/trees/layer_tree_host_impl.h"
9 #include "cc/trees/layer_tree_impl.h" 9 #include "cc/trees/layer_tree_impl.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 class ScrollElasticityHelperImpl : public ScrollElasticityHelper { 13 class ScrollElasticityHelperImpl : public ScrollElasticityHelper {
14 public: 14 public:
15 explicit ScrollElasticityHelperImpl(LayerTreeHostImpl* layer_tree_host_impl); 15 explicit ScrollElasticityHelperImpl(LayerTreeHostImpl* layer_tree_host_impl);
16 ~ScrollElasticityHelperImpl() override; 16 ~ScrollElasticityHelperImpl() override;
17 17
18 bool IsUserScrollable() const override;
19 gfx::Vector2dF StretchAmount() const override; 18 gfx::Vector2dF StretchAmount() const override;
20 void SetStretchAmount(const gfx::Vector2dF& stretch_amount) override; 19 void SetStretchAmount(const gfx::Vector2dF& stretch_amount) override;
21 gfx::ScrollOffset ScrollOffset() const override; 20 gfx::ScrollOffset ScrollOffset() const override;
22 gfx::ScrollOffset MaxScrollOffset() const override; 21 gfx::ScrollOffset MaxScrollOffset() const override;
23 void ScrollBy(const gfx::Vector2dF& delta) override; 22 void ScrollBy(const gfx::Vector2dF& delta) override;
24 void RequestAnimate() override; 23 void RequestAnimate() override;
25 24
26 private: 25 private:
27 LayerTreeHostImpl* layer_tree_host_impl_; 26 LayerTreeHostImpl* layer_tree_host_impl_;
28 }; 27 };
29 28
30 ScrollElasticityHelperImpl::ScrollElasticityHelperImpl( 29 ScrollElasticityHelperImpl::ScrollElasticityHelperImpl(
31 LayerTreeHostImpl* layer_tree) 30 LayerTreeHostImpl* layer_tree)
32 : layer_tree_host_impl_(layer_tree) { 31 : layer_tree_host_impl_(layer_tree) {
33 } 32 }
34 33
35 ScrollElasticityHelperImpl::~ScrollElasticityHelperImpl() { 34 ScrollElasticityHelperImpl::~ScrollElasticityHelperImpl() {
36 } 35 }
37 36
38 bool ScrollElasticityHelperImpl::IsUserScrollable() const {
39 LayerImpl* layer = layer_tree_host_impl_->OuterViewportScrollLayer();
40 if (!layer)
41 return false;
42 return layer->user_scrollable_horizontal() ||
43 layer->user_scrollable_vertical();
44 }
45
46 gfx::Vector2dF ScrollElasticityHelperImpl::StretchAmount() const { 37 gfx::Vector2dF ScrollElasticityHelperImpl::StretchAmount() const {
47 return layer_tree_host_impl_->active_tree()->elastic_overscroll()->Current( 38 return layer_tree_host_impl_->active_tree()->elastic_overscroll()->Current(
48 true); 39 true);
49 } 40 }
50 41
51 void ScrollElasticityHelperImpl::SetStretchAmount( 42 void ScrollElasticityHelperImpl::SetStretchAmount(
52 const gfx::Vector2dF& stretch_amount) { 43 const gfx::Vector2dF& stretch_amount) {
53 if (stretch_amount == StretchAmount()) 44 if (stretch_amount == StretchAmount())
54 return; 45 return;
55 46
(...skipping 26 matching lines...) Expand all
82 layer_tree_host_impl_->SetNeedsAnimate(); 73 layer_tree_host_impl_->SetNeedsAnimate();
83 } 74 }
84 75
85 // static 76 // static
86 ScrollElasticityHelper* ScrollElasticityHelper::CreateForLayerTreeHostImpl( 77 ScrollElasticityHelper* ScrollElasticityHelper::CreateForLayerTreeHostImpl(
87 LayerTreeHostImpl* layer_tree_host_impl) { 78 LayerTreeHostImpl* layer_tree_host_impl) {
88 return new ScrollElasticityHelperImpl(layer_tree_host_impl); 79 return new ScrollElasticityHelperImpl(layer_tree_host_impl);
89 } 80 }
90 81
91 } // namespace cc 82 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/scroll_elasticity_helper.h ('k') | cc/layers/content_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698