Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: cc/scrollbar_layer.h

Issue 11550035: Implement pinch-zoom scaling for main-frame scrollbars and pinch-zoom overlay scrollbars. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revised architecture - complete cl for comments on approach. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/cc_export.h" 9 #include "cc/cc_export.h"
10 #include "cc/contents_scaling_layer.h" 10 #include "cc/contents_scaling_layer.h"
11 #include "cc/layer_updater.h" 11 #include "cc/layer_updater.h"
12 #include "cc/scrollbar_theme_painter.h" 12 #include "cc/scrollbar_theme_painter.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbar.h" 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbar.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbarThemeGe ometry.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbarThemeGe ometry.h"
15 15
16 namespace cc { 16 namespace cc {
17 class CachingBitmapContentLayerUpdater; 17 class CachingBitmapContentLayerUpdater;
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( 26 static scoped_refptr<ScrollbarLayer> create(
27 scoped_ptr<WebKit::WebScrollbar>, 27 scoped_ptr<WebKit::WebScrollbar>,
28 scoped_ptr<ScrollbarThemePainter>, 28 scoped_ptr<ScrollbarThemePainter>,
29 scoped_ptr<WebKit::WebScrollbarThemeGeometry>, 29 scoped_ptr<WebKit::WebScrollbarThemeGeometry>,
30 int scrollLayerId, bool isPinchZoomScrollbar = false);
31
32 // This version of create() only called when creating pinch zoom scrollbars.
33 static scoped_refptr<ScrollbarLayer> create(
34 scoped_ptr<WebKit::WebScrollbar>,
35 scoped_ptr<ScrollbarThemePainter>,
30 int scrollLayerId); 36 int scrollLayerId);
31 37
38 static void setDefaultGeometry(WebKit::WebScrollbarThemeGeometry*);
39 static WebKit::WebScrollbarThemeGeometry* cloneDefaultGeometry();
40 static void setDefaultUsesOverlayScrollbars(bool);
41 static bool defaultUsesOverlayScrollbars() { return s_usesOverlayScrollbars; }
42
32 int scrollLayerId() const { return m_scrollLayerId; } 43 int scrollLayerId() const { return m_scrollLayerId; }
33 void setScrollLayerId(int id); 44 void setScrollLayerId(int id);
34 45
35 WebKit::WebScrollbar::Orientation orientation() const; 46 WebKit::WebScrollbar::Orientation orientation() const;
36 47
48 bool isPinchZoomScrollbar() { return m_isPinchZoomScrollbar; }
49
37 // Layer interface 50 // Layer interface
38 virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE; 51 virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE;
39 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering Stats*) OVERRIDE; 52 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering Stats*) OVERRIDE;
40 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; 53 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE;
41 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; 54 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE;
42 virtual void calculateContentsScale( 55 virtual void calculateContentsScale(
43 float idealContentsScale, 56 float idealContentsScale,
44 bool animatingTransformToScreen, 57 bool animatingTransformToScreen,
45 float* contentsScaleX, 58 float* contentsScaleX,
46 float* contentsScaleY, 59 float* contentsScaleY,
47 gfx::Size* contentBounds) OVERRIDE; 60 gfx::Size* contentBounds) OVERRIDE;
48 61
49 virtual ScrollbarLayer* toScrollbarLayer() OVERRIDE; 62 virtual ScrollbarLayer* toScrollbarLayer() OVERRIDE;
50 63
51 protected: 64 protected:
52 ScrollbarLayer( 65 ScrollbarLayer(
53 scoped_ptr<WebKit::WebScrollbar>, 66 scoped_ptr<WebKit::WebScrollbar>,
54 scoped_ptr<ScrollbarThemePainter>, 67 scoped_ptr<ScrollbarThemePainter>,
55 scoped_ptr<WebKit::WebScrollbarThemeGeometry>, 68 scoped_ptr<WebKit::WebScrollbarThemeGeometry>,
56 int scrollLayerId); 69 int scrollLayerId, bool isPinchZoomScrollbar);
57 virtual ~ScrollbarLayer(); 70 virtual ~ScrollbarLayer();
58 71
59 private: 72 private:
60 void updatePart(CachingBitmapContentLayerUpdater*, LayerUpdater::Resource*, const gfx::Rect&, ResourceUpdateQueue&, RenderingStats*); 73 void updatePart(CachingBitmapContentLayerUpdater*, LayerUpdater::Resource*, const gfx::Rect&, ResourceUpdateQueue&, RenderingStats*);
61 void createUpdaterIfNeeded(); 74 void createUpdaterIfNeeded();
62 gfx::Rect scrollbarLayerRectToContentRect(const gfx::Rect& layerRect) const; 75 gfx::Rect scrollbarLayerRectToContentRect(const gfx::Rect& layerRect) const;
63 76
64 bool isDirty() const { return !m_dirtyRect.IsEmpty(); } 77 bool isDirty() const { return !m_dirtyRect.IsEmpty(); }
65 78
66 int maxTextureSize(); 79 int maxTextureSize();
67 float clampScaleToMaxTextureSize(float scale); 80 float clampScaleToMaxTextureSize(float scale);
68 81
82 static scoped_ptr<WebKit::WebScrollbarThemeGeometry> s_defaultGeometry;
83 static bool s_usesOverlayScrollbars;
aelias_OOO_until_Jul13 2013/02/06 19:02:45 Please avoid statics.
84
69 scoped_ptr<WebKit::WebScrollbar> m_scrollbar; 85 scoped_ptr<WebKit::WebScrollbar> m_scrollbar;
70 scoped_ptr<ScrollbarThemePainter> m_painter; 86 scoped_ptr<ScrollbarThemePainter> m_painter;
71 scoped_ptr<WebKit::WebScrollbarThemeGeometry> m_geometry; 87 scoped_ptr<WebKit::WebScrollbarThemeGeometry> m_geometry;
72 gfx::Size m_thumbSize; 88 gfx::Size m_thumbSize;
73 int m_scrollLayerId; 89 int m_scrollLayerId;
74 90
75 unsigned m_textureFormat; 91 unsigned m_textureFormat;
92 bool m_isPinchZoomScrollbar;
76 93
77 gfx::RectF m_dirtyRect; 94 gfx::RectF m_dirtyRect;
78 95
79 scoped_refptr<CachingBitmapContentLayerUpdater> m_backTrackUpdater; 96 scoped_refptr<CachingBitmapContentLayerUpdater> m_backTrackUpdater;
80 scoped_refptr<CachingBitmapContentLayerUpdater> m_foreTrackUpdater; 97 scoped_refptr<CachingBitmapContentLayerUpdater> m_foreTrackUpdater;
81 scoped_refptr<CachingBitmapContentLayerUpdater> m_thumbUpdater; 98 scoped_refptr<CachingBitmapContentLayerUpdater> m_thumbUpdater;
82 99
83 // All the parts of the scrollbar except the thumb 100 // All the parts of the scrollbar except the thumb
84 scoped_ptr<LayerUpdater::Resource> m_backTrack; 101 scoped_ptr<LayerUpdater::Resource> m_backTrack;
85 scoped_ptr<LayerUpdater::Resource> m_foreTrack; 102 scoped_ptr<LayerUpdater::Resource> m_foreTrack;
86 scoped_ptr<LayerUpdater::Resource> m_thumb; 103 scoped_ptr<LayerUpdater::Resource> m_thumb;
87 }; 104 };
88 105
89 } 106 }
90 #endif // CC_SCROLLBAR_LAYER_H_ 107 #endif // CC_SCROLLBAR_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698