Chromium Code Reviews| 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/scrollbar_layer_impl.h" | 5 #include "cc/layers/scrollbar_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "cc/animation/scrollbar_animation_controller.h" | 9 #include "cc/animation/scrollbar_animation_controller.h" |
| 10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 gfx::Rect ScrollbarLayerImpl::ScrollbarLayerRectToContentRect( | 163 gfx::Rect ScrollbarLayerImpl::ScrollbarLayerRectToContentRect( |
| 164 gfx::RectF layer_rect) const { | 164 gfx::RectF layer_rect) const { |
| 165 // Don't intersect with the bounds as in layerRectToContentRect() because | 165 // Don't intersect with the bounds as in layerRectToContentRect() because |
| 166 // layer_rect here might be in coordinates of the containing layer. | 166 // layer_rect here might be in coordinates of the containing layer. |
| 167 gfx::RectF content_rect = gfx::ScaleRect(layer_rect, | 167 gfx::RectF content_rect = gfx::ScaleRect(layer_rect, |
| 168 contents_scale_x(), | 168 contents_scale_x(), |
| 169 contents_scale_y()); | 169 contents_scale_y()); |
| 170 return gfx::ToEnclosingRect(content_rect); | 170 return gfx::ToEnclosingRect(content_rect); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void ScrollbarLayerImpl::SetCurrentPos(float current_pos) { | |
| 174 current_pos_ = current_pos; | |
| 175 NoteLayerPropertyChanged(); | |
| 176 } | |
| 177 | |
| 178 void ScrollbarLayerImpl::SetMaximum(int maximum) { | |
| 179 maximum_ = maximum; | |
|
danakj
2013/08/13 19:32:40
Yes please early out here if maximum_ == maximum.
| |
| 180 NoteLayerPropertyChanged(); | |
| 181 } | |
| 182 | |
| 173 gfx::Rect ScrollbarLayerImpl::ComputeThumbQuadRect() const { | 183 gfx::Rect ScrollbarLayerImpl::ComputeThumbQuadRect() const { |
| 174 // Thumb extent is the length of the thumb in the scrolling direction, thumb | 184 // Thumb extent is the length of the thumb in the scrolling direction, thumb |
| 175 // thickness is in the perpendicular direction. Here's an example of a | 185 // thickness is in the perpendicular direction. Here's an example of a |
| 176 // horizontal scrollbar - inputs are above the scrollbar, computed values | 186 // horizontal scrollbar - inputs are above the scrollbar, computed values |
| 177 // below: | 187 // below: |
| 178 // | 188 // |
| 179 // |<------------------- track_length_ ------------------->| | 189 // |<------------------- track_length_ ------------------->| |
| 180 // | 190 // |
| 181 // |--| <-- start_offset | 191 // |--| <-- start_offset |
| 182 // | 192 // |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 void ScrollbarLayerImpl::DidLoseOutputSurface() { | 274 void ScrollbarLayerImpl::DidLoseOutputSurface() { |
| 265 track_resource_id_ = 0; | 275 track_resource_id_ = 0; |
| 266 thumb_resource_id_ = 0; | 276 thumb_resource_id_ = 0; |
| 267 } | 277 } |
| 268 | 278 |
| 269 const char* ScrollbarLayerImpl::LayerTypeAsString() const { | 279 const char* ScrollbarLayerImpl::LayerTypeAsString() const { |
| 270 return "cc::ScrollbarLayerImpl"; | 280 return "cc::ScrollbarLayerImpl"; |
| 271 } | 281 } |
| 272 | 282 |
| 273 } // namespace cc | 283 } // namespace cc |
| OLD | NEW |