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

Side by Side Diff: content/browser/android/overscroll_glow.cc

Issue 993613007: [Android] Add slack to allow refresh after overscrolling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 5 years, 9 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 | « content/browser/android/overscroll_glow.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/android/overscroll_glow.h" 5 #include "content/browser/android/overscroll_glow.h"
6 6
7 #include "cc/layers/layer.h" 7 #include "cc/layers/layer.h"
8 #include "content/browser/android/edge_effect_base.h" 8 #include "content/browser/android/edge_effect_base.h"
9 9
10 using std::max; 10 using std::max;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 bool OverscrollGlow::IsActive() const { 95 bool OverscrollGlow::IsActive() const {
96 if (!initialized_) 96 if (!initialized_)
97 return false; 97 return false;
98 for (size_t i = 0; i < EDGE_COUNT; ++i) { 98 for (size_t i = 0; i < EDGE_COUNT; ++i) {
99 if (!edge_effects_[i]->IsFinished()) 99 if (!edge_effects_[i]->IsFinished())
100 return true; 100 return true;
101 } 101 }
102 return false; 102 return false;
103 } 103 }
104 104
105 float OverscrollGlow::GetVisibleAlpha() const {
106 float max_alpha = 0;
107 for (size_t i = 0; i < EDGE_COUNT; ++i) {
108 if (!edge_effects_[i]->IsFinished())
109 max_alpha = std::max(max_alpha, edge_effects_[i]->GetAlpha());
110 }
111 return std::min(max_alpha, 1.f);
112 }
113
105 bool OverscrollGlow::OnOverscrolled(base::TimeTicks current_time, 114 bool OverscrollGlow::OnOverscrolled(base::TimeTicks current_time,
106 gfx::Vector2dF accumulated_overscroll, 115 gfx::Vector2dF accumulated_overscroll,
107 gfx::Vector2dF overscroll_delta, 116 gfx::Vector2dF overscroll_delta,
108 gfx::Vector2dF velocity, 117 gfx::Vector2dF velocity,
109 gfx::Vector2dF displacement) { 118 gfx::Vector2dF displacement) {
110 // The size of the glow determines the relative effect of the inputs; an 119 // The size of the glow determines the relative effect of the inputs; an
111 // empty-sized effect is effectively disabled. 120 // empty-sized effect is effectively disabled.
112 if (viewport_size_.IsEmpty()) 121 if (viewport_size_.IsEmpty())
113 return false; 122 return false;
114 123
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 for (size_t i = 0; i < EDGE_COUNT; ++i) 297 for (size_t i = 0; i < EDGE_COUNT; ++i)
289 edge_effects_[i]->Release(current_time); 298 edge_effects_[i]->Release(current_time);
290 } 299 }
291 300
292 EdgeEffectBase* OverscrollGlow::GetOppositeEdge(int edge_index) { 301 EdgeEffectBase* OverscrollGlow::GetOppositeEdge(int edge_index) {
293 DCHECK(initialized_); 302 DCHECK(initialized_);
294 return edge_effects_[(edge_index + 2) % EDGE_COUNT].get(); 303 return edge_effects_[(edge_index + 2) % EDGE_COUNT].get();
295 } 304 }
296 305
297 } // namespace content 306 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/overscroll_glow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698