Revert "Merged all Chromoting Host code into remoting_core.dll (Windows)."
[chromium-blink-merge.git] / cc / scrollbar_layer.h
blob30f4d2ddf9f228a76828ac4fdabc99476d85f0b3
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/cc_export.h"
10 #include "cc/contents_scaling_layer.h"
11 #include "cc/layer_updater.h"
12 #include "cc/scrollbar_theme_painter.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbar.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbarThemeGeometry.h"
16 namespace cc {
17 class CachingBitmapContentLayerUpdater;
18 class ResourceUpdateQueue;
19 class Scrollbar;
20 class ScrollbarThemeComposite;
22 class CC_EXPORT ScrollbarLayer : public ContentsScalingLayer {
23 public:
24 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERRIDE;
26 static scoped_refptr<ScrollbarLayer> create(
27 scoped_ptr<WebKit::WebScrollbar>,
28 scoped_ptr<ScrollbarThemePainter>,
29 scoped_ptr<WebKit::WebScrollbarThemeGeometry>,
30 int scrollLayerId);
32 int scrollLayerId() const { return m_scrollLayerId; }
33 void setScrollLayerId(int id);
35 WebKit::WebScrollbar::Orientation orientation() const;
37 // Layer interface
38 virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE;
39 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&) OVERRIDE;
40 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE;
41 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE;
42 virtual void calculateContentsScale(
43 float idealContentsScale,
44 float* contentsScaleX,
45 float* contentsScaleY,
46 gfx::Size* contentBounds) OVERRIDE;
48 virtual ScrollbarLayer* toScrollbarLayer() OVERRIDE;
50 protected:
51 ScrollbarLayer(
52 scoped_ptr<WebKit::WebScrollbar>,
53 scoped_ptr<ScrollbarThemePainter>,
54 scoped_ptr<WebKit::WebScrollbarThemeGeometry>,
55 int scrollLayerId);
56 virtual ~ScrollbarLayer();
58 private:
59 void updatePart(CachingBitmapContentLayerUpdater*, LayerUpdater::Resource*, const gfx::Rect&, ResourceUpdateQueue&, RenderingStats&);
60 void createUpdaterIfNeeded();
61 gfx::Rect scrollbarLayerRectToContentRect(const gfx::Rect& layerRect) const;
63 bool isDirty() const { return !m_dirtyRect.IsEmpty(); }
65 int maxTextureSize();
66 float clampScaleToMaxTextureSize(float scale);
68 scoped_ptr<WebKit::WebScrollbar> m_scrollbar;
69 scoped_ptr<ScrollbarThemePainter> m_painter;
70 scoped_ptr<WebKit::WebScrollbarThemeGeometry> m_geometry;
71 gfx::Size m_thumbSize;
72 int m_scrollLayerId;
74 unsigned m_textureFormat;
76 gfx::RectF m_dirtyRect;
78 scoped_refptr<CachingBitmapContentLayerUpdater> m_backTrackUpdater;
79 scoped_refptr<CachingBitmapContentLayerUpdater> m_foreTrackUpdater;
80 scoped_refptr<CachingBitmapContentLayerUpdater> m_thumbUpdater;
82 // All the parts of the scrollbar except the thumb
83 scoped_ptr<LayerUpdater::Resource> m_backTrack;
84 scoped_ptr<LayerUpdater::Resource> m_foreTrack;
85 scoped_ptr<LayerUpdater::Resource> m_thumb;
89 #endif // CC_SCROLLBAR_LAYER_H_