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

Side by Side Diff: cc/layer_impl.cc

Issue 12408028: cc: Delay start of scrollbar animation setNeedsRedraw. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to 188682 Created 7 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 | « cc/delay_based_time_source.cc ('k') | cc/layer_tree_host_impl.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layer_impl.h" 5 #include "cc/layer_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "cc/animation_registrar.h" 10 #include "cc/animation_registrar.h"
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 if (vertical_scrollbar_layer_) { 808 if (vertical_scrollbar_layer_) {
809 vertical_scrollbar_layer_->SetCurrentPos(current_offset.y()); 809 vertical_scrollbar_layer_->SetCurrentPos(current_offset.y());
810 vertical_scrollbar_layer_->SetTotalSize(bounds_.height()); 810 vertical_scrollbar_layer_->SetTotalSize(bounds_.height());
811 vertical_scrollbar_layer_->SetMaximum(max_scroll_offset_.y()); 811 vertical_scrollbar_layer_->SetMaximum(max_scroll_offset_.y());
812 } 812 }
813 813
814 if (current_offset == last_scroll_offset_) 814 if (current_offset == last_scroll_offset_)
815 return; 815 return;
816 last_scroll_offset_ = current_offset; 816 last_scroll_offset_ = current_offset;
817 817
818 if (scrollbar_animation_controller_) { 818 if (scrollbar_animation_controller_ &&
819 scrollbar_animation_controller_->didUpdateScrollOffset( 819 !scrollbar_animation_controller_->isScrollGestureInProgress()) {
820 scrollbar_animation_controller_->didProgrammaticallyUpdateScroll(
820 base::TimeTicks::Now()); 821 base::TimeTicks::Now());
821 } 822 }
822 823
823 // Get the current_offset_.y() value for a sanity-check on scrolling 824 // Get the current_offset_.y() value for a sanity-check on scrolling
824 // benchmark metrics. Specifically, we want to make sure 825 // benchmark metrics. Specifically, we want to make sure
825 // BasicMouseWheelSmoothScrollGesture has proper scroll curves. 826 // BasicMouseWheelSmoothScrollGesture has proper scroll curves.
826 if (layer_tree_impl()->IsActiveTree()) { 827 if (layer_tree_impl()->IsActiveTree()) {
827 TRACE_COUNTER_ID1("gpu", "scroll_offset_y", this->id(), current_offset.y()); 828 TRACE_COUNTER_ID1("gpu", "scroll_offset_y", this->id(), current_offset.y());
828 } 829 }
829 } 830 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 900
900 void LayerImpl::SetScrollbarOpacity(float opacity) { 901 void LayerImpl::SetScrollbarOpacity(float opacity) {
901 if (horizontal_scrollbar_layer_) 902 if (horizontal_scrollbar_layer_)
902 horizontal_scrollbar_layer_->SetOpacity(opacity); 903 horizontal_scrollbar_layer_->SetOpacity(opacity);
903 if (vertical_scrollbar_layer_) 904 if (vertical_scrollbar_layer_)
904 vertical_scrollbar_layer_->SetOpacity(opacity); 905 vertical_scrollbar_layer_->SetOpacity(opacity);
905 } 906 }
906 907
907 inline scoped_ptr<ScrollbarAnimationController> 908 inline scoped_ptr<ScrollbarAnimationController>
908 CreateScrollbarAnimationControllerWithFade(LayerImpl* layer) { 909 CreateScrollbarAnimationControllerWithFade(LayerImpl* layer) {
909 double fadeout_delay = 0.3; 910 base::TimeDelta fadeout_delay = base::TimeDelta::FromMilliseconds(300);
910 double fadeout_length = 0.3; 911 base::TimeDelta fadeout_length = base::TimeDelta::FromMilliseconds(300);
911 return ScrollbarAnimationControllerLinearFade::create( 912 return ScrollbarAnimationControllerLinearFade::create(
912 layer, fadeout_delay, fadeout_length) 913 layer, fadeout_delay, fadeout_length)
913 .PassAs<ScrollbarAnimationController>(); 914 .PassAs<ScrollbarAnimationController>();
914 } 915 }
915 916
916 void LayerImpl::DidBecomeActive() { 917 void LayerImpl::DidBecomeActive() {
917 if (!layer_tree_impl_->settings().useLinearFadeScrollbarAnimator) 918 if (!layer_tree_impl_->settings().useLinearFadeScrollbarAnimator)
918 return; 919 return;
919 920
920 bool need_scrollbar_animation_controller = horizontal_scrollbar_layer_ || 921 bool need_scrollbar_animation_controller = horizontal_scrollbar_layer_ ||
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 957
957 } 958 }
958 959
959 scoped_ptr<base::Value> LayerImpl::AsValue() const { 960 scoped_ptr<base::Value> LayerImpl::AsValue() const {
960 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 961 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
961 AsValueInto(state.get()); 962 AsValueInto(state.get());
962 return state.PassAs<base::Value>(); 963 return state.PassAs<base::Value>();
963 } 964 }
964 965
965 } // namespace cc 966 } // namespace cc
OLDNEW
« no previous file with comments | « cc/delay_based_time_source.cc ('k') | cc/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698