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 ScrollbarLayerChromium_h
7 #define ScrollbarLayerChromium_h
9 #if USE(ACCELERATED_COMPOSITING)
11 #include "LayerChromium.h"
12 #include "caching_bitmap_canvas_layer_texture_updater.h"
13 #include <public/WebScrollbar.h>
14 #include <public/WebScrollbarThemeGeometry.h>
15 #include <public/WebScrollbarThemePainter.h>
20 class ScrollbarThemeComposite
;
21 class CCTextureUpdateQueue
;
23 class ScrollbarLayerChromium
: public LayerChromium
{
25 virtual PassOwnPtr
<CCLayerImpl
> createCCLayerImpl() OVERRIDE
;
27 static scoped_refptr
<ScrollbarLayerChromium
> create(PassOwnPtr
<WebKit::WebScrollbar
>, WebKit::WebScrollbarThemePainter
, PassOwnPtr
<WebKit::WebScrollbarThemeGeometry
>, int scrollLayerId
);
29 // LayerChromium interface
30 virtual bool needsContentsScale() const OVERRIDE
;
31 virtual IntSize
contentBounds() const OVERRIDE
;
32 virtual void setTexturePriorities(const CCPriorityCalculator
&) OVERRIDE
;
33 virtual void update(CCTextureUpdateQueue
&, const CCOcclusionTracker
*, CCRenderingStats
&) OVERRIDE
;
34 virtual void setLayerTreeHost(CCLayerTreeHost
*) OVERRIDE
;
35 virtual void pushPropertiesTo(CCLayerImpl
*) OVERRIDE
;
37 int scrollLayerId() const { return m_scrollLayerId
; }
38 void setScrollLayerId(int id
) { m_scrollLayerId
= id
; }
40 virtual ScrollbarLayerChromium
* toScrollbarLayerChromium() OVERRIDE
;
43 ScrollbarLayerChromium(PassOwnPtr
<WebKit::WebScrollbar
>, WebKit::WebScrollbarThemePainter
, PassOwnPtr
<WebKit::WebScrollbarThemeGeometry
>, int scrollLayerId
);
44 virtual ~ScrollbarLayerChromium();
47 void updatePart(CachingBitmapCanvasLayerTextureUpdater
*, LayerTextureUpdater::Texture
*, const IntRect
&, CCTextureUpdateQueue
&, CCRenderingStats
&);
48 void createTextureUpdaterIfNeeded();
50 OwnPtr
<WebKit::WebScrollbar
> m_scrollbar
;
51 WebKit::WebScrollbarThemePainter m_painter
;
52 OwnPtr
<WebKit::WebScrollbarThemeGeometry
> m_geometry
;
55 GC3Denum m_textureFormat
;
57 RefPtr
<CachingBitmapCanvasLayerTextureUpdater
> m_backTrackUpdater
;
58 RefPtr
<CachingBitmapCanvasLayerTextureUpdater
> m_foreTrackUpdater
;
59 RefPtr
<CachingBitmapCanvasLayerTextureUpdater
> m_thumbUpdater
;
61 // All the parts of the scrollbar except the thumb
62 OwnPtr
<LayerTextureUpdater::Texture
> m_backTrack
;
63 OwnPtr
<LayerTextureUpdater::Texture
> m_foreTrack
;
64 OwnPtr
<LayerTextureUpdater::Texture
> m_thumb
;
68 #endif // USE(ACCELERATED_COMPOSITING)