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
3 // found in the LICENSE file.
6 #ifndef CC_SCROLLBAR_LAYER_H_
7 #define CC_SCROLLBAR_LAYER_H_
9 #include "cc/caching_bitmap_content_layer_updater.h"
10 #include "cc/cc_export.h"
11 #include "cc/contents_scaling_layer.h"
12 #include <public/WebScrollbar.h>
13 #include <public/WebScrollbarThemeGeometry.h>
14 #include <public/WebScrollbarThemePainter.h>
18 class ResourceUpdateQueue
;
20 class ScrollbarThemeComposite
;
22 class CC_EXPORT ScrollbarLayer
: public ContentsScalingLayer
{
24 virtual scoped_ptr
<LayerImpl
> createLayerImpl() OVERRIDE
;
26 static scoped_refptr
<ScrollbarLayer
> create(scoped_ptr
<WebKit::WebScrollbar
>, WebKit::WebScrollbarThemePainter
, scoped_ptr
<WebKit::WebScrollbarThemeGeometry
>, int scrollLayerId
);
29 virtual void setTexturePriorities(const PriorityCalculator
&) OVERRIDE
;
30 virtual void update(ResourceUpdateQueue
&, const OcclusionTracker
*, RenderingStats
&) OVERRIDE
;
31 virtual void setLayerTreeHost(LayerTreeHost
*) OVERRIDE
;
32 virtual void pushPropertiesTo(LayerImpl
*) OVERRIDE
;
34 int scrollLayerId() const { return m_scrollLayerId
; }
35 void setScrollLayerId(int id
) { m_scrollLayerId
= id
; }
37 virtual ScrollbarLayer
* toScrollbarLayer() OVERRIDE
;
40 ScrollbarLayer(scoped_ptr
<WebKit::WebScrollbar
>, WebKit::WebScrollbarThemePainter
, scoped_ptr
<WebKit::WebScrollbarThemeGeometry
>, int scrollLayerId
);
41 virtual ~ScrollbarLayer();
44 void updatePart(CachingBitmapContentLayerUpdater
*, LayerUpdater::Resource
*, const gfx::Rect
&, ResourceUpdateQueue
&, RenderingStats
&);
45 void createUpdaterIfNeeded();
46 gfx::Rect
scrollbarLayerRectToContentRect(const gfx::Rect
& layerRect
) const;
48 scoped_ptr
<WebKit::WebScrollbar
> m_scrollbar
;
49 WebKit::WebScrollbarThemePainter m_painter
;
50 scoped_ptr
<WebKit::WebScrollbarThemeGeometry
> m_geometry
;
53 GLenum m_textureFormat
;
55 scoped_refptr
<CachingBitmapContentLayerUpdater
> m_backTrackUpdater
;
56 scoped_refptr
<CachingBitmapContentLayerUpdater
> m_foreTrackUpdater
;
57 scoped_refptr
<CachingBitmapContentLayerUpdater
> m_thumbUpdater
;
59 // All the parts of the scrollbar except the thumb
60 scoped_ptr
<LayerUpdater::Resource
> m_backTrack
;
61 scoped_ptr
<LayerUpdater::Resource
> m_foreTrack
;
62 scoped_ptr
<LayerUpdater::Resource
> m_thumb
;
66 #endif // CC_SCROLLBAR_LAYER_H_