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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_->SetCurrentPos(current_offset.x()); |
835 horizontal_scrollbar_layer_->SetMaximum(max_scroll_offset_.x()); | 835 horizontal_scrollbar_layer_->SetMaximum(max_scroll_offset_.x()); |
836 horizontal_scrollbar_layer_->set_visible_to_total_length_ratio( | 836 horizontal_scrollbar_layer_->SetVisibleToTotalLengthRatio( |
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_->SetCurrentPos(current_offset.y()); |
841 vertical_scrollbar_layer_->SetMaximum(max_scroll_offset_.y()); | 841 vertical_scrollbar_layer_->SetMaximum(max_scroll_offset_.y()); |
842 vertical_scrollbar_layer_->set_visible_to_total_length_ratio( | 842 vertical_scrollbar_layer_->SetVisibleToTotalLengthRatio( |
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()) { |
852 scrollbar_animation_controller_->DidProgrammaticallyUpdateScroll( | 852 scrollbar_animation_controller_->DidProgrammaticallyUpdateScroll( |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 | 1141 |
1142 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } | 1142 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |
1143 | 1143 |
1144 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1144 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
1145 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1145 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1146 AsValueInto(state.get()); | 1146 AsValueInto(state.get()); |
1147 return state.PassAs<base::Value>(); | 1147 return state.PassAs<base::Value>(); |
1148 } | 1148 } |
1149 | 1149 |
1150 } // namespace cc | 1150 } // namespace cc |
OLD | NEW |