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/scrollbar_layer.h" | 7 #include "cc/layers/scrollbar_layer.h" |
8 #include "cc/layers/scrollbar_layer_base.h" | |
9 #include "cc/layers/solid_color_scrollbar_layer.h" | |
8 #include "third_party/WebKit/public/platform/WebScrollbar.h" | 10 #include "third_party/WebKit/public/platform/WebScrollbar.h" |
9 #include "webkit/renderer/compositor_bindings/scrollbar_impl.h" | 11 #include "webkit/renderer/compositor_bindings/scrollbar_impl.h" |
10 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | 12 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" |
11 | 13 |
12 using cc::ScrollbarLayer; | 14 using cc::ScrollbarLayer; |
15 using cc::SolidColorScrollbarLayer; | |
16 | |
17 #if defined(OS_ANDROID) | |
enne (OOO)
2013/08/12 23:15:01
Please no platform #ifdefs. Checking the setting
wjmaclean
2013/08/14 18:19:44
Fixed.
I now check an existing flag, --enable-ove
| |
18 namespace { | |
19 | |
20 cc::ScrollbarOrientation ConvertOrientation( | |
21 WebKit::WebScrollbar::Orientation orientation) { | |
22 return orientation == WebKit::WebScrollbar::Horizontal ? cc::HORIZONTAL | |
23 : cc::VERTICAL; | |
24 } | |
25 | |
26 const int kSolidColorScrollbarThumbThickness = 3; | |
27 const SkColor kSolidColorScrollbarColor = SkColorSetARGB(128, 128, 128, 128); | |
28 | |
29 } // namespace | |
30 #endif | |
13 | 31 |
14 namespace webkit { | 32 namespace webkit { |
15 | 33 |
16 WebScrollbarLayerImpl::WebScrollbarLayerImpl( | 34 WebScrollbarLayerImpl::WebScrollbarLayerImpl( |
17 WebKit::WebScrollbar* scrollbar, | 35 WebKit::WebScrollbar* scrollbar, |
18 WebKit::WebScrollbarThemePainter painter, | 36 WebKit::WebScrollbarThemePainter painter, |
19 WebKit::WebScrollbarThemeGeometry* geometry) | 37 WebKit::WebScrollbarThemeGeometry* geometry) |
38 #if defined(OS_ANDROID) | |
39 : layer_(new WebLayerImpl(SolidColorScrollbarLayer::Create( | |
40 ConvertOrientation(scrollbar->orientation()), | |
41 kSolidColorScrollbarThumbThickness, | |
42 kSolidColorScrollbarColor, | |
43 0))) {} | |
44 #else | |
20 : layer_(new WebLayerImpl(ScrollbarLayer::Create( | 45 : layer_(new WebLayerImpl(ScrollbarLayer::Create( |
21 scoped_ptr<cc::Scrollbar>(new ScrollbarImpl( | 46 scoped_ptr<cc::Scrollbar>(new ScrollbarImpl( |
22 make_scoped_ptr(scrollbar), | 47 make_scoped_ptr(scrollbar), |
23 painter, | 48 painter, |
24 make_scoped_ptr(geometry))).Pass(), 0))) {} | 49 make_scoped_ptr(geometry))).Pass(), 0))) {} |
50 #endif | |
25 | 51 |
26 WebScrollbarLayerImpl::~WebScrollbarLayerImpl() {} | 52 WebScrollbarLayerImpl::~WebScrollbarLayerImpl() {} |
27 | 53 |
28 WebKit::WebLayer* WebScrollbarLayerImpl::layer() { return layer_.get(); } | 54 WebKit::WebLayer* WebScrollbarLayerImpl::layer() { return layer_.get(); } |
29 | 55 |
30 void WebScrollbarLayerImpl::setScrollLayer(WebKit::WebLayer* layer) { | 56 void WebScrollbarLayerImpl::setScrollLayer(WebKit::WebLayer* layer) { |
31 int id = layer ? static_cast<WebLayerImpl*>(layer)->layer()->id() : 0; | 57 int id = layer ? static_cast<WebLayerImpl*>(layer)->layer()->id() : 0; |
32 static_cast<ScrollbarLayer*>(layer_->layer())->SetScrollLayerId(id); | 58 layer_->layer()->ToScrollbarLayerBase()->SetScrollLayerId(id); |
33 } | 59 } |
34 | 60 |
35 } // namespace webkit | 61 } // namespace webkit |
OLD | NEW |