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 CC_SCROLLBAR_LAYER_H_ | 6 #ifndef CC_SCROLLBAR_LAYER_H_ |
7 #define CC_SCROLLBAR_LAYER_H_ | 7 #define CC_SCROLLBAR_LAYER_H_ |
8 | 8 |
9 #include "cc/caching_bitmap_content_layer_updater.h" | 9 #include "cc/caching_bitmap_content_layer_updater.h" |
10 #include "cc/cc_export.h" | 10 #include "cc/cc_export.h" |
11 #include "cc/contents_scaling_layer.h" | 11 #include "cc/contents_scaling_layer.h" |
12 #include <public/WebScrollbar.h> | 12 #include "cc/scrollbar_theme_painter.h" |
13 #include <public/WebScrollbarThemeGeometry.h> | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbar.h" |
14 #include <public/WebScrollbarThemePainter.h> | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbarThemeGe
ometry.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 | 17 |
18 class ResourceUpdateQueue; | 18 class ResourceUpdateQueue; |
19 class Scrollbar; | 19 class Scrollbar; |
20 class ScrollbarThemeComposite; | 20 class ScrollbarThemeComposite; |
21 | 21 |
22 class CC_EXPORT ScrollbarLayer : public ContentsScalingLayer { | 22 class CC_EXPORT ScrollbarLayer : public ContentsScalingLayer { |
23 public: | 23 public: |
24 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERR
IDE; | 24 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERR
IDE; |
25 | 25 |
26 static scoped_refptr<ScrollbarLayer> create(scoped_ptr<WebKit::WebScrollbar>
, WebKit::WebScrollbarThemePainter, scoped_ptr<WebKit::WebScrollbarThemeGeometry
>, int scrollLayerId); | 26 static scoped_refptr<ScrollbarLayer> create( |
| 27 scoped_ptr<WebKit::WebScrollbar>, |
| 28 scoped_ptr<ScrollbarThemePainter>, |
| 29 scoped_ptr<WebKit::WebScrollbarThemeGeometry>, |
| 30 int scrollLayerId); |
27 | 31 |
28 int scrollLayerId() const { return m_scrollLayerId; } | 32 int scrollLayerId() const { return m_scrollLayerId; } |
29 void setScrollLayerId(int id); | 33 void setScrollLayerId(int id); |
30 | 34 |
31 // Layer interface | 35 // Layer interface |
32 virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE; | 36 virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE; |
33 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering
Stats&) OVERRIDE; | 37 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering
Stats&) OVERRIDE; |
34 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; | 38 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; |
35 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; | 39 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; |
36 virtual void calculateContentsScale( | 40 virtual void calculateContentsScale( |
37 float idealContentsScale, | 41 float idealContentsScale, |
38 float* contentsScaleX, | 42 float* contentsScaleX, |
39 float* contentsScaleY, | 43 float* contentsScaleY, |
40 gfx::Size* contentBounds) OVERRIDE; | 44 gfx::Size* contentBounds) OVERRIDE; |
41 | 45 |
42 virtual ScrollbarLayer* toScrollbarLayer() OVERRIDE; | 46 virtual ScrollbarLayer* toScrollbarLayer() OVERRIDE; |
43 | 47 |
44 protected: | 48 protected: |
45 ScrollbarLayer(scoped_ptr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePa
inter, scoped_ptr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId); | 49 ScrollbarLayer( |
| 50 scoped_ptr<WebKit::WebScrollbar>, |
| 51 scoped_ptr<ScrollbarThemePainter>, |
| 52 scoped_ptr<WebKit::WebScrollbarThemeGeometry>, |
| 53 int scrollLayerId); |
46 virtual ~ScrollbarLayer(); | 54 virtual ~ScrollbarLayer(); |
47 | 55 |
48 private: | 56 private: |
49 void updatePart(CachingBitmapContentLayerUpdater*, LayerUpdater::Resource*,
const gfx::Rect&, ResourceUpdateQueue&, RenderingStats&); | 57 void updatePart(CachingBitmapContentLayerUpdater*, LayerUpdater::Resource*,
const gfx::Rect&, ResourceUpdateQueue&, RenderingStats&); |
50 void createUpdaterIfNeeded(); | 58 void createUpdaterIfNeeded(); |
51 gfx::Rect scrollbarLayerRectToContentRect(const gfx::Rect& layerRect) const; | 59 gfx::Rect scrollbarLayerRectToContentRect(const gfx::Rect& layerRect) const; |
52 | 60 |
53 int maxTextureSize(); | 61 int maxTextureSize(); |
54 float clampScaleToMaxTextureSize(float scale); | 62 float clampScaleToMaxTextureSize(float scale); |
55 | 63 |
56 scoped_ptr<WebKit::WebScrollbar> m_scrollbar; | 64 scoped_ptr<WebKit::WebScrollbar> m_scrollbar; |
57 WebKit::WebScrollbarThemePainter m_painter; | 65 scoped_ptr<ScrollbarThemePainter> m_painter; |
58 scoped_ptr<WebKit::WebScrollbarThemeGeometry> m_geometry; | 66 scoped_ptr<WebKit::WebScrollbarThemeGeometry> m_geometry; |
59 int m_scrollLayerId; | 67 int m_scrollLayerId; |
60 | 68 |
61 GLenum m_textureFormat; | 69 GLenum m_textureFormat; |
62 | 70 |
63 scoped_refptr<CachingBitmapContentLayerUpdater> m_backTrackUpdater; | 71 scoped_refptr<CachingBitmapContentLayerUpdater> m_backTrackUpdater; |
64 scoped_refptr<CachingBitmapContentLayerUpdater> m_foreTrackUpdater; | 72 scoped_refptr<CachingBitmapContentLayerUpdater> m_foreTrackUpdater; |
65 scoped_refptr<CachingBitmapContentLayerUpdater> m_thumbUpdater; | 73 scoped_refptr<CachingBitmapContentLayerUpdater> m_thumbUpdater; |
66 | 74 |
67 // All the parts of the scrollbar except the thumb | 75 // All the parts of the scrollbar except the thumb |
68 scoped_ptr<LayerUpdater::Resource> m_backTrack; | 76 scoped_ptr<LayerUpdater::Resource> m_backTrack; |
69 scoped_ptr<LayerUpdater::Resource> m_foreTrack; | 77 scoped_ptr<LayerUpdater::Resource> m_foreTrack; |
70 scoped_ptr<LayerUpdater::Resource> m_thumb; | 78 scoped_ptr<LayerUpdater::Resource> m_thumb; |
71 }; | 79 }; |
72 | 80 |
73 } | 81 } |
74 #endif // CC_SCROLLBAR_LAYER_H_ | 82 #endif // CC_SCROLLBAR_LAYER_H_ |
OLD | NEW |