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

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

Issue 952893003: Update from https://crrev.com/317530 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix gn for nacl 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;
18 gfx::Vector2dF StretchAmount() const override; 19 gfx::Vector2dF StretchAmount() const override;
19 void SetStretchAmount(const gfx::Vector2dF& stretch_amount) override; 20 void SetStretchAmount(const gfx::Vector2dF& stretch_amount) override;
20 gfx::ScrollOffset ScrollOffset() const override; 21 gfx::ScrollOffset ScrollOffset() const override;
21 gfx::ScrollOffset MaxScrollOffset() const override; 22 gfx::ScrollOffset MaxScrollOffset() const override;
22 void ScrollBy(const gfx::Vector2dF& delta) override; 23 void ScrollBy(const gfx::Vector2dF& delta) override;
23 void RequestAnimate() override; 24 void RequestAnimate() override;
24 25
25 private: 26 private:
26 LayerTreeHostImpl* layer_tree_host_impl_; 27 LayerTreeHostImpl* layer_tree_host_impl_;
27 }; 28 };
28 29
29 ScrollElasticityHelperImpl::ScrollElasticityHelperImpl( 30 ScrollElasticityHelperImpl::ScrollElasticityHelperImpl(
30 LayerTreeHostImpl* layer_tree) 31 LayerTreeHostImpl* layer_tree)
31 : layer_tree_host_impl_(layer_tree) { 32 : layer_tree_host_impl_(layer_tree) {
32 } 33 }
33 34
34 ScrollElasticityHelperImpl::~ScrollElasticityHelperImpl() { 35 ScrollElasticityHelperImpl::~ScrollElasticityHelperImpl() {
35 } 36 }
36 37
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
37 gfx::Vector2dF ScrollElasticityHelperImpl::StretchAmount() const { 46 gfx::Vector2dF ScrollElasticityHelperImpl::StretchAmount() const {
38 return layer_tree_host_impl_->active_tree()->elastic_overscroll()->Current( 47 return layer_tree_host_impl_->active_tree()->elastic_overscroll()->Current(
39 true); 48 true);
40 } 49 }
41 50
42 void ScrollElasticityHelperImpl::SetStretchAmount( 51 void ScrollElasticityHelperImpl::SetStretchAmount(
43 const gfx::Vector2dF& stretch_amount) { 52 const gfx::Vector2dF& stretch_amount) {
44 if (stretch_amount == StretchAmount()) 53 if (stretch_amount == StretchAmount())
45 return; 54 return;
46 55
(...skipping 26 matching lines...) Expand all
73 layer_tree_host_impl_->SetNeedsAnimate(); 82 layer_tree_host_impl_->SetNeedsAnimate();
74 } 83 }
75 84
76 // static 85 // static
77 ScrollElasticityHelper* ScrollElasticityHelper::CreateForLayerTreeHostImpl( 86 ScrollElasticityHelper* ScrollElasticityHelper::CreateForLayerTreeHostImpl(
78 LayerTreeHostImpl* layer_tree_host_impl) { 87 LayerTreeHostImpl* layer_tree_host_impl) {
79 return new ScrollElasticityHelperImpl(layer_tree_host_impl); 88 return new ScrollElasticityHelperImpl(layer_tree_host_impl);
80 } 89 }
81 90
82 } // namespace cc 91 } // 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