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

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

Issue 786123002: Update from https://crrev.com/307330 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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/cc.gyp ('k') | cc/input/top_controls_manager_unittest.cc » ('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
(...skipping 14 matching lines...) Expand all
25 // TODO(ccameron): This is function is redundant and may be removed. 25 // TODO(ccameron): This is function is redundant and may be removed.
26 return true; 26 return true;
27 } 27 }
28 28
29 bool ScrollElasticityHelper::AllowsVerticalStretching() { 29 bool ScrollElasticityHelper::AllowsVerticalStretching() {
30 // TODO(ccameron): This is function is redundant and may be removed. 30 // TODO(ccameron): This is function is redundant and may be removed.
31 return true; 31 return true;
32 } 32 }
33 33
34 gfx::Vector2dF ScrollElasticityHelper::StretchAmount() { 34 gfx::Vector2dF ScrollElasticityHelper::StretchAmount() {
35 // TODO(ccameron): Use the value of active_tree->elastic_overscroll directly
35 return stretch_offset_; 36 return stretch_offset_;
36 } 37 }
37 38
38 bool ScrollElasticityHelper::PinnedInDirection( 39 bool ScrollElasticityHelper::PinnedInDirection(
39 const gfx::Vector2dF& direction) { 40 const gfx::Vector2dF& direction) {
40 gfx::ScrollOffset scroll_offset = 41 gfx::ScrollOffset scroll_offset =
41 layer_tree_host_impl_->active_tree()->TotalScrollOffset(); 42 layer_tree_host_impl_->active_tree()->TotalScrollOffset();
42 gfx::ScrollOffset max_scroll_offset = 43 gfx::ScrollOffset max_scroll_offset =
43 layer_tree_host_impl_->active_tree()->TotalMaxScrollOffset(); 44 layer_tree_host_impl_->active_tree()->TotalMaxScrollOffset();
44 bool result = false; 45 bool result = false;
(...skipping 11 matching lines...) Expand all
56 bool ScrollElasticityHelper::CanScrollHorizontally() { 57 bool ScrollElasticityHelper::CanScrollHorizontally() {
57 return layer_tree_host_impl_->active_tree()->TotalMaxScrollOffset().x() > 0; 58 return layer_tree_host_impl_->active_tree()->TotalMaxScrollOffset().x() > 0;
58 } 59 }
59 60
60 bool ScrollElasticityHelper::CanScrollVertically() { 61 bool ScrollElasticityHelper::CanScrollVertically() {
61 return layer_tree_host_impl_->active_tree()->TotalMaxScrollOffset().y() > 0; 62 return layer_tree_host_impl_->active_tree()->TotalMaxScrollOffset().y() > 0;
62 } 63 }
63 64
64 gfx::Vector2dF ScrollElasticityHelper::AbsoluteScrollPosition() { 65 gfx::Vector2dF ScrollElasticityHelper::AbsoluteScrollPosition() {
65 // TODO(ccameron): This is function is redundant and may be removed. 66 // TODO(ccameron): This is function is redundant and may be removed.
66 return stretch_offset_; 67 return StretchAmount();
67 } 68 }
68 69
69 void ScrollElasticityHelper::ImmediateScrollBy(const gfx::Vector2dF& scroll) { 70 void ScrollElasticityHelper::ImmediateScrollBy(const gfx::Vector2dF& scroll) {
70 // TODO(ccameron): This is function is redundant and may be removed. 71 // TODO(ccameron): This is function is redundant and may be removed.
71 } 72 }
72 73
73 void ScrollElasticityHelper::ImmediateScrollByWithoutContentEdgeConstraints( 74 void ScrollElasticityHelper::ImmediateScrollByWithoutContentEdgeConstraints(
74 const gfx::Vector2dF& scroll) { 75 const gfx::Vector2dF& scroll) {
75 stretch_offset_ += scroll; 76 stretch_offset_ += scroll;
76 77 // TODO(ccameron): Use the value of active_tree->elastic_overscroll directly
77 // TODO(ccameron): Update the transform of the appropriate layer in the 78 // Note that this assumes that this property's true value is ever changed
78 // LayerTreeHostImpl, and request that a frame be drawn. 79 // by the impl thread. While this is true, it is redundant state.
80 layer_tree_host_impl_->active_tree()->elastic_overscroll()->SetCurrent(
81 -stretch_offset_);
82 layer_tree_host_impl_->active_tree()->set_needs_update_draw_properties();
83 layer_tree_host_impl_->SetNeedsCommit();
84 layer_tree_host_impl_->SetNeedsRedraw();
79 } 85 }
80 86
81 void ScrollElasticityHelper::StartSnapRubberbandTimer() { 87 void ScrollElasticityHelper::StartSnapRubberbandTimer() {
82 if (timer_active_) 88 if (timer_active_)
83 return; 89 return;
84 timer_active_ = true; 90 timer_active_ = true;
85 layer_tree_host_impl_->SetNeedsAnimate(); 91 layer_tree_host_impl_->SetNeedsAnimate();
86 } 92 }
87 93
88 void ScrollElasticityHelper::StopSnapRubberbandTimer() { 94 void ScrollElasticityHelper::StopSnapRubberbandTimer() {
89 timer_active_ = false; 95 timer_active_ = false;
90 } 96 }
91 97
92 void ScrollElasticityHelper::SnapRubberbandTimerFired() { 98 void ScrollElasticityHelper::SnapRubberbandTimerFired() {
93 if (timer_active_) 99 if (timer_active_)
94 layer_tree_host_impl_->SetNeedsAnimate(); 100 layer_tree_host_impl_->SetNeedsAnimate();
95 } 101 }
96 102
97 void ScrollElasticityHelper::AdjustScrollPositionToBoundsIfNecessary() { 103 void ScrollElasticityHelper::AdjustScrollPositionToBoundsIfNecessary() {
98 // TODO(ccameron): This is function is redundant and may be removed. 104 // TODO(ccameron): This is function is redundant and may be removed.
99 } 105 }
100 106
101 } // namespace cc 107 } // namespace cc
OLDNEW
« no previous file with comments | « cc/cc.gyp ('k') | cc/input/top_controls_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698