| 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 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 ScrollbarLayerImplBase::ScrollbarLayerImplBase( | 13 ScrollbarLayerImplBase::ScrollbarLayerImplBase( |
| 14 LayerTreeImpl* tree_impl, | 14 LayerTreeImpl* tree_impl, |
| 15 int id, | 15 int id, |
| 16 ScrollbarOrientation orientation, | 16 ScrollbarOrientation orientation, |
| 17 bool is_left_side_vertical_scrollbar, | 17 bool is_left_side_vertical_scrollbar, |
| 18 bool is_overlay) | 18 bool is_overlay) |
| 19 : LayerImpl(tree_impl, id), | 19 : LayerImpl(tree_impl, id), |
| 20 scroll_layer_(NULL), | 20 scroll_layer_(nullptr), |
| 21 clip_layer_(NULL), | 21 clip_layer_(nullptr), |
| 22 is_overlay_scrollbar_(is_overlay), | 22 is_overlay_scrollbar_(is_overlay), |
| 23 thumb_thickness_scale_factor_(1.f), | 23 thumb_thickness_scale_factor_(1.f), |
| 24 current_pos_(0.f), | 24 current_pos_(0.f), |
| 25 maximum_(0), | 25 maximum_(0), |
| 26 orientation_(orientation), | 26 orientation_(orientation), |
| 27 is_left_side_vertical_scrollbar_(is_left_side_vertical_scrollbar), | 27 is_left_side_vertical_scrollbar_(is_left_side_vertical_scrollbar), |
| 28 vertical_adjust_(0.f), | 28 vertical_adjust_(0.f), |
| 29 visible_to_total_length_ratio_(1.f) {} | 29 visible_to_total_length_ratio_(1.f) { |
| 30 } |
| 30 | 31 |
| 31 ScrollbarLayerImplBase::~ScrollbarLayerImplBase() {} | 32 ScrollbarLayerImplBase::~ScrollbarLayerImplBase() {} |
| 32 | 33 |
| 33 void ScrollbarLayerImplBase::PushPropertiesTo(LayerImpl* layer) { | 34 void ScrollbarLayerImplBase::PushPropertiesTo(LayerImpl* layer) { |
| 34 float active_opacity = layer->opacity(); | 35 float active_opacity = layer->opacity(); |
| 35 LayerImpl::PushPropertiesTo(layer); | 36 LayerImpl::PushPropertiesTo(layer); |
| 36 layer->SetOpacity(active_opacity); | 37 layer->SetOpacity(active_opacity); |
| 37 DCHECK(layer->ToScrollbarLayer()); | 38 DCHECK(layer->ToScrollbarLayer()); |
| 38 layer->ToScrollbarLayer()->set_is_overlay_scrollbar(is_overlay_scrollbar_); | 39 layer->ToScrollbarLayer()->set_is_overlay_scrollbar(is_overlay_scrollbar_); |
| 39 PushScrollClipPropertiesTo(layer); | 40 PushScrollClipPropertiesTo(layer); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 } | 249 } |
| 249 | 250 |
| 250 void ScrollbarLayerImplBase::ScrollbarParametersDidChange(bool on_resize) { | 251 void ScrollbarLayerImplBase::ScrollbarParametersDidChange(bool on_resize) { |
| 251 if (!clip_layer_ || !scroll_layer_) | 252 if (!clip_layer_ || !scroll_layer_) |
| 252 return; | 253 return; |
| 253 | 254 |
| 254 scroll_layer_->SetScrollbarPosition(this, clip_layer_, on_resize); | 255 scroll_layer_->SetScrollbarPosition(this, clip_layer_, on_resize); |
| 255 } | 256 } |
| 256 | 257 |
| 257 } // namespace cc | 258 } // namespace cc |
| OLD | NEW |