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

Side by Side Diff: cc/layers/layer_impl.cc

Issue 608223002: [Android]Increase Scrollbar fade delay on Resize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 years, 2 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/layers/layer_impl.h ('k') | cc/layers/scrollbar_layer_impl_base.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/debug/trace_event_argument.h" 8 #include "base/debug/trace_event_argument.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 return gfx::ToCeiledSize(gfx::SizeF(bounds_.width() + bounds_delta_.x(), 775 return gfx::ToCeiledSize(gfx::SizeF(bounds_.width() + bounds_delta_.x(),
776 bounds_.height() + bounds_delta_.y())); 776 bounds_.height() + bounds_delta_.y()));
777 } 777 }
778 778
779 void LayerImpl::SetBounds(const gfx::Size& bounds) { 779 void LayerImpl::SetBounds(const gfx::Size& bounds) {
780 if (bounds_ == bounds) 780 if (bounds_ == bounds)
781 return; 781 return;
782 782
783 bounds_ = bounds; 783 bounds_ = bounds;
784 784
785 ScrollbarParametersDidChange(); 785 ScrollbarParametersDidChange(true);
786 if (masks_to_bounds()) 786 if (masks_to_bounds())
787 NoteLayerPropertyChangedForSubtree(); 787 NoteLayerPropertyChangedForSubtree();
788 else 788 else
789 NoteLayerPropertyChanged(); 789 NoteLayerPropertyChanged();
790 } 790 }
791 791
792 void LayerImpl::SetBoundsDelta(const gfx::Vector2dF& bounds_delta) { 792 void LayerImpl::SetBoundsDelta(const gfx::Vector2dF& bounds_delta) {
793 if (bounds_delta_ == bounds_delta) 793 if (bounds_delta_ == bounds_delta)
794 return; 794 return;
795 795
796 bounds_delta_ = bounds_delta; 796 bounds_delta_ = bounds_delta;
797 797
798 ScrollbarParametersDidChange(); 798 ScrollbarParametersDidChange(false);
799 if (masks_to_bounds()) 799 if (masks_to_bounds())
800 NoteLayerPropertyChangedForSubtree(); 800 NoteLayerPropertyChangedForSubtree();
801 else 801 else
802 NoteLayerPropertyChanged(); 802 NoteLayerPropertyChanged();
803 } 803 }
804 804
805 void LayerImpl::SetMaskLayer(scoped_ptr<LayerImpl> mask_layer) { 805 void LayerImpl::SetMaskLayer(scoped_ptr<LayerImpl> mask_layer) {
806 int new_layer_id = mask_layer ? mask_layer->id() : -1; 806 int new_layer_id = mask_layer ? mask_layer->id() : -1;
807 807
808 if (mask_layer) { 808 if (mask_layer) {
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 if (scroll_offset_delegate_) { 1115 if (scroll_offset_delegate_) {
1116 scroll_offset_delegate_->SetTotalScrollOffset( 1116 scroll_offset_delegate_->SetTotalScrollOffset(
1117 ScrollOffsetWithDelta(scroll_offset_, scroll_delta)); 1117 ScrollOffsetWithDelta(scroll_offset_, scroll_delta));
1118 } else { 1118 } else {
1119 scroll_delta_ = scroll_delta; 1119 scroll_delta_ = scroll_delta;
1120 } 1120 }
1121 } 1121 }
1122 1122
1123 if (changed) { 1123 if (changed) {
1124 NoteLayerPropertyChangedForSubtree(); 1124 NoteLayerPropertyChangedForSubtree();
1125 ScrollbarParametersDidChange(); 1125 ScrollbarParametersDidChange(false);
1126 } 1126 }
1127 } 1127 }
1128 1128
1129 gfx::Vector2dF LayerImpl::ScrollDelta() const { 1129 gfx::Vector2dF LayerImpl::ScrollDelta() const {
1130 if (scroll_offset_delegate_) { 1130 if (scroll_offset_delegate_) {
1131 return scroll_offset_delegate_->GetTotalScrollOffset().DeltaFrom( 1131 return scroll_offset_delegate_->GetTotalScrollOffset().DeltaFrom(
1132 scroll_offset_); 1132 scroll_offset_);
1133 } 1133 }
1134 return scroll_delta_; 1134 return scroll_delta_;
1135 } 1135 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 clamped_offset.SetToMin(max_offset); 1221 clamped_offset.SetToMin(max_offset);
1222 clamped_offset.SetToMax(gfx::ScrollOffset()); 1222 clamped_offset.SetToMax(gfx::ScrollOffset());
1223 gfx::Vector2dF delta = clamped_offset.DeltaFrom(old_offset); 1223 gfx::Vector2dF delta = clamped_offset.DeltaFrom(old_offset);
1224 if (!delta.IsZero()) 1224 if (!delta.IsZero())
1225 ScrollBy(delta); 1225 ScrollBy(delta);
1226 1226
1227 return delta; 1227 return delta;
1228 } 1228 }
1229 1229
1230 void LayerImpl::SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer, 1230 void LayerImpl::SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer,
1231 LayerImpl* scrollbar_clip_layer) const { 1231 LayerImpl* scrollbar_clip_layer,
1232 bool on_resize) const {
1232 DCHECK(scrollbar_layer); 1233 DCHECK(scrollbar_layer);
1233 LayerImpl* page_scale_layer = layer_tree_impl()->page_scale_layer(); 1234 LayerImpl* page_scale_layer = layer_tree_impl()->page_scale_layer();
1234 1235
1235 DCHECK(this != page_scale_layer); 1236 DCHECK(this != page_scale_layer);
1236 DCHECK(scrollbar_clip_layer); 1237 DCHECK(scrollbar_clip_layer);
1237 DCHECK(this != layer_tree_impl()->InnerViewportScrollLayer() || 1238 DCHECK(this != layer_tree_impl()->InnerViewportScrollLayer() ||
1238 IsContainerForFixedPositionLayers()); 1239 IsContainerForFixedPositionLayers());
1239 gfx::RectF clip_rect(gfx::PointF(), scrollbar_clip_layer->bounds()); 1240 gfx::RectF clip_rect(gfx::PointF(), scrollbar_clip_layer->bounds());
1240 1241
1241 // See comment in MaxScrollOffset() regarding the use of the content layer 1242 // See comment in MaxScrollOffset() regarding the use of the content layer
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 if (scrollbar_animation_controller_) { 1307 if (scrollbar_animation_controller_) {
1307 // When both non-overlay and overlay scrollbars are both present, don't 1308 // When both non-overlay and overlay scrollbars are both present, don't
1308 // animate the overlay scrollbars when page scale factor is at the min. 1309 // animate the overlay scrollbars when page scale factor is at the min.
1309 // Non-overlay scrollbars also shouldn't trigger animations. 1310 // Non-overlay scrollbars also shouldn't trigger animations.
1310 bool is_animatable_scrollbar = 1311 bool is_animatable_scrollbar =
1311 scrollbar_layer->is_overlay_scrollbar() && 1312 scrollbar_layer->is_overlay_scrollbar() &&
1312 ((layer_tree_impl()->total_page_scale_factor() > 1313 ((layer_tree_impl()->total_page_scale_factor() >
1313 layer_tree_impl()->min_page_scale_factor()) || 1314 layer_tree_impl()->min_page_scale_factor()) ||
1314 !layer_tree_impl()->settings().use_pinch_zoom_scrollbars); 1315 !layer_tree_impl()->settings().use_pinch_zoom_scrollbars);
1315 if (is_animatable_scrollbar) 1316 if (is_animatable_scrollbar)
1316 scrollbar_animation_controller_->DidScrollUpdate(); 1317 scrollbar_animation_controller_->DidScrollUpdate(on_resize);
1317 } 1318 }
1318 } 1319 }
1319 } 1320 }
1320 1321
1321 void LayerImpl::DidBecomeActive() { 1322 void LayerImpl::DidBecomeActive() {
1322 if (layer_tree_impl_->settings().scrollbar_animator == 1323 if (layer_tree_impl_->settings().scrollbar_animator ==
1323 LayerTreeSettings::NoAnimator) { 1324 LayerTreeSettings::NoAnimator) {
1324 return; 1325 return;
1325 } 1326 }
1326 1327
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 1370
1370 for (ScrollbarSet::iterator it = scrollbars_->begin(); 1371 for (ScrollbarSet::iterator it = scrollbars_->begin();
1371 it != scrollbars_->end(); 1372 it != scrollbars_->end();
1372 ++it) 1373 ++it)
1373 if ((*it)->orientation() == orientation) 1374 if ((*it)->orientation() == orientation)
1374 return true; 1375 return true;
1375 1376
1376 return false; 1377 return false;
1377 } 1378 }
1378 1379
1379 void LayerImpl::ScrollbarParametersDidChange() { 1380 void LayerImpl::ScrollbarParametersDidChange(bool on_resize) {
1380 if (!scrollbars_) 1381 if (!scrollbars_)
1381 return; 1382 return;
1382 1383
1383 for (ScrollbarSet::iterator it = scrollbars_->begin(); 1384 for (ScrollbarSet::iterator it = scrollbars_->begin();
1384 it != scrollbars_->end(); 1385 it != scrollbars_->end();
1385 ++it) 1386 ++it)
1386 (*it)->ScrollbarParametersDidChange(); 1387 (*it)->ScrollbarParametersDidChange(on_resize);
1387 } 1388 }
1388 1389
1389 void LayerImpl::SetNeedsPushProperties() { 1390 void LayerImpl::SetNeedsPushProperties() {
1390 if (needs_push_properties_) 1391 if (needs_push_properties_)
1391 return; 1392 return;
1392 if (!parent_should_know_need_push_properties() && parent_) 1393 if (!parent_should_know_need_push_properties() && parent_)
1393 parent_->AddDependentNeedsPushProperties(); 1394 parent_->AddDependentNeedsPushProperties();
1394 needs_push_properties_ = true; 1395 needs_push_properties_ = true;
1395 } 1396 }
1396 1397
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 } 1552 }
1552 1553
1553 void LayerImpl::NotifyAnimationFinished( 1554 void LayerImpl::NotifyAnimationFinished(
1554 base::TimeTicks monotonic_time, 1555 base::TimeTicks monotonic_time,
1555 Animation::TargetProperty target_property) { 1556 Animation::TargetProperty target_property) {
1556 if (target_property == Animation::ScrollOffset) 1557 if (target_property == Animation::ScrollOffset)
1557 layer_tree_impl_->InputScrollAnimationFinished(); 1558 layer_tree_impl_->InputScrollAnimationFinished();
1558 } 1559 }
1559 1560
1560 } // namespace cc 1561 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/scrollbar_layer_impl_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698