OLD | NEW |
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 | 5 |
6 #ifndef ScrollbarLayerChromium_h | 6 #ifndef ScrollbarLayerChromium_h |
7 #define ScrollbarLayerChromium_h | 7 #define ScrollbarLayerChromium_h |
8 | 8 |
9 #include "caching_bitmap_content_layer_updater.h" | 9 #include "cc/caching_bitmap_content_layer_updater.h" |
10 #include "cc/layer.h" | 10 #include "cc/contents_scaling_layer.h" |
11 #include <public/WebScrollbar.h> | 11 #include <public/WebScrollbar.h> |
12 #include <public/WebScrollbarThemeGeometry.h> | 12 #include <public/WebScrollbarThemeGeometry.h> |
13 #include <public/WebScrollbarThemePainter.h> | 13 #include <public/WebScrollbarThemePainter.h> |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
17 class ResourceUpdateQueue; | 17 class ResourceUpdateQueue; |
18 class Scrollbar; | 18 class Scrollbar; |
19 class ScrollbarThemeComposite; | 19 class ScrollbarThemeComposite; |
20 | 20 |
21 class ScrollbarLayer : public Layer { | 21 class ScrollbarLayer : public ContentsScalingLayer { |
22 public: | 22 public: |
23 virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE; | 23 virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE; |
24 | 24 |
25 static scoped_refptr<ScrollbarLayer> create(scoped_ptr<WebKit::WebScrollbar>
, WebKit::WebScrollbarThemePainter, scoped_ptr<WebKit::WebScrollbarThemeGeometry
>, int scrollLayerId); | 25 static scoped_refptr<ScrollbarLayer> create(scoped_ptr<WebKit::WebScrollbar>
, WebKit::WebScrollbarThemePainter, scoped_ptr<WebKit::WebScrollbarThemeGeometry
>, int scrollLayerId); |
26 | 26 |
27 // Layer interface | 27 // Layer interface |
28 virtual bool needsContentsScale() const OVERRIDE; | |
29 virtual IntSize contentBounds() const OVERRIDE; | |
30 virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE; | 28 virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE; |
31 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering
Stats&) OVERRIDE; | 29 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering
Stats&) OVERRIDE; |
32 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; | 30 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; |
33 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; | 31 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; |
34 | 32 |
35 int scrollLayerId() const { return m_scrollLayerId; } | 33 int scrollLayerId() const { return m_scrollLayerId; } |
36 void setScrollLayerId(int id) { m_scrollLayerId = id; } | 34 void setScrollLayerId(int id) { m_scrollLayerId = id; } |
37 | 35 |
38 virtual ScrollbarLayer* toScrollbarLayer() OVERRIDE; | 36 virtual ScrollbarLayer* toScrollbarLayer() OVERRIDE; |
39 | 37 |
40 protected: | 38 protected: |
41 ScrollbarLayer(scoped_ptr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePa
inter, scoped_ptr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId); | 39 ScrollbarLayer(scoped_ptr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePa
inter, scoped_ptr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId); |
42 virtual ~ScrollbarLayer(); | 40 virtual ~ScrollbarLayer(); |
43 | 41 |
44 private: | 42 private: |
45 void updatePart(CachingBitmapContentLayerUpdater*, LayerUpdater::Resource*,
const IntRect&, ResourceUpdateQueue&, RenderingStats&); | 43 void updatePart(CachingBitmapContentLayerUpdater*, LayerUpdater::Resource*,
const IntRect&, ResourceUpdateQueue&, RenderingStats&); |
46 void createUpdaterIfNeeded(); | 44 void createUpdaterIfNeeded(); |
| 45 IntRect scrollbarLayerRectToContentRect(const WebKit::WebRect& layerRect) co
nst; |
47 | 46 |
48 scoped_ptr<WebKit::WebScrollbar> m_scrollbar; | 47 scoped_ptr<WebKit::WebScrollbar> m_scrollbar; |
49 WebKit::WebScrollbarThemePainter m_painter; | 48 WebKit::WebScrollbarThemePainter m_painter; |
50 scoped_ptr<WebKit::WebScrollbarThemeGeometry> m_geometry; | 49 scoped_ptr<WebKit::WebScrollbarThemeGeometry> m_geometry; |
51 int m_scrollLayerId; | 50 int m_scrollLayerId; |
52 | 51 |
53 GLenum m_textureFormat; | 52 GLenum m_textureFormat; |
54 | 53 |
55 scoped_refptr<CachingBitmapContentLayerUpdater> m_backTrackUpdater; | 54 scoped_refptr<CachingBitmapContentLayerUpdater> m_backTrackUpdater; |
56 scoped_refptr<CachingBitmapContentLayerUpdater> m_foreTrackUpdater; | 55 scoped_refptr<CachingBitmapContentLayerUpdater> m_foreTrackUpdater; |
57 scoped_refptr<CachingBitmapContentLayerUpdater> m_thumbUpdater; | 56 scoped_refptr<CachingBitmapContentLayerUpdater> m_thumbUpdater; |
58 | 57 |
59 // All the parts of the scrollbar except the thumb | 58 // All the parts of the scrollbar except the thumb |
60 scoped_ptr<LayerUpdater::Resource> m_backTrack; | 59 scoped_ptr<LayerUpdater::Resource> m_backTrack; |
61 scoped_ptr<LayerUpdater::Resource> m_foreTrack; | 60 scoped_ptr<LayerUpdater::Resource> m_foreTrack; |
62 scoped_ptr<LayerUpdater::Resource> m_thumb; | 61 scoped_ptr<LayerUpdater::Resource> m_thumb; |
63 }; | 62 }; |
64 | 63 |
65 } | 64 } |
66 #endif | 65 #endif |
OLD | NEW |