Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/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/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "cc/animation/animation_registrar.h" | 9 #include "cc/animation/animation_registrar.h" |
| 10 #include "cc/animation/scrollbar_animation_controller.h" | 10 #include "cc/animation/scrollbar_animation_controller.h" |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 layer->SetPosition(position_); | 512 layer->SetPosition(position_); |
| 513 layer->SetIsContainerForFixedPositionLayers( | 513 layer->SetIsContainerForFixedPositionLayers( |
| 514 is_container_for_fixed_position_layers_); | 514 is_container_for_fixed_position_layers_); |
| 515 layer->SetFixedContainerSizeDelta(fixed_container_size_delta_); | 515 layer->SetFixedContainerSizeDelta(fixed_container_size_delta_); |
| 516 layer->SetPositionConstraint(position_constraint_); | 516 layer->SetPositionConstraint(position_constraint_); |
| 517 layer->SetPreserves3d(preserves_3d()); | 517 layer->SetPreserves3d(preserves_3d()); |
| 518 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); | 518 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); |
| 519 layer->SetSublayerTransform(sublayer_transform_); | 519 layer->SetSublayerTransform(sublayer_transform_); |
| 520 layer->SetTransform(transform_); | 520 layer->SetTransform(transform_); |
| 521 | 521 |
| 522 layer->SetMaxScrollOffset(max_scroll_offset_); | |
|
aelias_OOO_until_Jul13
2013/09/24 22:03:19
nit: moving this line for no reason?
mkosiba (inactive)
2013/09/25 14:23:49
Done.
| |
| 523 | |
| 522 layer->SetScrollable(scrollable_); | 524 layer->SetScrollable(scrollable_); |
| 523 layer->SetScrollOffsetAndDelta( | 525 layer->SetScrollOffsetAndDelta( |
| 524 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta()); | 526 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta()); |
| 525 layer->SetSentScrollDelta(gfx::Vector2d()); | 527 layer->SetSentScrollDelta(gfx::Vector2d()); |
| 526 | 528 |
| 527 layer->SetMaxScrollOffset(max_scroll_offset_); | |
| 528 | |
| 529 LayerImpl* scroll_parent = NULL; | 529 LayerImpl* scroll_parent = NULL; |
| 530 if (scroll_parent_) | 530 if (scroll_parent_) |
| 531 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); | 531 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); |
| 532 | 532 |
| 533 layer->SetScrollParent(scroll_parent); | 533 layer->SetScrollParent(scroll_parent); |
| 534 if (scroll_children_) { | 534 if (scroll_children_) { |
| 535 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; | 535 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; |
| 536 for (std::set<LayerImpl*>::iterator it = scroll_children_->begin(); | 536 for (std::set<LayerImpl*>::iterator it = scroll_children_->begin(); |
| 537 it != scroll_children_->end(); ++it) | 537 it != scroll_children_->end(); ++it) |
| 538 scroll_children->insert(layer->layer_tree_impl()->LayerById((*it)->id())); | 538 scroll_children->insert(layer->layer_tree_impl()->LayerById((*it)->id())); |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 994 void LayerImpl::SetScrollOffsetDelegate( | 994 void LayerImpl::SetScrollOffsetDelegate( |
| 995 LayerScrollOffsetDelegate* scroll_offset_delegate) { | 995 LayerScrollOffsetDelegate* scroll_offset_delegate) { |
| 996 // Having both a scroll parent and a scroll offset delegate is unsupported. | 996 // Having both a scroll parent and a scroll offset delegate is unsupported. |
| 997 DCHECK(!scroll_parent_); | 997 DCHECK(!scroll_parent_); |
| 998 if (!scroll_offset_delegate && scroll_offset_delegate_) { | 998 if (!scroll_offset_delegate && scroll_offset_delegate_) { |
| 999 scroll_delta_ = | 999 scroll_delta_ = |
| 1000 scroll_offset_delegate_->GetTotalScrollOffset() - scroll_offset_; | 1000 scroll_offset_delegate_->GetTotalScrollOffset() - scroll_offset_; |
| 1001 } | 1001 } |
| 1002 gfx::Vector2dF total_offset = TotalScrollOffset(); | 1002 gfx::Vector2dF total_offset = TotalScrollOffset(); |
| 1003 scroll_offset_delegate_ = scroll_offset_delegate; | 1003 scroll_offset_delegate_ = scroll_offset_delegate; |
| 1004 if (scroll_offset_delegate_) | 1004 if (scroll_offset_delegate_) { |
| 1005 scroll_offset_delegate_->SetMaxScrollOffset(max_scroll_offset_); | |
| 1005 scroll_offset_delegate_->SetTotalScrollOffset(total_offset); | 1006 scroll_offset_delegate_->SetTotalScrollOffset(total_offset); |
| 1007 } | |
| 1006 } | 1008 } |
| 1007 | 1009 |
| 1008 void LayerImpl::SetScrollOffset(gfx::Vector2d scroll_offset) { | 1010 void LayerImpl::SetScrollOffset(gfx::Vector2d scroll_offset) { |
| 1009 SetScrollOffsetAndDelta(scroll_offset, ScrollDelta()); | 1011 SetScrollOffsetAndDelta(scroll_offset, ScrollDelta()); |
| 1010 } | 1012 } |
| 1011 | 1013 |
| 1012 void LayerImpl::SetScrollOffsetAndDelta(gfx::Vector2d scroll_offset, | 1014 void LayerImpl::SetScrollOffsetAndDelta(gfx::Vector2d scroll_offset, |
| 1013 gfx::Vector2dF scroll_delta) { | 1015 gfx::Vector2dF scroll_delta) { |
| 1014 bool changed = false; | 1016 bool changed = false; |
| 1015 | 1017 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1081 | 1083 |
| 1082 void LayerImpl::DidBeginTracing() {} | 1084 void LayerImpl::DidBeginTracing() {} |
| 1083 | 1085 |
| 1084 void LayerImpl::DidLoseOutputSurface() {} | 1086 void LayerImpl::DidLoseOutputSurface() {} |
| 1085 | 1087 |
| 1086 void LayerImpl::SetMaxScrollOffset(gfx::Vector2d max_scroll_offset) { | 1088 void LayerImpl::SetMaxScrollOffset(gfx::Vector2d max_scroll_offset) { |
| 1087 if (max_scroll_offset_ == max_scroll_offset) | 1089 if (max_scroll_offset_ == max_scroll_offset) |
| 1088 return; | 1090 return; |
| 1089 max_scroll_offset_ = max_scroll_offset; | 1091 max_scroll_offset_ = max_scroll_offset; |
| 1090 | 1092 |
| 1093 if (scroll_offset_delegate_) | |
| 1094 scroll_offset_delegate_->SetMaxScrollOffset(max_scroll_offset_); | |
| 1095 | |
| 1091 layer_tree_impl()->set_needs_update_draw_properties(); | 1096 layer_tree_impl()->set_needs_update_draw_properties(); |
| 1092 UpdateScrollbarPositions(); | 1097 UpdateScrollbarPositions(); |
| 1093 } | 1098 } |
| 1094 | 1099 |
| 1095 void LayerImpl::DidBecomeActive() { | 1100 void LayerImpl::DidBecomeActive() { |
| 1096 if (layer_tree_impl_->settings().scrollbar_animator == | 1101 if (layer_tree_impl_->settings().scrollbar_animator == |
| 1097 LayerTreeSettings::NoAnimator) { | 1102 LayerTreeSettings::NoAnimator) { |
| 1098 return; | 1103 return; |
| 1099 } | 1104 } |
| 1100 | 1105 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1319 | 1324 |
| 1320 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } | 1325 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |
| 1321 | 1326 |
| 1322 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1327 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
| 1323 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1328 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 1324 AsValueInto(state.get()); | 1329 AsValueInto(state.get()); |
| 1325 return state.PassAs<base::Value>(); | 1330 return state.PassAs<base::Value>(); |
| 1326 } | 1331 } |
| 1327 | 1332 |
| 1328 } // namespace cc | 1333 } // namespace cc |
| OLD | NEW |