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

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

Issue 2740493003: Call setNeedsRedraw when scrollbar opacity changes. (Closed)
Patch Set: Fix test that was causing redraw during initialization Created 3 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 | « no previous file | cc/trees/layer_tree_host_impl.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/scrollbar_animation_controller.h" 5 #include "cc/input/scrollbar_animation_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "cc/trees/layer_tree_impl.h" 10 #include "cc/trees/layer_tree_impl.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 float ScrollbarAnimationController::AnimationProgressAtTime( 164 float ScrollbarAnimationController::AnimationProgressAtTime(
165 base::TimeTicks now) { 165 base::TimeTicks now) {
166 base::TimeDelta delta = now - last_awaken_time_; 166 base::TimeDelta delta = now - last_awaken_time_;
167 float progress = delta.InSecondsF() / fade_out_duration_.InSecondsF(); 167 float progress = delta.InSecondsF() / fade_out_duration_.InSecondsF();
168 return std::max(std::min(progress, 1.f), 0.f); 168 return std::max(std::min(progress, 1.f), 0.f);
169 } 169 }
170 170
171 void ScrollbarAnimationController::RunAnimationFrame(float progress) { 171 void ScrollbarAnimationController::RunAnimationFrame(float progress) {
172 ApplyOpacityToScrollbars(1.f - progress); 172 ApplyOpacityToScrollbars(1.f - progress);
173 client_->SetNeedsRedrawForScrollbarAnimation();
174 if (progress == 1.f) 173 if (progress == 1.f)
175 StopAnimation(); 174 StopAnimation();
176 } 175 }
177 176
178 void ScrollbarAnimationController::DidScrollBegin() { 177 void ScrollbarAnimationController::DidScrollBegin() {
179 currently_scrolling_ = true; 178 currently_scrolling_ = true;
180 } 179 }
181 180
182 void ScrollbarAnimationController::DidScrollEnd() { 181 void ScrollbarAnimationController::DidScrollEnd() {
183 bool has_scrolled = scroll_gesture_has_scrolled_; 182 bool has_scrolled = scroll_gesture_has_scrolled_;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 property_trees->effect_tree.OnOpacityAnimated( 369 property_trees->effect_tree.OnOpacityAnimated(
371 effective_opacity, 370 effective_opacity,
372 property_trees->layer_id_to_effect_node_index[scrollbar->id()], 371 property_trees->layer_id_to_effect_node_index[scrollbar->id()],
373 scrollbar->layer_tree_impl()); 372 scrollbar->layer_tree_impl());
374 } 373 }
375 } 374 }
376 375
377 bool previouslyVisible = opacity_ > 0.0f; 376 bool previouslyVisible = opacity_ > 0.0f;
378 bool currentlyVisible = opacity > 0.0f; 377 bool currentlyVisible = opacity > 0.0f;
379 378
379 if (opacity_ != opacity)
380 client_->SetNeedsRedrawForScrollbarAnimation();
381
380 opacity_ = opacity; 382 opacity_ = opacity;
381 383
382 if (previouslyVisible != currentlyVisible) 384 if (previouslyVisible != currentlyVisible)
383 client_->DidChangeScrollbarVisibility(); 385 client_->DidChangeScrollbarVisibility();
384 } 386 }
385 387
386 } // namespace cc 388 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698