| 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/painted_scrollbar_layer_impl.h" | 5 #include "cc/layers/painted_scrollbar_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "cc/input/scrollbar_animation_controller.h" | 10 #include "cc/input/scrollbar_animation_controller.h" |
| 11 #include "cc/layers/layer.h" | 11 #include "cc/layers/layer.h" |
| 12 #include "cc/quads/solid_color_draw_quad.h" | 12 #include "cc/quads/solid_color_draw_quad.h" |
| 13 #include "cc/quads/texture_draw_quad.h" | 13 #include "cc/quads/texture_draw_quad.h" |
| 14 #include "cc/trees/layer_tree_impl.h" | 14 #include "cc/trees/layer_tree_impl.h" |
| 15 #include "cc/trees/layer_tree_settings.h" | 15 #include "cc/trees/layer_tree_settings.h" |
| 16 #include "cc/trees/occlusion.h" | 16 #include "cc/trees/occlusion.h" |
| 17 #include "ui/gfx/geometry/rect_conversions.h" | 17 #include "ui/gfx/geometry/rect_conversions.h" |
| 18 | 18 |
| 19 namespace cc { | 19 namespace cc { |
| 20 | 20 |
| 21 std::unique_ptr<PaintedScrollbarLayerImpl> PaintedScrollbarLayerImpl::Create( | 21 std::unique_ptr<PaintedScrollbarLayerImpl> PaintedScrollbarLayerImpl::Create( |
| 22 LayerTreeImpl* tree_impl, | 22 LayerTreeImpl* tree_impl, |
| 23 int id, | 23 int id, |
| 24 ScrollbarOrientation orientation) { | 24 ScrollbarOrientation orientation, |
| 25 return base::WrapUnique( | 25 bool is_left_side_vertical_scrollbar, |
| 26 new PaintedScrollbarLayerImpl(tree_impl, id, orientation)); | 26 bool is_overlay) { |
| 27 return base::WrapUnique(new PaintedScrollbarLayerImpl( |
| 28 tree_impl, id, orientation, is_left_side_vertical_scrollbar, is_overlay)); |
| 27 } | 29 } |
| 28 | 30 |
| 29 PaintedScrollbarLayerImpl::PaintedScrollbarLayerImpl( | 31 PaintedScrollbarLayerImpl::PaintedScrollbarLayerImpl( |
| 30 LayerTreeImpl* tree_impl, | 32 LayerTreeImpl* tree_impl, |
| 31 int id, | 33 int id, |
| 32 ScrollbarOrientation orientation) | 34 ScrollbarOrientation orientation, |
| 33 : ScrollbarLayerImplBase(tree_impl, id, orientation, false, false), | 35 bool is_left_side_vertical_scrollbar, |
| 36 bool is_overlay) |
| 37 : ScrollbarLayerImplBase(tree_impl, |
| 38 id, |
| 39 orientation, |
| 40 is_left_side_vertical_scrollbar, |
| 41 is_overlay), |
| 34 track_ui_resource_id_(0), | 42 track_ui_resource_id_(0), |
| 35 thumb_ui_resource_id_(0), | 43 thumb_ui_resource_id_(0), |
| 36 thumb_opacity_(1.f), | 44 thumb_opacity_(1.f), |
| 37 internal_contents_scale_(1.f), | 45 internal_contents_scale_(1.f), |
| 38 thumb_thickness_(0), | 46 thumb_thickness_(0), |
| 39 thumb_length_(0), | 47 thumb_length_(0), |
| 40 track_start_(0), | 48 track_start_(0), |
| 41 track_length_(0) {} | 49 track_length_(0) {} |
| 42 | 50 |
| 43 PaintedScrollbarLayerImpl::~PaintedScrollbarLayerImpl() {} | 51 PaintedScrollbarLayerImpl::~PaintedScrollbarLayerImpl() {} |
| 44 | 52 |
| 45 std::unique_ptr<LayerImpl> PaintedScrollbarLayerImpl::CreateLayerImpl( | 53 std::unique_ptr<LayerImpl> PaintedScrollbarLayerImpl::CreateLayerImpl( |
| 46 LayerTreeImpl* tree_impl) { | 54 LayerTreeImpl* tree_impl) { |
| 47 return PaintedScrollbarLayerImpl::Create(tree_impl, id(), orientation()); | 55 return PaintedScrollbarLayerImpl::Create(tree_impl, id(), orientation(), |
| 56 is_left_side_vertical_scrollbar(), |
| 57 is_overlay_scrollbar()); |
| 48 } | 58 } |
| 49 | 59 |
| 50 void PaintedScrollbarLayerImpl::PushPropertiesTo(LayerImpl* layer) { | 60 void PaintedScrollbarLayerImpl::PushPropertiesTo(LayerImpl* layer) { |
| 51 ScrollbarLayerImplBase::PushPropertiesTo(layer); | 61 ScrollbarLayerImplBase::PushPropertiesTo(layer); |
| 52 | 62 |
| 53 PaintedScrollbarLayerImpl* scrollbar_layer = | 63 PaintedScrollbarLayerImpl* scrollbar_layer = |
| 54 static_cast<PaintedScrollbarLayerImpl*>(layer); | 64 static_cast<PaintedScrollbarLayerImpl*>(layer); |
| 55 | 65 |
| 56 scrollbar_layer->set_internal_contents_scale_and_bounds( | 66 scrollbar_layer->set_internal_contents_scale_and_bounds( |
| 57 internal_contents_scale_, internal_content_bounds_); | 67 internal_contents_scale_, internal_content_bounds_); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 202 |
| 193 bool PaintedScrollbarLayerImpl::IsThumbResizable() const { | 203 bool PaintedScrollbarLayerImpl::IsThumbResizable() const { |
| 194 return false; | 204 return false; |
| 195 } | 205 } |
| 196 | 206 |
| 197 const char* PaintedScrollbarLayerImpl::LayerTypeAsString() const { | 207 const char* PaintedScrollbarLayerImpl::LayerTypeAsString() const { |
| 198 return "cc::PaintedScrollbarLayerImpl"; | 208 return "cc::PaintedScrollbarLayerImpl"; |
| 199 } | 209 } |
| 200 | 210 |
| 201 } // namespace cc | 211 } // namespace cc |
| OLD | NEW |