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

Side by Side Diff: webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.cc

Issue 16679011: Add viewport scrollbar class to support overlay scrollbars for pinch zoom virtual viewport. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
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/input/viewport_scrollbar.h"
7 #include "cc/layers/scrollbar_layer.h" 8 #include "cc/layers/scrollbar_layer.h"
8 #include "third_party/WebKit/public/platform/WebScrollbar.h"
9 #include "webkit/renderer/compositor_bindings/scrollbar_impl.h" 9 #include "webkit/renderer/compositor_bindings/scrollbar_impl.h"
10 #include "webkit/renderer/compositor_bindings/web_layer_impl.h"
11 10
12 using cc::ScrollbarLayer; 11 using cc::ScrollbarLayer;
12 using cc::ViewportScrollbar;
13 13
14 namespace webkit { 14 namespace webkit {
15 15
16 WebScrollbarLayerImpl::WebScrollbarLayerImpl( 16 WebScrollbarLayerImpl::WebScrollbarLayerImpl(
17 WebKit::WebScrollbar* scrollbar, 17 WebKit::WebScrollbar* scrollbar,
18 WebKit::WebScrollbarThemePainter painter, 18 WebKit::WebScrollbarThemePainter painter,
19 WebKit::WebScrollbarThemeGeometry* geometry) 19 WebKit::WebScrollbarThemeGeometry* geometry)
20 : layer_(new WebLayerImpl(ScrollbarLayer::Create( 20 : layer_(new WebLayerImpl(ScrollbarLayer::Create(
21 scoped_ptr<cc::Scrollbar>(new ScrollbarImpl( 21 scoped_ptr<cc::Scrollbar>(new ScrollbarImpl(
22 make_scoped_ptr(scrollbar), 22 make_scoped_ptr(scrollbar),
23 painter, 23 painter,
24 make_scoped_ptr(geometry))).Pass(), 0))) {} 24 make_scoped_ptr(geometry))).Pass(), 0))) {}
25 25
26 WebScrollbarLayerImpl::WebScrollbarLayerImpl(
enne (OOO) 2013/06/12 19:44:38 I am not really sure this is in line with what I w
wjmaclean 2013/06/12 19:54:36 By "behave identically" you mean using cc:Scrollba
trchen 2013/06/12 21:22:11 I agree with enne@ that we should avoid adding new
27 WebKit::WebLayer* scroll_layer,
28 WebKit::WebScrollbar::Orientation orientation,
29 size_t thickness)
30 : layer_(new WebLayerImpl(ScrollbarLayer::Create(
31 scoped_ptr<cc::Scrollbar>(new ViewportScrollbar(
32 static_cast<WebLayerImpl*>(scroll_layer)->layer(),
33 orientation == WebKit::WebScrollbar::Horizontal ? cc::HORIZONTAL
34 : cc::VERTICAL,
35 thickness)),
36 0))) {
37 // Do this here to be consistent with the layer passed to the
38 // ViewportScrollbar.
39 setScrollLayer(scroll_layer);
40 }
41
26 WebScrollbarLayerImpl::~WebScrollbarLayerImpl() {} 42 WebScrollbarLayerImpl::~WebScrollbarLayerImpl() {}
27 43
28 WebKit::WebLayer* WebScrollbarLayerImpl::layer() { return layer_.get(); } 44 WebKit::WebLayer* WebScrollbarLayerImpl::layer() { return layer_.get(); }
29 45
30 void WebScrollbarLayerImpl::setScrollLayer(WebKit::WebLayer* layer) { 46 void WebScrollbarLayerImpl::setScrollLayer(WebKit::WebLayer* layer) {
31 int id = layer ? static_cast<WebLayerImpl*>(layer)->layer()->id() : 0; 47 int id = layer ? static_cast<WebLayerImpl*>(layer)->layer()->id() : 0;
32 static_cast<ScrollbarLayer*>(layer_->layer())->SetScrollLayerId(id); 48 static_cast<ScrollbarLayer*>(layer_->layer())->SetScrollLayerId(id);
33 } 49 }
34 50
35 } // namespace webkit 51 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698