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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 if (replica_layer_) | 615 if (replica_layer_) |
616 replica_layer_->set_parent(this); | 616 replica_layer_->set_parent(this); |
617 NoteLayerPropertyChangedForSubtree(); | 617 NoteLayerPropertyChangedForSubtree(); |
618 } | 618 } |
619 | 619 |
620 scoped_ptr<LayerImpl> LayerImpl::TakeReplicaLayer() { | 620 scoped_ptr<LayerImpl> LayerImpl::TakeReplicaLayer() { |
621 replica_layer_id_ = -1; | 621 replica_layer_id_ = -1; |
622 return replica_layer_.Pass(); | 622 return replica_layer_.Pass(); |
623 } | 623 } |
624 | 624 |
625 ScrollbarLayerImpl* LayerImpl::ToScrollbarLayer() { | 625 ScrollbarLayerImplBase* LayerImpl::ToScrollbarLayer() { |
626 return NULL; | 626 return NULL; |
627 } | 627 } |
628 | 628 |
629 void LayerImpl::SetDrawsContent(bool draws_content) { | 629 void LayerImpl::SetDrawsContent(bool draws_content) { |
630 if (draws_content_ == draws_content) | 630 if (draws_content_ == draws_content) |
631 return; | 631 return; |
632 | 632 |
633 draws_content_ = draws_content; | 633 draws_content_ = draws_content; |
634 NoteLayerPropertyChanged(); | 634 NoteLayerPropertyChanged(); |
635 } | 635 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 *content_bounds = this->content_bounds(); | 824 *content_bounds = this->content_bounds(); |
825 } | 825 } |
826 | 826 |
827 void LayerImpl::UpdateScrollbarPositions() { | 827 void LayerImpl::UpdateScrollbarPositions() { |
828 gfx::Vector2dF current_offset = scroll_offset_ + ScrollDelta(); | 828 gfx::Vector2dF current_offset = scroll_offset_ + ScrollDelta(); |
829 | 829 |
830 gfx::RectF viewport(PointAtOffsetFromOrigin(current_offset), bounds_); | 830 gfx::RectF viewport(PointAtOffsetFromOrigin(current_offset), bounds_); |
831 gfx::SizeF scrollable_size(max_scroll_offset_.x() + bounds_.width(), | 831 gfx::SizeF scrollable_size(max_scroll_offset_.x() + bounds_.width(), |
832 max_scroll_offset_.y() + bounds_.height()); | 832 max_scroll_offset_.y() + bounds_.height()); |
833 if (horizontal_scrollbar_layer_) { | 833 if (horizontal_scrollbar_layer_) { |
834 horizontal_scrollbar_layer_->SetCurrentPos(current_offset.x()); | 834 horizontal_scrollbar_layer_->set_current_pos(current_offset.x()); |
835 horizontal_scrollbar_layer_->SetMaximum(max_scroll_offset_.x()); | 835 horizontal_scrollbar_layer_->set_maximum(max_scroll_offset_.x()); |
836 horizontal_scrollbar_layer_->set_visible_to_total_length_ratio( | 836 horizontal_scrollbar_layer_->set_visible_to_total_length_ratio( |
837 viewport.width() / scrollable_size.width()); | 837 viewport.width() / scrollable_size.width()); |
838 } | 838 } |
839 if (vertical_scrollbar_layer_) { | 839 if (vertical_scrollbar_layer_) { |
840 vertical_scrollbar_layer_->SetCurrentPos(current_offset.y()); | 840 vertical_scrollbar_layer_->set_current_pos(current_offset.y()); |
841 vertical_scrollbar_layer_->SetMaximum(max_scroll_offset_.y()); | 841 vertical_scrollbar_layer_->set_maximum(max_scroll_offset_.y()); |
842 vertical_scrollbar_layer_->set_visible_to_total_length_ratio( | 842 vertical_scrollbar_layer_->set_visible_to_total_length_ratio( |
843 viewport.height() / scrollable_size.height()); | 843 viewport.height() / scrollable_size.height()); |
844 } | 844 } |
845 | 845 |
846 if (current_offset == last_scroll_offset_) | 846 if (current_offset == last_scroll_offset_) |
847 return; | 847 return; |
848 last_scroll_offset_ = current_offset; | 848 last_scroll_offset_ = current_offset; |
849 | 849 |
850 if (scrollbar_animation_controller_ && | 850 if (scrollbar_animation_controller_ && |
851 !scrollbar_animation_controller_->IsScrollGestureInProgress()) { | 851 !scrollbar_animation_controller_->IsScrollGestureInProgress()) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 scrollbar_animation_controller_ = | 973 scrollbar_animation_controller_ = |
974 ScrollbarAnimationControllerLinearFade::Create( | 974 ScrollbarAnimationControllerLinearFade::Create( |
975 this, fadeout_delay, fadeout_length) | 975 this, fadeout_delay, fadeout_length) |
976 .PassAs<ScrollbarAnimationController>(); | 976 .PassAs<ScrollbarAnimationController>(); |
977 } | 977 } |
978 } else { | 978 } else { |
979 scrollbar_animation_controller_.reset(); | 979 scrollbar_animation_controller_.reset(); |
980 } | 980 } |
981 } | 981 } |
982 void LayerImpl::SetHorizontalScrollbarLayer( | 982 void LayerImpl::SetHorizontalScrollbarLayer( |
983 ScrollbarLayerImpl* scrollbar_layer) { | 983 ScrollbarLayerImplBase* scrollbar_layer) { |
984 horizontal_scrollbar_layer_ = scrollbar_layer; | 984 horizontal_scrollbar_layer_ = scrollbar_layer; |
985 if (horizontal_scrollbar_layer_) | 985 if (horizontal_scrollbar_layer_) |
986 horizontal_scrollbar_layer_->set_scroll_layer_id(id()); | 986 horizontal_scrollbar_layer_->set_scroll_layer_id(id()); |
987 } | 987 } |
988 | 988 |
989 void LayerImpl::SetVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbar_layer) { | 989 void LayerImpl::SetVerticalScrollbarLayer( |
| 990 ScrollbarLayerImplBase* scrollbar_layer) { |
990 vertical_scrollbar_layer_ = scrollbar_layer; | 991 vertical_scrollbar_layer_ = scrollbar_layer; |
991 if (vertical_scrollbar_layer_) | 992 if (vertical_scrollbar_layer_) |
992 vertical_scrollbar_layer_->set_scroll_layer_id(id()); | 993 vertical_scrollbar_layer_->set_scroll_layer_id(id()); |
993 } | 994 } |
994 | 995 |
995 static scoped_ptr<base::Value> | 996 static scoped_ptr<base::Value> |
996 CompositingReasonsAsValue(CompositingReasons reasons) { | 997 CompositingReasonsAsValue(CompositingReasons reasons) { |
997 scoped_ptr<base::ListValue> reason_list(new base::ListValue()); | 998 scoped_ptr<base::ListValue> reason_list(new base::ListValue()); |
998 | 999 |
999 if (reasons == kCompositingReasonUnknown) { | 1000 if (reasons == kCompositingReasonUnknown) { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 | 1142 |
1142 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } | 1143 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |
1143 | 1144 |
1144 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1145 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
1145 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1146 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1146 AsValueInto(state.get()); | 1147 AsValueInto(state.get()); |
1147 return state.PassAs<base::Value>(); | 1148 return state.PassAs<base::Value>(); |
1148 } | 1149 } |
1149 | 1150 |
1150 } // namespace cc | 1151 } // namespace cc |
OLD | NEW |