blob: dcc8d6fee1501a743efd03fba6bb6c1e699cec55 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/blink/web_scrollbar_layer_impl.h"
#include "cc/blink/scrollbar_impl.h"
#include "cc/blink/web_layer_impl.h"
#include "cc/layers/layer.h"
#include "cc/layers/painted_scrollbar_layer.h"
#include "cc/layers/scrollbar_layer_interface.h"
#include "cc/layers/solid_color_scrollbar_layer.h"
using cc::PaintedScrollbarLayer;
using cc::SolidColorScrollbarLayer;
namespace {
cc::ScrollbarOrientation ConvertOrientation(
blink::WebScrollbar::Orientation orientation) {
return orientation == blink::WebScrollbar::Horizontal ? cc::HORIZONTAL
: cc::VERTICAL;
}
} // namespace
namespace cc_blink {
WebScrollbarLayerImpl::WebScrollbarLayerImpl(
blink::WebScrollbar* scrollbar,
blink::WebScrollbarThemePainter painter,
blink::WebScrollbarThemeGeometry* geometry)
: layer_(new WebLayerImpl(PaintedScrollbarLayer::Create(
scoped_ptr<cc::Scrollbar>(
new ScrollbarImpl(make_scoped_ptr(scrollbar),
painter,
make_scoped_ptr(geometry))).Pass(),
0))) {
}
WebScrollbarLayerImpl::WebScrollbarLayerImpl(
blink::WebScrollbar::Orientation orientation,
int thumb_thickness,
int track_start,
bool is_left_side_vertical_scrollbar)
: layer_(new WebLayerImpl(
SolidColorScrollbarLayer::Create(ConvertOrientation(orientation),
thumb_thickness,
track_start,
is_left_side_vertical_scrollbar,
0))) {
}
WebScrollbarLayerImpl::~WebScrollbarLayerImpl() {
}
blink::WebLayer* WebScrollbarLayerImpl::layer() {
return layer_.get();
}
void WebScrollbarLayerImpl::setScrollLayer(blink::WebLayer* layer) {
cc::Layer* scroll_layer =
layer ? static_cast<WebLayerImpl*>(layer)->layer() : 0;
layer_->layer()->ToScrollbarLayer()->SetScrollLayer(scroll_layer->id());
}
void WebScrollbarLayerImpl::setClipLayer(blink::WebLayer* layer) {
cc::Layer* clip_layer =
layer ? static_cast<WebLayerImpl*>(layer)->layer() : 0;
layer_->layer()->ToScrollbarLayer()->SetClipLayer(clip_layer->id());
}
} // namespace cc_blink
|