| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/scrollbar_layer_impl_base.h" | 5 #include "cc/layers/scrollbar_layer_impl_base.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include "cc/trees/layer_tree_impl.h" | 8 #include "cc/trees/layer_tree_impl.h" |
| 9 #include "ui/gfx/rect_conversions.h" | 9 #include "ui/gfx/rect_conversions.h" |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool ScrollbarLayerImplBase::SetMaximum(int maximum) { | 117 bool ScrollbarLayerImplBase::SetMaximum(int maximum) { |
| 118 if (maximum_ == maximum) | 118 if (maximum_ == maximum) |
| 119 return false; | 119 return false; |
| 120 maximum_ = maximum; | 120 maximum_ = maximum; |
| 121 NoteLayerPropertyChanged(); | 121 NoteLayerPropertyChanged(); |
| 122 return true; | 122 return true; |
| 123 } | 123 } |
| 124 | 124 |
| 125 bool ScrollbarLayerImplBase::can_scroll_orientation() const { |
| 126 if (!scroll_layer_) |
| 127 return false; |
| 128 return scroll_layer_->user_scrollable(orientation()) && (0 < maximum()); |
| 129 } |
| 130 |
| 125 bool ScrollbarLayerImplBase::SetVerticalAdjust(float vertical_adjust) { | 131 bool ScrollbarLayerImplBase::SetVerticalAdjust(float vertical_adjust) { |
| 126 if (vertical_adjust_ == vertical_adjust) | 132 if (vertical_adjust_ == vertical_adjust) |
| 127 return false; | 133 return false; |
| 128 vertical_adjust_ = vertical_adjust; | 134 vertical_adjust_ = vertical_adjust; |
| 129 NoteLayerPropertyChanged(); | 135 NoteLayerPropertyChanged(); |
| 130 return true; | 136 return true; |
| 131 } | 137 } |
| 132 | 138 |
| 133 bool ScrollbarLayerImplBase::SetVisibleToTotalLengthRatio(float ratio) { | 139 bool ScrollbarLayerImplBase::SetVisibleToTotalLengthRatio(float ratio) { |
| 134 if (!IsThumbResizable()) | 140 if (!IsThumbResizable()) |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 255 } |
| 250 | 256 |
| 251 void ScrollbarLayerImplBase::ScrollbarParametersDidChange(bool on_resize) { | 257 void ScrollbarLayerImplBase::ScrollbarParametersDidChange(bool on_resize) { |
| 252 if (!clip_layer_ || !scroll_layer_) | 258 if (!clip_layer_ || !scroll_layer_) |
| 253 return; | 259 return; |
| 254 | 260 |
| 255 scroll_layer_->SetScrollbarPosition(this, clip_layer_, on_resize); | 261 scroll_layer_->SetScrollbarPosition(this, clip_layer_, on_resize); |
| 256 } | 262 } |
| 257 | 263 |
| 258 } // namespace cc | 264 } // namespace cc |
| OLD | NEW |