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 "webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.h" | 5 #include "webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.h" |
6 | 6 |
7 #include "cc/layers/painted_scrollbar_layer.h" | 7 #include "cc/layers/painted_scrollbar_layer.h" |
8 #include "cc/layers/scrollbar_layer_interface.h" | 8 #include "cc/layers/scrollbar_layer_interface.h" |
9 #include "cc/layers/solid_color_scrollbar_layer.h" | 9 #include "cc/layers/solid_color_scrollbar_layer.h" |
10 #include "webkit/renderer/compositor_bindings/scrollbar_impl.h" | 10 #include "webkit/renderer/compositor_bindings/scrollbar_impl.h" |
11 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | 11 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" |
12 | 12 |
13 using cc::PaintedScrollbarLayer; | 13 using cc::PaintedScrollbarLayer; |
14 using cc::SolidColorScrollbarLayer; | 14 using cc::SolidColorScrollbarLayer; |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 cc::ScrollbarOrientation ConvertOrientation( | 18 cc::ScrollbarOrientation ConvertOrientation( |
19 WebKit::WebScrollbar::Orientation orientation) { | 19 blink::WebScrollbar::Orientation orientation) { |
20 return orientation == WebKit::WebScrollbar::Horizontal ? cc::HORIZONTAL | 20 return orientation == blink::WebScrollbar::Horizontal ? cc::HORIZONTAL |
21 : cc::VERTICAL; | 21 : cc::VERTICAL; |
22 } | 22 } |
23 | 23 |
24 } // namespace | 24 } // namespace |
25 | 25 |
26 namespace webkit { | 26 namespace webkit { |
27 | 27 |
28 WebScrollbarLayerImpl::WebScrollbarLayerImpl( | 28 WebScrollbarLayerImpl::WebScrollbarLayerImpl( |
29 WebKit::WebScrollbar* scrollbar, | 29 blink::WebScrollbar* scrollbar, |
30 WebKit::WebScrollbarThemePainter painter, | 30 blink::WebScrollbarThemePainter painter, |
31 WebKit::WebScrollbarThemeGeometry* geometry) | 31 blink::WebScrollbarThemeGeometry* geometry) |
32 : layer_(new WebLayerImpl(PaintedScrollbarLayer::Create( | 32 : layer_(new WebLayerImpl(PaintedScrollbarLayer::Create( |
33 scoped_ptr<cc::Scrollbar>(new ScrollbarImpl( | 33 scoped_ptr<cc::Scrollbar>(new ScrollbarImpl( |
34 make_scoped_ptr(scrollbar), | 34 make_scoped_ptr(scrollbar), |
35 painter, | 35 painter, |
36 make_scoped_ptr(geometry))).Pass(), 0))) {} | 36 make_scoped_ptr(geometry))).Pass(), 0))) {} |
37 | 37 |
38 WebScrollbarLayerImpl::WebScrollbarLayerImpl( | 38 WebScrollbarLayerImpl::WebScrollbarLayerImpl( |
39 WebKit::WebScrollbar::Orientation orientation, | 39 blink::WebScrollbar::Orientation orientation, |
40 int thumb_thickness, | 40 int thumb_thickness, |
41 bool is_left_side_vertical_scrollbar) | 41 bool is_left_side_vertical_scrollbar) |
42 : layer_(new WebLayerImpl( | 42 : layer_(new WebLayerImpl( |
43 SolidColorScrollbarLayer::Create( | 43 SolidColorScrollbarLayer::Create( |
44 ConvertOrientation(orientation), | 44 ConvertOrientation(orientation), |
45 thumb_thickness, | 45 thumb_thickness, |
46 is_left_side_vertical_scrollbar, | 46 is_left_side_vertical_scrollbar, |
47 0))) {} | 47 0))) {} |
48 | 48 |
49 WebScrollbarLayerImpl::~WebScrollbarLayerImpl() {} | 49 WebScrollbarLayerImpl::~WebScrollbarLayerImpl() {} |
50 | 50 |
51 WebKit::WebLayer* WebScrollbarLayerImpl::layer() { return layer_.get(); } | 51 blink::WebLayer* WebScrollbarLayerImpl::layer() { return layer_.get(); } |
52 | 52 |
53 void WebScrollbarLayerImpl::setScrollLayer(WebKit::WebLayer* layer) { | 53 void WebScrollbarLayerImpl::setScrollLayer(blink::WebLayer* layer) { |
54 int id = layer ? static_cast<WebLayerImpl*>(layer)->layer()->id() : 0; | 54 int id = layer ? static_cast<WebLayerImpl*>(layer)->layer()->id() : 0; |
55 static_cast<PaintedScrollbarLayer*>(layer_->layer())->SetScrollLayerId(id); | 55 static_cast<PaintedScrollbarLayer*>(layer_->layer())->SetScrollLayerId(id); |
56 } | 56 } |
57 | 57 |
58 } // namespace webkit | 58 } // namespace webkit |
OLD | NEW |