OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 NormalCompositingLayer, // non-tiled layer with backing store | 43 NormalCompositingLayer, // non-tiled layer with backing store |
44 MediaCompositingLayer, // layer that contains an image, video, webGL or plug
in | 44 MediaCompositingLayer, // layer that contains an image, video, webGL or plug
in |
45 ContainerCompositingLayer // layer with no backing store | 45 ContainerCompositingLayer // layer with no backing store |
46 }; | 46 }; |
47 | 47 |
48 | 48 |
49 // A GraphicsLayerPaintInfo contains all the info needed to paint a partial subt
ree of RenderLayers into a GraphicsLayer. | 49 // A GraphicsLayerPaintInfo contains all the info needed to paint a partial subt
ree of RenderLayers into a GraphicsLayer. |
50 struct GraphicsLayerPaintInfo { | 50 struct GraphicsLayerPaintInfo { |
51 RenderLayer* renderLayer; | 51 RenderLayer* renderLayer; |
52 | 52 |
53 IntRect compositedBounds; | 53 LayoutRect compositedBounds; |
54 | 54 |
55 // A temporary offset used for squashing layers, when the origin of the | 55 // A temporary offset used for squashing layers, when the origin of the |
56 // squashing layer is not yet known. | 56 // squashing layer is not yet known. |
57 IntSize offsetFromBackingRoot; | 57 IntSize offsetFromBackingRoot; |
58 | 58 |
59 IntSize offsetFromRenderer; | 59 IntSize offsetFromRenderer; |
60 | 60 |
61 GraphicsLayerPaintingPhase paintingPhase; | 61 GraphicsLayerPaintingPhase paintingPhase; |
62 | 62 |
63 bool isBackgroundLayer; | 63 bool isBackgroundLayer; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 // Interface to start, finish, suspend and resume animations and transitions | 144 // Interface to start, finish, suspend and resume animations and transitions |
145 bool startTransition(double, CSSPropertyID, const RenderStyle* fromStyle, co
nst RenderStyle* toStyle); | 145 bool startTransition(double, CSSPropertyID, const RenderStyle* fromStyle, co
nst RenderStyle* toStyle); |
146 void transitionPaused(double timeOffset, CSSPropertyID); | 146 void transitionPaused(double timeOffset, CSSPropertyID); |
147 void transitionFinished(CSSPropertyID); | 147 void transitionFinished(CSSPropertyID); |
148 | 148 |
149 bool startAnimation(double timeOffset, const CSSAnimationData*, const Keyfra
meList& keyframes); | 149 bool startAnimation(double timeOffset, const CSSAnimationData*, const Keyfra
meList& keyframes); |
150 void animationPaused(double timeOffset, const String& name); | 150 void animationPaused(double timeOffset, const String& name); |
151 void animationFinished(const String& name); | 151 void animationFinished(const String& name); |
152 | 152 |
153 IntRect compositedBounds() const; | 153 LayoutRect compositedBounds() const; |
154 void setCompositedBounds(const IntRect&); | 154 void setCompositedBounds(const LayoutRect&); |
155 void updateCompositedBounds(); | 155 void updateCompositedBounds(); |
156 | 156 |
157 void updateAfterWidgetResize(); | 157 void updateAfterWidgetResize(); |
158 void positionOverflowControlsLayers(const IntSize& offsetFromRoot); | 158 void positionOverflowControlsLayers(const IntSize& offsetFromRoot); |
159 bool hasUnpositionedOverflowControlsLayers() const; | 159 bool hasUnpositionedOverflowControlsLayers() const; |
160 | 160 |
161 void addRenderLayerToSquashingGraphicsLayer(RenderLayer*, IntSize offsetFrom
TargetBacking, size_t nextSquashedLayerIndex); | 161 void addRenderLayerToSquashingGraphicsLayer(RenderLayer*, IntSize offsetFrom
TargetBacking, size_t nextSquashedLayerIndex); |
162 void finishAccumulatingSquashingLayers(size_t nextSquashedLayerIndex); | 162 void finishAccumulatingSquashingLayers(size_t nextSquashedLayerIndex); |
163 | 163 |
164 // GraphicsLayerClient interface | 164 // GraphicsLayerClient interface |
165 virtual void notifyAnimationStarted(const GraphicsLayer*, double wallClockTi
me, double monotonicTime) OVERRIDE; | 165 virtual void notifyAnimationStarted(const GraphicsLayer*, double wallClockTi
me, double monotonicTime) OVERRIDE; |
166 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsL
ayerPaintingPhase, const IntRect& clip) OVERRIDE; | 166 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsL
ayerPaintingPhase, const IntRect& clip) OVERRIDE; |
167 virtual bool isTrackingRepaints() const OVERRIDE; | 167 virtual bool isTrackingRepaints() const OVERRIDE; |
168 | 168 |
169 PassOwnPtr<Vector<FloatRect> > collectTrackedRepaintRects() const; | 169 PassOwnPtr<Vector<FloatRect> > collectTrackedRepaintRects() const; |
170 | 170 |
171 #ifndef NDEBUG | 171 #ifndef NDEBUG |
172 virtual void verifyNotPainting(); | 172 virtual void verifyNotPainting(); |
173 #endif | 173 #endif |
174 | 174 |
175 IntRect contentsBox() const; | 175 LayoutRect contentsBox() const; |
176 IntRect backgroundBox() const; | 176 IntRect backgroundBox() const; |
177 | 177 |
178 // For informative purposes only. | 178 // For informative purposes only. |
179 CompositingLayerType compositingLayerType() const; | 179 CompositingLayerType compositingLayerType() const; |
180 | 180 |
181 GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizo
ntalScrollbar.get(); } | 181 GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizo
ntalScrollbar.get(); } |
182 GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVertical
Scrollbar.get(); } | 182 GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVertical
Scrollbar.get(); } |
183 GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.
get(); } | 183 GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.
get(); } |
184 | 184 |
185 void updateFilters(const RenderStyle*); | 185 void updateFilters(const RenderStyle*); |
186 bool canCompositeFilters() const { return m_canCompositeFilters; } | 186 bool canCompositeFilters() const { return m_canCompositeFilters; } |
187 | 187 |
188 // Return an estimate of the backing store area (in pixels) allocated by thi
s object's GraphicsLayers. | 188 // Return an estimate of the backing store area (in pixels) allocated by thi
s object's GraphicsLayers. |
189 double backingStoreMemoryEstimate() const; | 189 double backingStoreMemoryEstimate() const; |
190 | 190 |
191 void setBlendMode(blink::WebBlendMode); | 191 void setBlendMode(blink::WebBlendMode); |
192 | 192 |
193 virtual String debugName(const GraphicsLayer*) OVERRIDE; | 193 virtual String debugName(const GraphicsLayer*) OVERRIDE; |
194 | 194 |
| 195 LayoutSize subpixelAccumulation() const { return m_subpixelAccumulation; } |
195 private: | 196 private: |
196 void createPrimaryGraphicsLayer(); | 197 void createPrimaryGraphicsLayer(); |
197 void destroyGraphicsLayers(); | 198 void destroyGraphicsLayers(); |
198 | 199 |
199 PassOwnPtr<GraphicsLayer> createGraphicsLayer(CompositingReasons); | 200 PassOwnPtr<GraphicsLayer> createGraphicsLayer(CompositingReasons); |
200 | 201 |
201 RenderLayerModelObject* renderer() const { return m_owningLayer->renderer();
} | 202 RenderLayerModelObject* renderer() const { return m_owningLayer->renderer();
} |
202 RenderLayerCompositor* compositor() const { return m_owningLayer->compositor
(); } | 203 RenderLayerCompositor* compositor() const { return m_owningLayer->compositor
(); } |
203 | 204 |
204 void updateInternalHierarchy(); | 205 void updateInternalHierarchy(); |
205 bool updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip); | 206 bool updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip); |
206 bool updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool n
eedsVerticalScrollbarLayer, bool needsScrollCornerLayer); | 207 bool updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool n
eedsVerticalScrollbarLayer, bool needsScrollCornerLayer); |
207 bool updateForegroundLayer(bool needsForegroundLayer); | 208 bool updateForegroundLayer(bool needsForegroundLayer); |
208 bool updateBackgroundLayer(bool needsBackgroundLayer); | 209 bool updateBackgroundLayer(bool needsBackgroundLayer); |
209 bool updateMaskLayer(bool needsMaskLayer); | 210 bool updateMaskLayer(bool needsMaskLayer); |
210 bool updateClippingMaskLayers(bool needsChildClippingMaskLayer); | 211 bool updateClippingMaskLayers(bool needsChildClippingMaskLayer); |
211 bool requiresHorizontalScrollbarLayer() const { return m_owningLayer->scroll
ableArea() && m_owningLayer->scrollableArea()->horizontalScrollbar(); } | 212 bool requiresHorizontalScrollbarLayer() const { return m_owningLayer->scroll
ableArea() && m_owningLayer->scrollableArea()->horizontalScrollbar(); } |
212 bool requiresVerticalScrollbarLayer() const { return m_owningLayer->scrollab
leArea() && m_owningLayer->scrollableArea()->verticalScrollbar(); } | 213 bool requiresVerticalScrollbarLayer() const { return m_owningLayer->scrollab
leArea() && m_owningLayer->scrollableArea()->verticalScrollbar(); } |
213 bool requiresScrollCornerLayer() const { return m_owningLayer->scrollableAre
a() && !m_owningLayer->scrollableArea()->scrollCornerAndResizerRect().isEmpty();
} | 214 bool requiresScrollCornerLayer() const { return m_owningLayer->scrollableAre
a() && !m_owningLayer->scrollableArea()->scrollCornerAndResizerRect().isEmpty();
} |
214 bool updateScrollingLayers(bool scrollingLayers); | 215 bool updateScrollingLayers(bool scrollingLayers); |
215 void updateScrollParent(RenderLayer*); | 216 void updateScrollParent(RenderLayer*); |
216 void updateClipParent(RenderLayer*); | 217 void updateClipParent(RenderLayer*); |
217 bool updateSquashingLayers(bool needsSquashingLayers); | 218 bool updateSquashingLayers(bool needsSquashingLayers); |
218 void updateDrawsContent(bool isSimpleContainer); | 219 void updateDrawsContent(bool isSimpleContainer); |
219 void registerScrollingLayers(); | 220 void registerScrollingLayers(); |
220 | 221 |
| 222 void adjustBoundsForSubPixelAccumulation(const RenderLayer* compositedAncest
or, IntRect& localCompositingBounds, IntRect& relativeCompositingBounds, IntPoin
t& delta); |
| 223 |
221 void setBackgroundLayerPaintsFixedRootBackground(bool); | 224 void setBackgroundLayerPaintsFixedRootBackground(bool); |
222 | 225 |
223 GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const; | 226 GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const; |
224 | 227 |
225 IntSize contentOffsetInCompostingLayer() const; | 228 LayoutSize contentOffsetInCompostingLayer() const; |
226 // Result is transform origin in pixels. | 229 // Result is transform origin in pixels. |
227 FloatPoint3D computeTransformOrigin(const IntRect& borderBox) const; | 230 FloatPoint3D computeTransformOrigin(const IntRect& borderBox) const; |
228 // Result is perspective origin in pixels. | 231 // Result is perspective origin in pixels. |
229 FloatPoint computePerspectiveOrigin(const IntRect& borderBox) const; | 232 FloatPoint computePerspectiveOrigin(const IntRect& borderBox) const; |
230 | 233 |
231 void updateOpacity(const RenderStyle*); | 234 void updateOpacity(const RenderStyle*); |
232 void updateTransform(const RenderStyle*); | 235 void updateTransform(const RenderStyle*); |
233 void updateLayerBlendMode(const RenderStyle*); | 236 void updateLayerBlendMode(const RenderStyle*); |
234 void updateIsRootForIsolatedGroup(); | 237 void updateIsRootForIsolatedGroup(); |
235 // Return the opacity value that this layer should use for compositing. | 238 // Return the opacity value that this layer should use for compositing. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar; | 334 OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar; |
332 OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar; | 335 OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar; |
333 OwnPtr<GraphicsLayer> m_layerForScrollCorner; | 336 OwnPtr<GraphicsLayer> m_layerForScrollCorner; |
334 | 337 |
335 OwnPtr<WebAnimationProvider> m_animationProvider; | 338 OwnPtr<WebAnimationProvider> m_animationProvider; |
336 | 339 |
337 OwnPtr<GraphicsLayer> m_squashingContainmentLayer; // Only used if any squas
hed layers exist, to contain the squashed layers as siblings to the rest of the
GraphicsLayer tree chunk. | 340 OwnPtr<GraphicsLayer> m_squashingContainmentLayer; // Only used if any squas
hed layers exist, to contain the squashed layers as siblings to the rest of the
GraphicsLayer tree chunk. |
338 OwnPtr<GraphicsLayer> m_squashingLayer; // Only used if any squashed layers
exist, this is the backing that squashed layers paint into. | 341 OwnPtr<GraphicsLayer> m_squashingLayer; // Only used if any squashed layers
exist, this is the backing that squashed layers paint into. |
339 Vector<GraphicsLayerPaintInfo> m_squashedLayers; | 342 Vector<GraphicsLayerPaintInfo> m_squashedLayers; |
340 | 343 |
341 IntRect m_compositedBounds; | 344 LayoutRect m_compositedBounds; |
| 345 LayoutSize m_subpixelAccumulation; // The accumulated subpixel offset of the
compositedBounds compared to absolute coordinates. |
342 | 346 |
343 bool m_artificiallyInflatedBounds; // bounds had to be made non-zero to make
transform-origin work | 347 bool m_artificiallyInflatedBounds; // bounds had to be made non-zero to make
transform-origin work |
344 bool m_boundsConstrainedByClipping; | 348 bool m_boundsConstrainedByClipping; |
345 bool m_isMainFrameRenderViewLayer; | 349 bool m_isMainFrameRenderViewLayer; |
346 bool m_requiresOwnBackingStoreForIntrinsicReasons; | 350 bool m_requiresOwnBackingStoreForIntrinsicReasons; |
347 bool m_requiresOwnBackingStoreForAncestorReasons; | 351 bool m_requiresOwnBackingStoreForAncestorReasons; |
348 bool m_canCompositeFilters; | 352 bool m_canCompositeFilters; |
349 bool m_backgroundLayerPaintsFixedRootBackground; | 353 bool m_backgroundLayerPaintsFixedRootBackground; |
350 }; | 354 }; |
351 | 355 |
352 } // namespace WebCore | 356 } // namespace WebCore |
353 | 357 |
354 #endif // CompositedLayerMapping_h | 358 #endif // CompositedLayerMapping_h |
OLD | NEW |