| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 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 29 matching lines...) Expand all Loading... |
| 40 class RenderPart; | 40 class RenderPart; |
| 41 class RenderVideo; | 41 class RenderVideo; |
| 42 class ScrollingCoordinator; | 42 class ScrollingCoordinator; |
| 43 class StickyPositionViewportConstraints; | 43 class StickyPositionViewportConstraints; |
| 44 | 44 |
| 45 | 45 |
| 46 enum CompositingUpdateType { | 46 enum CompositingUpdateType { |
| 47 CompositingUpdateAfterStyleChange, | 47 CompositingUpdateAfterStyleChange, |
| 48 CompositingUpdateAfterLayout, | 48 CompositingUpdateAfterLayout, |
| 49 CompositingUpdateOnScroll, | 49 CompositingUpdateOnScroll, |
| 50 CompositingUpdateOnCompositedScroll, | 50 CompositingUpdateOnCompositedScroll |
| 51 CompositingUpdateFinishAllDeferredWork | |
| 52 }; | 51 }; |
| 53 | 52 |
| 54 // RenderLayerCompositor manages the hierarchy of | 53 // RenderLayerCompositor manages the hierarchy of |
| 55 // composited RenderLayers. It determines which RenderLayers | 54 // composited RenderLayers. It determines which RenderLayers |
| 56 // become compositing, and creates and maintains a hierarchy of | 55 // become compositing, and creates and maintains a hierarchy of |
| 57 // GraphicsLayers based on the RenderLayer painting order. | 56 // GraphicsLayers based on the RenderLayer painting order. |
| 58 // | 57 // |
| 59 // There is one RenderLayerCompositor per RenderView. | 58 // There is one RenderLayerCompositor per RenderView. |
| 60 | 59 |
| 61 class RenderLayerCompositor : public GraphicsLayerClient { | 60 class RenderLayerCompositor : public GraphicsLayerClient { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 86 void setCompositingLayersNeedRebuild(bool needRebuild = true); | 85 void setCompositingLayersNeedRebuild(bool needRebuild = true); |
| 87 bool compositingLayersNeedRebuild() const { return m_compositingLayersNeedRe
build; } | 86 bool compositingLayersNeedRebuild() const { return m_compositingLayersNeedRe
build; } |
| 88 | 87 |
| 89 // Called when something outside WebKit affects the visible rect (e.g. deleg
ated scrolling). Might schedule a layer flush. | 88 // Called when something outside WebKit affects the visible rect (e.g. deleg
ated scrolling). Might schedule a layer flush. |
| 90 void didChangeVisibleRect(); | 89 void didChangeVisibleRect(); |
| 91 | 90 |
| 92 // Updating properties required for determining if compositing is necessary. | 91 // Updating properties required for determining if compositing is necessary. |
| 93 void updateCompositingRequirementsState(); | 92 void updateCompositingRequirementsState(); |
| 94 void setNeedsUpdateCompositingRequirementsState() { m_needsUpdateCompositing
RequirementsState = true; } | 93 void setNeedsUpdateCompositingRequirementsState() { m_needsUpdateCompositing
RequirementsState = true; } |
| 95 | 94 |
| 96 // Main entry point for a full update. As needed, this function will compute
compositing requirements, | 95 // Rebuild the tree of compositing layers |
| 97 // rebuild the composited layer tree, and/or update all the properties assoc
aited with each layer of the | |
| 98 // composited layer tree. | |
| 99 void updateCompositingLayers(CompositingUpdateType, RenderLayer* updateRoot
= 0); | 96 void updateCompositingLayers(CompositingUpdateType, RenderLayer* updateRoot
= 0); |
| 100 | 97 |
| 101 // Update the compositing state of the given layer. Returns true if that sta
te changed. | 98 // Update the compositing state of the given layer. Returns true if that sta
te changed. |
| 102 enum CompositingChangeRepaint { CompositingChangeRepaintNow, CompositingChan
geWillRepaintLater }; | 99 enum CompositingChangeRepaint { CompositingChangeRepaintNow, CompositingChan
geWillRepaintLater }; |
| 103 bool updateLayerCompositingState(RenderLayer*, CompositingChangeRepaint = Co
mpositingChangeRepaintNow); | 100 bool updateLayerCompositingState(RenderLayer*, CompositingChangeRepaint = Co
mpositingChangeRepaintNow); |
| 104 | 101 |
| 105 // Update the geometry for compositing children of compositingAncestor. | 102 // Update the geometry for compositing children of compositingAncestor. |
| 106 void updateCompositingDescendantGeometry(RenderLayerStackingNode* compositin
gAncestor, RenderLayer*, bool compositedChildrenOnly); | 103 void updateCompositingDescendantGeometry(RenderLayerStackingNode* compositin
gAncestor, RenderLayer*, bool compositedChildrenOnly); |
| 107 | 104 |
| 108 // Whether layer's compositedLayerMapping needs a GraphicsLayer to do clippi
ng by an ancestor (non-stacking-context parent with overflow). | 105 // Whether layer's compositedLayerMapping needs a GraphicsLayer to do clippi
ng by an ancestor (non-stacking-context parent with overflow). |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 188 |
| 192 void updateViewportConstraintStatus(RenderLayer*); | 189 void updateViewportConstraintStatus(RenderLayer*); |
| 193 void removeViewportConstrainedLayer(RenderLayer*); | 190 void removeViewportConstrainedLayer(RenderLayer*); |
| 194 | 191 |
| 195 void addOutOfFlowPositionedLayer(RenderLayer*); | 192 void addOutOfFlowPositionedLayer(RenderLayer*); |
| 196 void removeOutOfFlowPositionedLayer(RenderLayer*); | 193 void removeOutOfFlowPositionedLayer(RenderLayer*); |
| 197 | 194 |
| 198 void resetTrackedRepaintRects(); | 195 void resetTrackedRepaintRects(); |
| 199 void setTracksRepaints(bool); | 196 void setTracksRepaints(bool); |
| 200 | 197 |
| 201 void setNeedsToRecomputeCompositingRequirements() { m_needsToRecomputeCompos
itingRequirements = true; } | 198 void setShouldReevaluateCompositingAfterLayout() { m_reevaluateCompositingAf
terLayout = true; } |
| 202 | 199 |
| 203 // Returns all reasons (direct, indirectly due to subtree, and indirectly du
e to overlap) that a layer should be composited. | 200 // Returns all reasons (direct, indirectly due to subtree, and indirectly du
e to overlap) that a layer should be composited. |
| 204 CompositingReasons reasonsForCompositing(const RenderLayer*) const; | 201 CompositingReasons reasonsForCompositing(const RenderLayer*) const; |
| 205 | 202 |
| 206 virtual String debugName(const GraphicsLayer*) OVERRIDE; | 203 virtual String debugName(const GraphicsLayer*) OVERRIDE; |
| 207 | 204 |
| 208 private: | 205 private: |
| 209 class OverlapMap; | 206 class OverlapMap; |
| 210 | 207 |
| 211 // GraphicsLayerClient implementation | 208 // GraphicsLayerClient implementation |
| (...skipping 17 matching lines...) Expand all Loading... |
| 229 bool allocateOrClearCompositedLayerMapping(RenderLayer*, CompositingChangeRe
paint shouldRepaint); | 226 bool allocateOrClearCompositedLayerMapping(RenderLayer*, CompositingChangeRe
paint shouldRepaint); |
| 230 | 227 |
| 231 void clearMappingForRenderLayerIncludingDescendants(RenderLayer*); | 228 void clearMappingForRenderLayerIncludingDescendants(RenderLayer*); |
| 232 | 229 |
| 233 // Repaint the given rect (which is layer's coords), and regions of child la
yers that intersect that rect. | 230 // Repaint the given rect (which is layer's coords), and regions of child la
yers that intersect that rect. |
| 234 void recursiveRepaintLayer(RenderLayer*, const IntRect* = 0); | 231 void recursiveRepaintLayer(RenderLayer*, const IntRect* = 0); |
| 235 | 232 |
| 236 void addToOverlapMap(OverlapMap&, RenderLayer*, IntRect& layerBounds, bool&
boundsComputed); | 233 void addToOverlapMap(OverlapMap&, RenderLayer*, IntRect& layerBounds, bool&
boundsComputed); |
| 237 void addToOverlapMapRecursive(OverlapMap&, RenderLayer*, RenderLayer* ancest
orLayer = 0); | 234 void addToOverlapMapRecursive(OverlapMap&, RenderLayer*, RenderLayer* ancest
orLayer = 0); |
| 238 | 235 |
| 239 // Forces an update for all frames of frame tree recursively. Used only when
the mainFrame compositor is ready to | |
| 240 // finish all deferred work. | |
| 241 static void finishCompositingUpdateForFrameTree(Frame*); | |
| 242 | |
| 243 // Returns true if any layer's compositing changed | 236 // Returns true if any layer's compositing changed |
| 244 void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer*
, OverlapMap*, struct CompositingRecursionData&, bool& layersChanged, bool& desc
endantHas3DTransform, Vector<RenderLayer*>& unclippedDescendants); | 237 void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer*
, OverlapMap*, struct CompositingRecursionData&, bool& layersChanged, bool& desc
endantHas3DTransform, Vector<RenderLayer*>& unclippedDescendants); |
| 245 | 238 |
| 246 // Recurses down the tree, parenting descendant compositing layers and colle
cting an array of child layers for the current compositing layer. | 239 // Recurses down the tree, parenting descendant compositing layers and colle
cting an array of child layers for the current compositing layer. |
| 247 void rebuildCompositingLayerTree(RenderLayer*, Vector<GraphicsLayer*>& child
GraphicsLayersOfEnclosingLayer, int depth); | 240 void rebuildCompositingLayerTree(RenderLayer*, Vector<GraphicsLayer*>& child
GraphicsLayersOfEnclosingLayer, int depth); |
| 248 | 241 |
| 249 // Recurses down the tree, updating layer geometry only. | 242 // Recurses down the tree, updating layer geometry only. |
| 250 void updateLayerTreeGeometry(RenderLayer*, int depth); | 243 void updateLayerTreeGeometry(RenderLayer*, int depth); |
| 251 | 244 |
| 252 // Hook compositing layers together | 245 // Hook compositing layers together |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 private: | 305 private: |
| 313 RenderView* m_renderView; | 306 RenderView* m_renderView; |
| 314 OwnPtr<GraphicsLayer> m_rootContentLayer; | 307 OwnPtr<GraphicsLayer> m_rootContentLayer; |
| 315 | 308 |
| 316 bool m_hasAcceleratedCompositing; | 309 bool m_hasAcceleratedCompositing; |
| 317 ChromeClient::CompositingTriggerFlags m_compositingTriggers; | 310 ChromeClient::CompositingTriggerFlags m_compositingTriggers; |
| 318 | 311 |
| 319 int m_compositedLayerCount; | 312 int m_compositedLayerCount; |
| 320 bool m_showRepaintCounter; | 313 bool m_showRepaintCounter; |
| 321 | 314 |
| 322 // FIXME: This should absolutely not be mutable. | 315 // When true, we have to wait until layout has happened before we can decide
whether to enter compositing mode, |
| 323 mutable bool m_needsToRecomputeCompositingRequirements; | 316 // because only then do we know the final size of plugins and iframes. |
| 324 bool m_needsToUpdateLayerTreeGeometry; | 317 mutable bool m_reevaluateCompositingAfterLayout; |
| 325 | 318 |
| 326 bool m_compositing; | 319 bool m_compositing; |
| 327 bool m_compositingLayersNeedRebuild; | 320 bool m_compositingLayersNeedRebuild; |
| 328 bool m_forceCompositingMode; | 321 bool m_forceCompositingMode; |
| 329 bool m_inPostLayoutUpdate; // true when it's OK to trust layout information
(e.g. layer sizes and positions) | 322 bool m_inPostLayoutUpdate; // true when it's OK to trust layout information
(e.g. layer sizes and positions) |
| 330 bool m_needsUpdateCompositingRequirementsState; | 323 bool m_needsUpdateCompositingRequirementsState; |
| 331 | 324 |
| 332 bool m_isTrackingRepaints; // Used for testing. | 325 bool m_isTrackingRepaints; // Used for testing. |
| 333 | 326 |
| 334 RootLayerAttachment m_rootLayerAttachment; | 327 RootLayerAttachment m_rootLayerAttachment; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 361 int m_secondaryCompositedLayerCount; // count of layers that have to be comp
osited because of stacking or overlap. | 354 int m_secondaryCompositedLayerCount; // count of layers that have to be comp
osited because of stacking or overlap. |
| 362 double m_obligatoryBackingStoreBytes; | 355 double m_obligatoryBackingStoreBytes; |
| 363 double m_secondaryBackingStoreBytes; | 356 double m_secondaryBackingStoreBytes; |
| 364 #endif | 357 #endif |
| 365 }; | 358 }; |
| 366 | 359 |
| 367 | 360 |
| 368 } // namespace WebCore | 361 } // namespace WebCore |
| 369 | 362 |
| 370 #endif // RenderLayerCompositor_h | 363 #endif // RenderLayerCompositor_h |
| OLD | NEW |