OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 LayerChromium_h | 6 #ifndef LayerChromium_h |
7 #define LayerChromium_h | 7 #define LayerChromium_h |
8 | 8 |
9 #if USE(ACCELERATED_COMPOSITING) | 9 #if USE(ACCELERATED_COMPOSITING) |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 // Base class for composited layers. Special layer types are derived from | 44 // Base class for composited layers. Special layer types are derived from |
45 // this class. | 45 // this class. |
46 class LayerChromium : public RefCounted<LayerChromium>, public CCLayerAnimationC
ontrollerClient { | 46 class LayerChromium : public RefCounted<LayerChromium>, public CCLayerAnimationC
ontrollerClient { |
47 public: | 47 public: |
48 static PassRefPtr<LayerChromium> create(); | 48 static PassRefPtr<LayerChromium> create(); |
49 | 49 |
50 virtual ~LayerChromium(); | 50 virtual ~LayerChromium(); |
51 | 51 |
52 // CCLayerAnimationControllerClient implementation | 52 // CCLayerAnimationControllerClient implementation |
53 virtual int id() const OVERRIDE { return m_layerId; } | 53 virtual int id() const OVERRIDE; |
54 virtual void setOpacityFromAnimation(float) OVERRIDE; | 54 virtual void setOpacityFromAnimation(float) OVERRIDE; |
55 virtual float opacity() const OVERRIDE { return m_opacity; } | 55 virtual float opacity() const OVERRIDE; |
56 virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix
&) OVERRIDE; | 56 virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix
&) OVERRIDE; |
57 // A layer's transform operates layer space. That is, entirely in logical, | 57 // A layer's transform operates layer space. That is, entirely in logical, |
58 // non-page-scaled pixels (that is, they have page zoom baked in, but not pa
ge scale). | 58 // non-page-scaled pixels (that is, they have page zoom baked in, but not pa
ge scale). |
59 // The root layer is a special case -- it operates in physical pixels. | 59 // The root layer is a special case -- it operates in physical pixels. |
60 virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE {
return m_transform; } | 60 virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE; |
61 | 61 |
62 LayerChromium* rootLayer(); | 62 LayerChromium* rootLayer(); |
63 LayerChromium* parent() const; | 63 LayerChromium* parent() const; |
64 void addChild(PassRefPtr<LayerChromium>); | 64 void addChild(PassRefPtr<LayerChromium>); |
65 void insertChild(PassRefPtr<LayerChromium>, size_t index); | 65 void insertChild(PassRefPtr<LayerChromium>, size_t index); |
66 void replaceChild(LayerChromium* reference, PassRefPtr<LayerChromium> newLay
er); | 66 void replaceChild(LayerChromium* reference, PassRefPtr<LayerChromium> newLay
er); |
67 void removeFromParent(); | 67 void removeFromParent(); |
68 void removeAllChildren(); | 68 void removeAllChildren(); |
69 void setChildren(const Vector<RefPtr<LayerChromium> >&); | 69 void setChildren(const Vector<RefPtr<LayerChromium> >&); |
70 | 70 |
71 const Vector<RefPtr<LayerChromium> >& children() const { return m_children;
} | 71 const Vector<RefPtr<LayerChromium> >& children() const { return m_children;
} |
72 | 72 |
73 void setAnchorPoint(const FloatPoint&); | 73 void setAnchorPoint(const FloatPoint&); |
74 FloatPoint anchorPoint() const { return m_anchorPoint; } | 74 FloatPoint anchorPoint() const { return m_anchorPoint; } |
75 | 75 |
76 void setAnchorPointZ(float); | 76 void setAnchorPointZ(float); |
77 float anchorPointZ() const { return m_anchorPointZ; } | 77 float anchorPointZ() const { return m_anchorPointZ; } |
78 | 78 |
79 void setBackgroundColor(SkColor); | 79 void setBackgroundColor(SkColor); |
80 SkColor backgroundColor() const { return m_backgroundColor; } | 80 SkColor backgroundColor() const { return m_backgroundColor; } |
81 | 81 |
82 // A layer's bounds are in logical, non-page-scaled pixels (however, the | 82 // A layer's bounds are in logical, non-page-scaled pixels (however, the |
83 // root layer's bounds are in physical pixels). | 83 // root layer's bounds are in physical pixels). |
84 void setBounds(const IntSize&); | 84 void setBounds(const IntSize&); |
85 const IntSize& bounds() const { return m_bounds; } | 85 const IntSize& bounds() const { return m_bounds; } |
86 virtual IntSize contentBounds() const { return bounds(); } | 86 virtual IntSize contentBounds() const; |
87 | 87 |
88 void setMasksToBounds(bool); | 88 void setMasksToBounds(bool); |
89 bool masksToBounds() const { return m_masksToBounds; } | 89 bool masksToBounds() const { return m_masksToBounds; } |
90 | 90 |
91 void setMaskLayer(LayerChromium*); | 91 void setMaskLayer(LayerChromium*); |
92 LayerChromium* maskLayer() const { return m_maskLayer.get(); } | 92 LayerChromium* maskLayer() const { return m_maskLayer.get(); } |
93 | 93 |
94 virtual void setNeedsDisplayRect(const FloatRect& dirtyRect); | 94 virtual void setNeedsDisplayRect(const FloatRect& dirtyRect); |
95 void setNeedsDisplay() { setNeedsDisplayRect(FloatRect(FloatPoint(), bounds(
))); } | 95 void setNeedsDisplay() { setNeedsDisplayRect(FloatRect(FloatPoint(), bounds(
))); } |
96 virtual bool needsDisplay() const { return m_needsDisplay; } | 96 virtual bool needsDisplay() const; |
97 | 97 |
98 void setOpacity(float); | 98 void setOpacity(float); |
99 bool opacityIsAnimating() const; | 99 bool opacityIsAnimating() const; |
100 | 100 |
101 void setFilters(const WebKit::WebFilterOperations&); | 101 void setFilters(const WebKit::WebFilterOperations&); |
102 const WebKit::WebFilterOperations& filters() const { return m_filters; } | 102 const WebKit::WebFilterOperations& filters() const { return m_filters; } |
103 | 103 |
104 // Background filters are filters applied to what is behind this layer, when
they are viewed through non-opaque | 104 // Background filters are filters applied to what is behind this layer, when
they are viewed through non-opaque |
105 // regions in this layer. They are used through the WebLayer interface, and
are not exposed to HTML. | 105 // regions in this layer. They are used through the WebLayer interface, and
are not exposed to HTML. |
106 void setBackgroundFilters(const WebKit::WebFilterOperations&); | 106 void setBackgroundFilters(const WebKit::WebFilterOperations&); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 void setIsDrawable(bool); | 177 void setIsDrawable(bool); |
178 | 178 |
179 void setReplicaLayer(LayerChromium*); | 179 void setReplicaLayer(LayerChromium*); |
180 LayerChromium* replicaLayer() const { return m_replicaLayer.get(); } | 180 LayerChromium* replicaLayer() const { return m_replicaLayer.get(); } |
181 | 181 |
182 bool hasMask() const { return m_maskLayer; } | 182 bool hasMask() const { return m_maskLayer; } |
183 bool hasReplica() const { return m_replicaLayer; } | 183 bool hasReplica() const { return m_replicaLayer; } |
184 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep
licaLayer->m_maskLayer); } | 184 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep
licaLayer->m_maskLayer); } |
185 | 185 |
186 // These methods typically need to be overwritten by derived classes. | 186 // These methods typically need to be overwritten by derived classes. |
187 virtual bool drawsContent() const { return m_isDrawable; } | 187 virtual bool drawsContent() const; |
188 virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRend
eringStats&) { } | 188 virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRend
eringStats&) { } |
189 virtual bool needMoreUpdates() { return false; } | 189 virtual bool needMoreUpdates(); |
190 virtual void setIsMask(bool) { } | 190 virtual void setIsMask(bool) { } |
191 virtual void bindContentsTexture() { } | 191 virtual void bindContentsTexture() { } |
192 virtual bool needsContentsScale() const { return false; } | 192 virtual bool needsContentsScale() const; |
193 | 193 |
194 void setDebugBorderColor(SkColor); | 194 void setDebugBorderColor(SkColor); |
195 void setDebugBorderWidth(float); | 195 void setDebugBorderWidth(float); |
196 void setDebugName(const std::string&); | 196 void setDebugName(const std::string&); |
197 | 197 |
198 virtual void pushPropertiesTo(CCLayerImpl*); | 198 virtual void pushPropertiesTo(CCLayerImpl*); |
199 | 199 |
200 void clearRenderSurface() { m_renderSurface.clear(); } | 200 void clearRenderSurface() { m_renderSurface.clear(); } |
201 RenderSurfaceChromium* renderSurface() const { return m_renderSurface.get();
} | 201 RenderSurfaceChromium* renderSurface() const { return m_renderSurface.get();
} |
202 void createRenderSurface(); | 202 void createRenderSurface(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 256 |
257 void setLayerAnimationDelegate(WebKit::WebAnimationDelegate* layerAnimationD
elegate) { m_layerAnimationDelegate = layerAnimationDelegate; } | 257 void setLayerAnimationDelegate(WebKit::WebAnimationDelegate* layerAnimationD
elegate) { m_layerAnimationDelegate = layerAnimationDelegate; } |
258 | 258 |
259 bool hasActiveAnimation() const; | 259 bool hasActiveAnimation() const; |
260 | 260 |
261 virtual void notifyAnimationStarted(const CCAnimationEvent&, double wallCloc
kTime); | 261 virtual void notifyAnimationStarted(const CCAnimationEvent&, double wallCloc
kTime); |
262 virtual void notifyAnimationFinished(double wallClockTime); | 262 virtual void notifyAnimationFinished(double wallClockTime); |
263 | 263 |
264 virtual Region visibleContentOpaqueRegion() const; | 264 virtual Region visibleContentOpaqueRegion() const; |
265 | 265 |
266 virtual ScrollbarLayerChromium* toScrollbarLayerChromium() { return 0; } | 266 virtual ScrollbarLayerChromium* toScrollbarLayerChromium(); |
267 | 267 |
268 protected: | 268 protected: |
269 friend class CCLayerImpl; | 269 friend class CCLayerImpl; |
270 friend class TreeSynchronizer; | 270 friend class TreeSynchronizer; |
271 | 271 |
272 LayerChromium(); | 272 LayerChromium(); |
273 | 273 |
274 void setNeedsCommit(); | 274 void setNeedsCommit(); |
275 | 275 |
276 // This flag is set when layer need repainting/updating. | 276 // This flag is set when layer need repainting/updating. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 WebKit::WebAnimationDelegate* m_layerAnimationDelegate; | 375 WebKit::WebAnimationDelegate* m_layerAnimationDelegate; |
376 WebKit::WebLayerScrollClient* m_layerScrollClient; | 376 WebKit::WebLayerScrollClient* m_layerScrollClient; |
377 }; | 377 }; |
378 | 378 |
379 void sortLayers(Vector<RefPtr<LayerChromium> >::iterator, Vector<RefPtr<LayerChr
omium> >::iterator, void*); | 379 void sortLayers(Vector<RefPtr<LayerChromium> >::iterator, Vector<RefPtr<LayerChr
omium> >::iterator, void*); |
380 | 380 |
381 } | 381 } |
382 #endif // USE(ACCELERATED_COMPOSITING) | 382 #endif // USE(ACCELERATED_COMPOSITING) |
383 | 383 |
384 #endif | 384 #endif |
OLD | NEW |