OLD | NEW |
---|---|
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 Loading... | |
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 |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1219 clamped_offset.SetToMin(max_offset); | 1219 clamped_offset.SetToMin(max_offset); |
1220 clamped_offset.SetToMax(gfx::Vector2d()); | 1220 clamped_offset.SetToMax(gfx::Vector2d()); |
1221 gfx::Vector2dF delta = clamped_offset - old_offset; | 1221 gfx::Vector2dF delta = clamped_offset - old_offset; |
1222 if (!delta.IsZero()) | 1222 if (!delta.IsZero()) |
1223 ScrollBy(delta); | 1223 ScrollBy(delta); |
1224 | 1224 |
1225 return delta; | 1225 return delta; |
1226 } | 1226 } |
1227 | 1227 |
1228 void LayerImpl::SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer, | 1228 void LayerImpl::SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer, |
1229 LayerImpl* scrollbar_clip_layer) const { | 1229 LayerImpl* scrollbar_clip_layer, |
1230 bool on_resize) const { | |
aelias_OOO_until_Jul13
2014/09/30 18:55:27
I don't think the new argument is needed here. Yo
MuVen
2014/10/01 16:45:51
Done.
| |
1230 DCHECK(scrollbar_layer); | 1231 DCHECK(scrollbar_layer); |
1231 LayerImpl* page_scale_layer = layer_tree_impl()->page_scale_layer(); | 1232 LayerImpl* page_scale_layer = layer_tree_impl()->page_scale_layer(); |
1232 | 1233 |
1233 DCHECK(this != page_scale_layer); | 1234 DCHECK(this != page_scale_layer); |
1234 DCHECK(scrollbar_clip_layer); | 1235 DCHECK(scrollbar_clip_layer); |
1235 DCHECK(this != layer_tree_impl()->InnerViewportScrollLayer() || | 1236 DCHECK(this != layer_tree_impl()->InnerViewportScrollLayer() || |
1236 IsContainerForFixedPositionLayers()); | 1237 IsContainerForFixedPositionLayers()); |
1237 gfx::RectF clip_rect(gfx::PointF(), scrollbar_clip_layer->bounds()); | 1238 gfx::RectF clip_rect(gfx::PointF(), scrollbar_clip_layer->bounds()); |
1238 | 1239 |
1239 // See comment in MaxScrollOffset() regarding the use of the content layer | 1240 // See comment in MaxScrollOffset() regarding the use of the content layer |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1304 if (scrollbar_animation_controller_) { | 1305 if (scrollbar_animation_controller_) { |
1305 // When both non-overlay and overlay scrollbars are both present, don't | 1306 // When both non-overlay and overlay scrollbars are both present, don't |
1306 // animate the overlay scrollbars when page scale factor is at the min. | 1307 // animate the overlay scrollbars when page scale factor is at the min. |
1307 // Non-overlay scrollbars also shouldn't trigger animations. | 1308 // Non-overlay scrollbars also shouldn't trigger animations. |
1308 bool is_animatable_scrollbar = | 1309 bool is_animatable_scrollbar = |
1309 scrollbar_layer->is_overlay_scrollbar() && | 1310 scrollbar_layer->is_overlay_scrollbar() && |
1310 ((layer_tree_impl()->total_page_scale_factor() > | 1311 ((layer_tree_impl()->total_page_scale_factor() > |
1311 layer_tree_impl()->min_page_scale_factor()) || | 1312 layer_tree_impl()->min_page_scale_factor()) || |
1312 !layer_tree_impl()->settings().use_pinch_zoom_scrollbars); | 1313 !layer_tree_impl()->settings().use_pinch_zoom_scrollbars); |
1313 if (is_animatable_scrollbar) | 1314 if (is_animatable_scrollbar) |
1314 scrollbar_animation_controller_->DidScrollUpdate(); | 1315 scrollbar_animation_controller_->DidScrollUpdate(on_resize); |
1315 } | 1316 } |
1316 } | 1317 } |
1317 } | 1318 } |
1318 | 1319 |
1319 void LayerImpl::DidBecomeActive() { | 1320 void LayerImpl::DidBecomeActive() { |
1320 if (layer_tree_impl_->settings().scrollbar_animator == | 1321 if (layer_tree_impl_->settings().scrollbar_animator == |
1321 LayerTreeSettings::NoAnimator) { | 1322 LayerTreeSettings::NoAnimator) { |
1322 return; | 1323 return; |
1323 } | 1324 } |
1324 | 1325 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1367 | 1368 |
1368 for (ScrollbarSet::iterator it = scrollbars_->begin(); | 1369 for (ScrollbarSet::iterator it = scrollbars_->begin(); |
1369 it != scrollbars_->end(); | 1370 it != scrollbars_->end(); |
1370 ++it) | 1371 ++it) |
1371 if ((*it)->orientation() == orientation) | 1372 if ((*it)->orientation() == orientation) |
1372 return true; | 1373 return true; |
1373 | 1374 |
1374 return false; | 1375 return false; |
1375 } | 1376 } |
1376 | 1377 |
1377 void LayerImpl::ScrollbarParametersDidChange() { | 1378 void LayerImpl::ScrollbarParametersDidChange(bool on_resize) { |
1378 if (!scrollbars_) | 1379 if (!scrollbars_) |
1379 return; | 1380 return; |
1380 | 1381 |
1381 for (ScrollbarSet::iterator it = scrollbars_->begin(); | 1382 for (ScrollbarSet::iterator it = scrollbars_->begin(); |
1382 it != scrollbars_->end(); | 1383 it != scrollbars_->end(); |
1383 ++it) | 1384 ++it) |
1384 (*it)->ScrollbarParametersDidChange(); | 1385 (*it)->ScrollbarParametersDidChange(on_resize); |
1385 } | 1386 } |
1386 | 1387 |
1387 void LayerImpl::SetNeedsPushProperties() { | 1388 void LayerImpl::SetNeedsPushProperties() { |
1388 if (needs_push_properties_) | 1389 if (needs_push_properties_) |
1389 return; | 1390 return; |
1390 if (!parent_should_know_need_push_properties() && parent_) | 1391 if (!parent_should_know_need_push_properties() && parent_) |
1391 parent_->AddDependentNeedsPushProperties(); | 1392 parent_->AddDependentNeedsPushProperties(); |
1392 needs_push_properties_ = true; | 1393 needs_push_properties_ = true; |
1393 } | 1394 } |
1394 | 1395 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1549 } | 1550 } |
1550 | 1551 |
1551 void LayerImpl::NotifyAnimationFinished( | 1552 void LayerImpl::NotifyAnimationFinished( |
1552 base::TimeTicks monotonic_time, | 1553 base::TimeTicks monotonic_time, |
1553 Animation::TargetProperty target_property) { | 1554 Animation::TargetProperty target_property) { |
1554 if (target_property == Animation::ScrollOffset) | 1555 if (target_property == Animation::ScrollOffset) |
1555 layer_tree_impl_->InputScrollAnimationFinished(); | 1556 layer_tree_impl_->InputScrollAnimationFinished(); |
1556 } | 1557 } |
1557 | 1558 |
1558 } // namespace cc | 1559 } // namespace cc |
OLD | NEW |