Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: cc/blink/web_scrollbar_layer_impl.cc

Issue 2591863003: Use nine-patch resource for drawing Aura overlay scrollbar thumb. (Closed)
Patch Set: Addressed sadrul@'s feedback Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/blink/web_scrollbar_layer_impl.h" 5 #include "cc/blink/web_scrollbar_layer_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "cc/blink/scrollbar_impl.h" 10 #include "cc/blink/scrollbar_impl.h"
11 #include "cc/blink/web_layer_impl.h" 11 #include "cc/blink/web_layer_impl.h"
12 #include "cc/layers/layer.h" 12 #include "cc/layers/layer.h"
13 #include "cc/layers/painted_overlay_scrollbar_layer.h"
13 #include "cc/layers/painted_scrollbar_layer.h" 14 #include "cc/layers/painted_scrollbar_layer.h"
14 #include "cc/layers/scrollbar_layer_interface.h" 15 #include "cc/layers/scrollbar_layer_interface.h"
15 #include "cc/layers/solid_color_scrollbar_layer.h" 16 #include "cc/layers/solid_color_scrollbar_layer.h"
16 17
18 using cc::PaintedOverlayScrollbarLayer;
17 using cc::PaintedScrollbarLayer; 19 using cc::PaintedScrollbarLayer;
18 using cc::SolidColorScrollbarLayer; 20 using cc::SolidColorScrollbarLayer;
19 21
20 namespace { 22 namespace {
21 23
22 cc::ScrollbarOrientation ConvertOrientation( 24 cc::ScrollbarOrientation ConvertOrientation(
23 blink::WebScrollbar::Orientation orientation) { 25 blink::WebScrollbar::Orientation orientation) {
24 return orientation == blink::WebScrollbar::Horizontal ? cc::HORIZONTAL 26 return orientation == blink::WebScrollbar::Horizontal ? cc::HORIZONTAL
25 : cc::VERTICAL; 27 : cc::VERTICAL;
26 } 28 }
27 29
28 } // namespace 30 } // namespace
29 31
30 namespace cc_blink { 32 namespace cc_blink {
31 33
32 WebScrollbarLayerImpl::WebScrollbarLayerImpl( 34 WebScrollbarLayerImpl::WebScrollbarLayerImpl(
33 std::unique_ptr<blink::WebScrollbar> scrollbar, 35 std::unique_ptr<blink::WebScrollbar> scrollbar,
34 blink::WebScrollbarThemePainter painter, 36 blink::WebScrollbarThemePainter painter,
35 std::unique_ptr<blink::WebScrollbarThemeGeometry> geometry) 37 std::unique_ptr<blink::WebScrollbarThemeGeometry> geometry)
36 : layer_(new WebLayerImpl(PaintedScrollbarLayer::Create( 38 : layer_(new WebLayerImpl(PaintedScrollbarLayer::Create(
37 base::MakeUnique<ScrollbarImpl>(std::move(scrollbar), 39 base::MakeUnique<ScrollbarImpl>(std::move(scrollbar),
38 painter, 40 painter,
39 std::move(geometry)), 41 std::move(geometry)),
40 0))) {} 42 0))) {}
41 43
42 WebScrollbarLayerImpl::WebScrollbarLayerImpl( 44 WebScrollbarLayerImpl::WebScrollbarLayerImpl(
45 std::unique_ptr<blink::WebScrollbar> scrollbar,
46 blink::WebScrollbarThemePainter painter,
47 std::unique_ptr<blink::WebScrollbarThemeGeometry> geometry,
48 bool)
49 : layer_(new WebLayerImpl(PaintedOverlayScrollbarLayer::Create(
50 base::MakeUnique<ScrollbarImpl>(std::move(scrollbar),
51 painter,
52 std::move(geometry)),
53 0))) {}
54
55 WebScrollbarLayerImpl::WebScrollbarLayerImpl(
43 blink::WebScrollbar::Orientation orientation, 56 blink::WebScrollbar::Orientation orientation,
44 int thumb_thickness, 57 int thumb_thickness,
45 int track_start, 58 int track_start,
46 bool is_left_side_vertical_scrollbar) 59 bool is_left_side_vertical_scrollbar)
47 : layer_(new WebLayerImpl( 60 : layer_(new WebLayerImpl(
48 SolidColorScrollbarLayer::Create(ConvertOrientation(orientation), 61 SolidColorScrollbarLayer::Create(ConvertOrientation(orientation),
49 thumb_thickness, 62 thumb_thickness,
50 track_start, 63 track_start,
51 is_left_side_vertical_scrollbar, 64 is_left_side_vertical_scrollbar,
52 0))) {} 65 0))) {}
53 66
54 WebScrollbarLayerImpl::~WebScrollbarLayerImpl() { 67 WebScrollbarLayerImpl::~WebScrollbarLayerImpl() {
55 } 68 }
56 69
57 blink::WebLayer* WebScrollbarLayerImpl::layer() { 70 blink::WebLayer* WebScrollbarLayerImpl::layer() {
58 return layer_.get(); 71 return layer_.get();
59 } 72 }
60 73
61 void WebScrollbarLayerImpl::setScrollLayer(blink::WebLayer* layer) { 74 void WebScrollbarLayerImpl::setScrollLayer(blink::WebLayer* layer) {
62 cc::Layer* scroll_layer = 75 cc::Layer* scroll_layer =
63 layer ? static_cast<WebLayerImpl*>(layer)->layer() : 0; 76 layer ? static_cast<WebLayerImpl*>(layer)->layer() : 0;
64 layer_->layer()->ToScrollbarLayer()->SetScrollLayer( 77 layer_->layer()->ToScrollbarLayer()->SetScrollLayer(
65 scroll_layer ? scroll_layer->id() : cc::Layer::INVALID_ID); 78 scroll_layer ? scroll_layer->id() : cc::Layer::INVALID_ID);
66 } 79 }
67 80
68 } // namespace cc_blink 81 } // namespace cc_blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698