| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 if (scroll_layer_ == scroll_layer && clip_layer_ == clip_layer) | 85 if (scroll_layer_ == scroll_layer && clip_layer_ == clip_layer) |
| 86 return; | 86 return; |
| 87 | 87 |
| 88 RegisterScrollbarWithLayers( | 88 RegisterScrollbarWithLayers( |
| 89 this, clip_layer_, scroll_layer_, &LayerImpl::RemoveScrollbar); | 89 this, clip_layer_, scroll_layer_, &LayerImpl::RemoveScrollbar); |
| 90 scroll_layer_ = scroll_layer; | 90 scroll_layer_ = scroll_layer; |
| 91 clip_layer_ = clip_layer; | 91 clip_layer_ = clip_layer; |
| 92 RegisterScrollbarWithLayers( | 92 RegisterScrollbarWithLayers( |
| 93 this, clip_layer_, scroll_layer_, &LayerImpl::AddScrollbar); | 93 this, clip_layer_, scroll_layer_, &LayerImpl::AddScrollbar); |
| 94 | 94 |
| 95 ScrollbarParametersDidChange(); | 95 ScrollbarParametersDidChange(false); |
| 96 } | 96 } |
| 97 | 97 |
| 98 gfx::Rect ScrollbarLayerImplBase::ScrollbarLayerRectToContentRect( | 98 gfx::Rect ScrollbarLayerImplBase::ScrollbarLayerRectToContentRect( |
| 99 const gfx::RectF& layer_rect) const { | 99 const gfx::RectF& layer_rect) const { |
| 100 // Don't intersect with the bounds as in LayerRectToContentRect() because | 100 // Don't intersect with the bounds as in LayerRectToContentRect() because |
| 101 // layer_rect here might be in coordinates of the containing layer. | 101 // layer_rect here might be in coordinates of the containing layer. |
| 102 gfx::RectF content_rect = gfx::ScaleRect(layer_rect, | 102 gfx::RectF content_rect = gfx::ScaleRect(layer_rect, |
| 103 contents_scale_x(), | 103 contents_scale_x(), |
| 104 contents_scale_y()); | 104 contents_scale_y()); |
| 105 return gfx::ToEnclosingRect(content_rect); | 105 return gfx::ToEnclosingRect(content_rect); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 ? bounds().width() - thumb_thickness | 240 ? bounds().width() - thumb_thickness |
| 241 : thumb_thickness_adjustment, | 241 : thumb_thickness_adjustment, |
| 242 thumb_offset, | 242 thumb_offset, |
| 243 thumb_thickness - thumb_thickness_adjustment, | 243 thumb_thickness - thumb_thickness_adjustment, |
| 244 thumb_length); | 244 thumb_length); |
| 245 } | 245 } |
| 246 | 246 |
| 247 return ScrollbarLayerRectToContentRect(thumb_rect); | 247 return ScrollbarLayerRectToContentRect(thumb_rect); |
| 248 } | 248 } |
| 249 | 249 |
| 250 void ScrollbarLayerImplBase::ScrollbarParametersDidChange() { | 250 void ScrollbarLayerImplBase::ScrollbarParametersDidChange(bool on_resize) { |
| 251 if (!clip_layer_ || !scroll_layer_) | 251 if (!clip_layer_ || !scroll_layer_) |
| 252 return; | 252 return; |
| 253 | 253 |
| 254 scroll_layer_->SetScrollbarPosition(this, clip_layer_); | 254 scroll_layer_->SetScrollbarPosition(this, clip_layer_, on_resize); |
| 255 } | 255 } |
| 256 | 256 |
| 257 } // namespace cc | 257 } // namespace cc |
| OLD | NEW |