Chromium Code Reviews| 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/solid_color_scrollbar_layer.h" | 5 #include "cc/layers/solid_color_scrollbar_layer.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "cc/layers/layer_impl.h" | 9 #include "cc/layers/layer_impl.h" |
| 10 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 10 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 SolidColorScrollbarLayer::SolidColorScrollbarLayer( | 39 SolidColorScrollbarLayer::SolidColorScrollbarLayer( |
| 40 ScrollbarOrientation orientation, | 40 ScrollbarOrientation orientation, |
| 41 int thumb_thickness, | 41 int thumb_thickness, |
| 42 int track_start, | 42 int track_start, |
| 43 bool is_left_side_vertical_scrollbar, | 43 bool is_left_side_vertical_scrollbar, |
| 44 int scroll_layer_id) | 44 int scroll_layer_id) |
| 45 : scroll_layer_id_(Layer::INVALID_ID), | 45 : scroll_layer_id_(Layer::INVALID_ID), |
| 46 orientation_(orientation), | 46 orientation_(orientation), |
| 47 thumb_thickness_(thumb_thickness), | 47 thumb_thickness_(thumb_thickness), |
| 48 track_start_(track_start), | 48 track_start_(track_start), |
| 49 is_left_side_vertical_scrollbar_(is_left_side_vertical_scrollbar) {} | 49 is_left_side_vertical_scrollbar_(is_left_side_vertical_scrollbar) { |
| 50 Layer::SetOpacity(0.f); | |
| 51 } | |
| 50 | 52 |
| 51 SolidColorScrollbarLayer::~SolidColorScrollbarLayer() {} | 53 SolidColorScrollbarLayer::~SolidColorScrollbarLayer() {} |
| 52 | 54 |
| 53 ScrollbarLayerInterface* SolidColorScrollbarLayer::ToScrollbarLayer() { | 55 ScrollbarLayerInterface* SolidColorScrollbarLayer::ToScrollbarLayer() { |
| 54 return this; | 56 return this; |
| 55 } | 57 } |
| 56 | 58 |
| 59 void SolidColorScrollbarLayer::SetOpacity(float opacity) { | |
| 60 // The opacity of a solid color scrollbar layer is always 0 on main thread. | |
| 61 DCHECK_EQ(opacity, 0.f); | |
|
jaydasika
2016/05/24 23:37:23
I am not sure if we should still be overriding thi
| |
| 62 Layer::SetOpacity(opacity); | |
| 63 } | |
| 64 | |
| 57 void SolidColorScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { | 65 void SolidColorScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { |
| 58 Layer::PushPropertiesTo(layer); | 66 Layer::PushPropertiesTo(layer); |
| 59 SolidColorScrollbarLayerImpl* scrollbar_layer = | 67 SolidColorScrollbarLayerImpl* scrollbar_layer = |
| 60 static_cast<SolidColorScrollbarLayerImpl*>(layer); | 68 static_cast<SolidColorScrollbarLayerImpl*>(layer); |
| 61 | 69 |
| 62 scrollbar_layer->SetScrollLayerId(scroll_layer_id_); | 70 scrollbar_layer->SetScrollLayerId(scroll_layer_id_); |
| 63 } | 71 } |
| 64 | 72 |
| 65 void SolidColorScrollbarLayer::SetNeedsDisplayRect(const gfx::Rect& rect) { | 73 void SolidColorScrollbarLayer::SetNeedsDisplayRect(const gfx::Rect& rect) { |
| 66 // Never needs repaint. | 74 // Never needs repaint. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 proto.solid_scrollbar(); | 125 proto.solid_scrollbar(); |
| 118 scroll_layer_id_ = scrollbar.scroll_layer_id(); | 126 scroll_layer_id_ = scrollbar.scroll_layer_id(); |
| 119 thumb_thickness_ = scrollbar.thumb_thickness(); | 127 thumb_thickness_ = scrollbar.thumb_thickness(); |
| 120 track_start_ = scrollbar.track_start(); | 128 track_start_ = scrollbar.track_start(); |
| 121 is_left_side_vertical_scrollbar_ = | 129 is_left_side_vertical_scrollbar_ = |
| 122 scrollbar.is_left_side_vertical_scrollbar(); | 130 scrollbar.is_left_side_vertical_scrollbar(); |
| 123 orientation_ = ScrollbarOrientationFromProto(scrollbar.orientation()); | 131 orientation_ = ScrollbarOrientationFromProto(scrollbar.orientation()); |
| 124 } | 132 } |
| 125 | 133 |
| 126 } // namespace cc | 134 } // namespace cc |
| OLD | NEW |