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