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 const Vector<RefPtr<LayerChromium> >& children() const { return m_children;
} | 70 const Vector<RefPtr<LayerChromium> >& children() const { return m_children;
} |
71 | 71 |
72 void setAnchorPoint(const FloatPoint&); | 72 void setAnchorPoint(const FloatPoint&); |
73 FloatPoint anchorPoint() const { return m_anchorPoint; } | 73 FloatPoint anchorPoint() const { return m_anchorPoint; } |
74 | 74 |
75 void setAnchorPointZ(float); | 75 void setAnchorPointZ(float); |
76 float anchorPointZ() const { return m_anchorPointZ; } | 76 float anchorPointZ() const { return m_anchorPointZ; } |
77 | 77 |
78 void setBackgroundColor(SkColor); | 78 void setBackgroundColor(SkColor); |
79 SkColor backgroundColor() const { return m_backgroundColor; } | 79 SkColor backgroundColor() const { return m_backgroundColor; } |
80 | 80 |
81 // A layer's bounds are in logical, non-page-scaled pixels (however, the | 81 // A layer's bounds are in logical, non-page-scaled pixels (however, the |
82 // root layer's bounds are in physical pixels). | 82 // root layer's bounds are in physical pixels). |
83 void setBounds(const IntSize&); | 83 void setBounds(const IntSize&); |
84 const IntSize& bounds() const { return m_bounds; } | 84 const IntSize& bounds() const { return m_bounds; } |
85 virtual IntSize contentBounds() const { return bounds(); } | 85 virtual IntSize contentBounds() const; |
86 | 86 |
87 void setMasksToBounds(bool); | 87 void setMasksToBounds(bool); |
88 bool masksToBounds() const { return m_masksToBounds; } | 88 bool masksToBounds() const { return m_masksToBounds; } |
89 | 89 |
90 void setMaskLayer(LayerChromium*); | 90 void setMaskLayer(LayerChromium*); |
91 LayerChromium* maskLayer() const { return m_maskLayer.get(); } | 91 LayerChromium* maskLayer() const { return m_maskLayer.get(); } |
92 | 92 |
93 virtual void setNeedsDisplayRect(const FloatRect& dirtyRect); | 93 virtual void setNeedsDisplayRect(const FloatRect& dirtyRect); |
94 void setNeedsDisplay() { setNeedsDisplayRect(FloatRect(FloatPoint(), bounds(
))); } | 94 void setNeedsDisplay() { setNeedsDisplayRect(FloatRect(FloatPoint(), bounds(
))); } |
95 virtual bool needsDisplay() const { return m_needsDisplay; } | 95 virtual bool needsDisplay() const; |
96 | 96 |
97 void setOpacity(float); | 97 void setOpacity(float); |
98 bool opacityIsAnimating() const; | 98 bool opacityIsAnimating() const; |
99 | 99 |
100 void setFilters(const WebKit::WebFilterOperations&); | 100 void setFilters(const WebKit::WebFilterOperations&); |
101 const WebKit::WebFilterOperations& filters() const { return m_filters; } | 101 const WebKit::WebFilterOperations& filters() const { return m_filters; } |
102 | 102 |
103 // Background filters are filters applied to what is behind this layer, when
they are viewed through non-opaque | 103 // Background filters are filters applied to what is behind this layer, when
they are viewed through non-opaque |
104 // regions in this layer. They are used through the WebLayer interface, and
are not exposed to HTML. | 104 // regions in this layer. They are used through the WebLayer interface, and
are not exposed to HTML. |
105 void setBackgroundFilters(const WebKit::WebFilterOperations&); | 105 void setBackgroundFilters(const WebKit::WebFilterOperations&); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 void setIsDrawable(bool); | 174 void setIsDrawable(bool); |
175 | 175 |
176 void setReplicaLayer(LayerChromium*); | 176 void setReplicaLayer(LayerChromium*); |
177 LayerChromium* replicaLayer() const { return m_replicaLayer.get(); } | 177 LayerChromium* replicaLayer() const { return m_replicaLayer.get(); } |
178 | 178 |
179 bool hasMask() const { return m_maskLayer; } | 179 bool hasMask() const { return m_maskLayer; } |
180 bool hasReplica() const { return m_replicaLayer; } | 180 bool hasReplica() const { return m_replicaLayer; } |
181 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep
licaLayer->m_maskLayer); } | 181 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep
licaLayer->m_maskLayer); } |
182 | 182 |
183 // These methods typically need to be overwritten by derived classes. | 183 // These methods typically need to be overwritten by derived classes. |
184 virtual bool drawsContent() const { return m_isDrawable; } | 184 virtual bool drawsContent() const; |
185 virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRend
eringStats&) { } | 185 virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRend
eringStats&) { } |
186 virtual bool needMoreUpdates() { return false; } | 186 virtual bool needMoreUpdates(); |
187 virtual void setIsMask(bool) { } | 187 virtual void setIsMask(bool) { } |
188 virtual void bindContentsTexture() { } | 188 virtual void bindContentsTexture() { } |
189 virtual bool needsContentsScale() const { return false; } | 189 virtual bool needsContentsScale() const; |
190 | 190 |
191 void setDebugBorderColor(SkColor); | 191 void setDebugBorderColor(SkColor); |
192 void setDebugBorderWidth(float); | 192 void setDebugBorderWidth(float); |
193 void setDebugName(const std::string&); | 193 void setDebugName(const std::string&); |
194 | 194 |
195 virtual void pushPropertiesTo(CCLayerImpl*); | 195 virtual void pushPropertiesTo(CCLayerImpl*); |
196 | 196 |
197 void clearRenderSurface() { m_renderSurface.clear(); } | 197 void clearRenderSurface() { m_renderSurface.clear(); } |
198 RenderSurfaceChromium* renderSurface() const { return m_renderSurface.get();
} | 198 RenderSurfaceChromium* renderSurface() const { return m_renderSurface.get();
} |
199 void createRenderSurface(); | 199 void createRenderSurface(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 253 |
254 void setLayerAnimationDelegate(WebKit::WebAnimationDelegate* layerAnimationD
elegate) { m_layerAnimationDelegate = layerAnimationDelegate; } | 254 void setLayerAnimationDelegate(WebKit::WebAnimationDelegate* layerAnimationD
elegate) { m_layerAnimationDelegate = layerAnimationDelegate; } |
255 | 255 |
256 bool hasActiveAnimation() const; | 256 bool hasActiveAnimation() const; |
257 | 257 |
258 virtual void notifyAnimationStarted(const CCAnimationEvent&, double wallCloc
kTime); | 258 virtual void notifyAnimationStarted(const CCAnimationEvent&, double wallCloc
kTime); |
259 virtual void notifyAnimationFinished(double wallClockTime); | 259 virtual void notifyAnimationFinished(double wallClockTime); |
260 | 260 |
261 virtual Region visibleContentOpaqueRegion() const; | 261 virtual Region visibleContentOpaqueRegion() const; |
262 | 262 |
263 virtual ScrollbarLayerChromium* toScrollbarLayerChromium() { return 0; } | 263 virtual ScrollbarLayerChromium* toScrollbarLayerChromium(); |
264 | 264 |
265 protected: | 265 protected: |
266 friend class CCLayerImpl; | 266 friend class CCLayerImpl; |
267 friend class TreeSynchronizer; | 267 friend class TreeSynchronizer; |
268 | 268 |
269 LayerChromium(); | 269 LayerChromium(); |
270 | 270 |
271 void setNeedsCommit(); | 271 void setNeedsCommit(); |
272 | 272 |
273 // This flag is set when layer need repainting/updating. | 273 // This flag is set when layer need repainting/updating. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 WebKit::WebAnimationDelegate* m_layerAnimationDelegate; | 372 WebKit::WebAnimationDelegate* m_layerAnimationDelegate; |
373 WebKit::WebLayerScrollClient* m_layerScrollClient; | 373 WebKit::WebLayerScrollClient* m_layerScrollClient; |
374 }; | 374 }; |
375 | 375 |
376 void sortLayers(Vector<RefPtr<LayerChromium> >::iterator, Vector<RefPtr<LayerChr
omium> >::iterator, void*); | 376 void sortLayers(Vector<RefPtr<LayerChromium> >::iterator, Vector<RefPtr<LayerChr
omium> >::iterator, void*); |
377 | 377 |
378 } | 378 } |
379 #endif // USE(ACCELERATED_COMPOSITING) | 379 #endif // USE(ACCELERATED_COMPOSITING) |
380 | 380 |
381 #endif | 381 #endif |
OLD | NEW |