Title: [181218] trunk/Source/WebCore
Revision
181218
Author
simon.fra...@apple.com
Date
2015-03-07 18:49:21 -0800 (Sat, 07 Mar 2015)

Log Message

Tidy up RenderLayerCompositor's CompositingState
https://bugs.webkit.org/show_bug.cgi?id=142445

Reviewed by Dan Bernstein.

Make CompositingState a private struct in RenderLayerCompositor.
Since it's a struct, remove the m_ prefix from its data members.

No behavior change.

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::CompositingState::CompositingState):
(WebCore::RenderLayerCompositor::computeCompositingRequirements):
(WebCore::CompositingState::CompositingState): Deleted.
* rendering/RenderLayerCompositor.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (181217 => 181218)


--- trunk/Source/WebCore/ChangeLog	2015-03-08 02:14:22 UTC (rev 181217)
+++ trunk/Source/WebCore/ChangeLog	2015-03-08 02:49:21 UTC (rev 181218)
@@ -1,3 +1,21 @@
+2015-03-07  Simon Fraser  <simon.fra...@apple.com>
+
+        Tidy up RenderLayerCompositor's CompositingState
+        https://bugs.webkit.org/show_bug.cgi?id=142445
+
+        Reviewed by Dan Bernstein.
+        
+        Make CompositingState a private struct in RenderLayerCompositor.
+        Since it's a struct, remove the m_ prefix from its data members.
+
+        No behavior change.
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::CompositingState::CompositingState):
+        (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+        (WebCore::CompositingState::CompositingState): Deleted.
+        * rendering/RenderLayerCompositor.h:
+
 2015-03-07  Darin Adler  <da...@apple.com>
 
         Unindent EventTarget, EventListener, JSEventLister.h files

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (181217 => 181218)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2015-03-08 02:14:22 UTC (rev 181217)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2015-03-08 02:49:21 UTC (rev 181218)
@@ -217,45 +217,44 @@
     RenderGeometryMap m_geometryMap;
 };
 
-struct CompositingState {
+struct RenderLayerCompositor::CompositingState {
     CompositingState(RenderLayer* compAncestor, bool testOverlap = true)
-        : m_compositingAncestor(compAncestor)
-        , m_subtreeIsCompositing(false)
-        , m_testingOverlap(testOverlap)
+        : compositingAncestor(compAncestor)
+        , subtreeIsCompositing(false)
+        , testingOverlap(testOverlap)
 #if ENABLE(CSS_COMPOSITING)
-        , m_hasNotIsolatedCompositedBlendingDescendants(false)
+        , hasNotIsolatedCompositedBlendingDescendants(false)
 #endif
 #if ENABLE(TREE_DEBUGGING)
-        , m_depth(0)
+        , depth(0)
 #endif
     {
     }
     
     CompositingState(const CompositingState& other)
-        : m_compositingAncestor(other.m_compositingAncestor)
-        , m_subtreeIsCompositing(other.m_subtreeIsCompositing)
-        , m_testingOverlap(other.m_testingOverlap)
+        : compositingAncestor(other.compositingAncestor)
+        , subtreeIsCompositing(other.subtreeIsCompositing)
+        , testingOverlap(other.testingOverlap)
 #if ENABLE(CSS_COMPOSITING)
-        , m_hasNotIsolatedCompositedBlendingDescendants(other.m_hasNotIsolatedCompositedBlendingDescendants)
+        , hasNotIsolatedCompositedBlendingDescendants(other.hasNotIsolatedCompositedBlendingDescendants)
 #endif
 #if ENABLE(TREE_DEBUGGING)
-        , m_depth(other.m_depth + 1)
+        , depth(other.depth + 1)
 #endif
     {
     }
     
-    RenderLayer* m_compositingAncestor;
-    bool m_subtreeIsCompositing;
-    bool m_testingOverlap;
+    RenderLayer* compositingAncestor;
+    bool subtreeIsCompositing;
+    bool testingOverlap;
 #if ENABLE(CSS_COMPOSITING)
-    bool m_hasNotIsolatedCompositedBlendingDescendants;
+    bool hasNotIsolatedCompositedBlendingDescendants;
 #endif
 #if ENABLE(TREE_DEBUGGING)
-    int m_depth;
+    int depth;
 #endif
 };
 
-
 #if !LOG_DISABLED
 static inline bool compositingLogEnabled()
 {
@@ -1238,12 +1237,12 @@
     // is already going to be composited for other reasons.
     bool willBeComposited = needsToBeComposited(layer);
 
-    RenderLayer::IndirectCompositingReason compositingReason = compositingState.m_subtreeIsCompositing ? RenderLayer::IndirectCompositingReason::Stacking : RenderLayer::IndirectCompositingReason::None;
+    RenderLayer::IndirectCompositingReason compositingReason = compositingState.subtreeIsCompositing ? RenderLayer::IndirectCompositingReason::Stacking : RenderLayer::IndirectCompositingReason::None;
     bool haveComputedBounds = false;
     LayoutRect absBounds;
 
     // If we know for sure the layer is going to be composited, don't bother looking it up in the overlap map
-    if (!willBeComposited && !overlapMap.isEmpty() && compositingState.m_testingOverlap) {
+    if (!willBeComposited && !overlapMap.isEmpty() && compositingState.testingOverlap) {
         // If we're testing for overlap, we only need to composite if we overlap something that is already composited.
         absBounds = enclosingLayoutRect(overlapMap.geometryMap().absoluteRect(layer.overlapBounds()));
 
@@ -1259,7 +1258,7 @@
     // RenderLayer children and whose children can't use its backing to render
     // into. These children (the controls) always need to be promoted into their
     // own layers to draw on top of the accelerated video.
-    if (compositingState.m_compositingAncestor && compositingState.m_compositingAncestor->renderer().isVideo())
+    if (compositingState.compositingAncestor && compositingState.compositingAncestor->renderer().isVideo())
         compositingReason = RenderLayer::IndirectCompositingReason::Overlap;
 #endif
 
@@ -1272,23 +1271,23 @@
 
     // The children of this layer don't need to composite, unless there is
     // a compositing layer among them, so start by inheriting the compositing
-    // ancestor with m_subtreeIsCompositing set to false.
+    // ancestor with subtreeIsCompositing set to false.
     CompositingState childState(compositingState);
-    childState.m_subtreeIsCompositing = false;
+    childState.subtreeIsCompositing = false;
 #if ENABLE(CSS_COMPOSITING)
-    childState.m_hasNotIsolatedCompositedBlendingDescendants = false;
+    childState.hasNotIsolatedCompositedBlendingDescendants = false;
 #endif
 
     if (willBeComposited) {
         // Tell the parent it has compositing descendants.
-        compositingState.m_subtreeIsCompositing = true;
+        compositingState.subtreeIsCompositing = true;
         // This layer now acts as the ancestor for kids.
-        childState.m_compositingAncestor = &layer;
+        childState.compositingAncestor = &layer;
 
         overlapMap.pushCompositingContainer();
         // This layer is going to be composited, so children can safely ignore the fact that there's an 
         // animation running behind this layer, meaning they can rely on the overlap map testing again.
-        childState.m_testingOverlap = true;
+        childState.testingOverlap = true;
     }
 
 #if !ASSERT_DISABLED
@@ -1304,14 +1303,14 @@
 
                 // If we have to make a layer for this child, make one now so we can have a contents layer
                 // (since we need to ensure that the -ve z-order child renders underneath our contents).
-                if (!willBeComposited && childState.m_subtreeIsCompositing) {
+                if (!willBeComposited && childState.subtreeIsCompositing) {
                     // make layer compositing
                     layer.setIndirectCompositingReason(RenderLayer::IndirectCompositingReason::BackgroundLayer);
-                    childState.m_compositingAncestor = &layer;
+                    childState.compositingAncestor = &layer;
                     overlapMap.pushCompositingContainer();
                     // This layer is going to be composited, so children can safely ignore the fact that there's an 
                     // animation running behind this layer, meaning they can rely on the overlap map testing again
-                    childState.m_testingOverlap = true;
+                    childState.testingOverlap = true;
                     willBeComposited = true;
                 }
             }
@@ -1353,19 +1352,19 @@
     // All layers (even ones that aren't being composited) need to get added to
     // the overlap map. Layers that do not composite will draw into their
     // compositing ancestor's backing, and so are still considered for overlap.
-    if (childState.m_compositingAncestor && !childState.m_compositingAncestor->isRootLayer())
+    if (childState.compositingAncestor && !childState.compositingAncestor->isRootLayer())
         addToOverlapMap(overlapMap, layer, absBounds, haveComputedBounds);
 
 #if ENABLE(CSS_COMPOSITING)
-    layer.setHasNotIsolatedCompositedBlendingDescendants(childState.m_hasNotIsolatedCompositedBlendingDescendants);
+    layer.setHasNotIsolatedCompositedBlendingDescendants(childState.hasNotIsolatedCompositedBlendingDescendants);
     ASSERT(!layer.hasNotIsolatedCompositedBlendingDescendants() || layer.hasNotIsolatedBlendingDescendants());
 #endif
     // Now check for reasons to become composited that depend on the state of descendant layers.
     RenderLayer::IndirectCompositingReason indirectCompositingReason;
     if (!willBeComposited && canBeComposited(layer)
-        && requiresCompositingForIndirectReason(layer.renderer(), childState.m_subtreeIsCompositing, anyDescendantHas3DTransform, indirectCompositingReason)) {
+        && requiresCompositingForIndirectReason(layer.renderer(), childState.subtreeIsCompositing, anyDescendantHas3DTransform, indirectCompositingReason)) {
         layer.setIndirectCompositingReason(indirectCompositingReason);
-        childState.m_compositingAncestor = &layer;
+        childState.compositingAncestor = &layer;
         overlapMap.pushCompositingContainer();
         addToOverlapMapRecursive(overlapMap, layer);
         willBeComposited = true;
@@ -1378,11 +1377,11 @@
     }
 
     // Subsequent layers in the parent stacking context also need to composite.
-    if (childState.m_subtreeIsCompositing)
-        compositingState.m_subtreeIsCompositing = true;
+    if (childState.subtreeIsCompositing)
+        compositingState.subtreeIsCompositing = true;
 
     // Set the flag to say that this SC has compositing children.
-    layer.setHasCompositingDescendant(childState.m_subtreeIsCompositing);
+    layer.setHasCompositingDescendant(childState.subtreeIsCompositing);
 
     // setHasCompositingDescendant() may have changed the answer to needsToBeComposited() when clipping,
     // so test that again.
@@ -1391,12 +1390,12 @@
     // Turn overlap testing off for later layers if it's already off, or if we have an animating transform.
     // Note that if the layer clips its descendants, there's no reason to propagate the child animation to the parent layers. That's because
     // we know for sure the animation is contained inside the clipping rectangle, which is already added to the overlap map.
-    if ((!childState.m_testingOverlap && !isCompositedClippingLayer) || isRunningAcceleratedTransformAnimation(layer.renderer()))
-        compositingState.m_testingOverlap = false;
+    if ((!childState.testingOverlap && !isCompositedClippingLayer) || isRunningAcceleratedTransformAnimation(layer.renderer()))
+        compositingState.testingOverlap = false;
     
     if (isCompositedClippingLayer) {
         if (!willBeComposited) {
-            childState.m_compositingAncestor = &layer;
+            childState.compositingAncestor = &layer;
             overlapMap.pushCompositingContainer();
             addToOverlapMapRecursive(overlapMap, layer);
             willBeComposited = true;
@@ -1406,16 +1405,16 @@
 #if ENABLE(CSS_COMPOSITING)
     if ((willBeComposited && layer.hasBlendMode())
         || (layer.hasNotIsolatedCompositedBlendingDescendants() && !layer.isolatesCompositedBlending()))
-        compositingState.m_hasNotIsolatedCompositedBlendingDescendants = true;
+        compositingState.hasNotIsolatedCompositedBlendingDescendants = true;
 #endif
 
-    if (childState.m_compositingAncestor == &layer && !layer.isRootLayer())
+    if (childState.compositingAncestor == &layer && !layer.isRootLayer())
         overlapMap.popCompositingContainer();
 
     // If we're back at the root, and no other layers need to be composited, and the root layer itself doesn't need
     // to be composited, then we can drop out of compositing mode altogether. However, don't drop out of compositing mode
     // if there are composited layers that we didn't hit in our traversal (e.g. because of visibility:hidden).
-    if (layer.isRootLayer() && !childState.m_subtreeIsCompositing && !requiresCompositingLayer(layer) && !m_forceCompositingMode && !hasAnyAdditionalCompositedLayers(layer)) {
+    if (layer.isRootLayer() && !childState.subtreeIsCompositing && !requiresCompositingLayer(layer) && !m_forceCompositingMode && !hasAnyAdditionalCompositedLayers(layer)) {
         // Don't drop out of compositing on iOS, because we may flash. See <rdar://problem/8348337>.
 #if !PLATFORM(IOS)
         enableCompositingMode(false);

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (181217 => 181218)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2015-03-08 02:14:22 UTC (rev 181217)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2015-03-08 02:49:21 UTC (rev 181218)
@@ -309,6 +309,7 @@
 
 private:
     class OverlapMap;
+    struct CompositingState;
 
     // GraphicsLayerClient implementation
     virtual void notifyFlushRequired(const GraphicsLayer*) override;
@@ -341,7 +342,7 @@
     void updateCompositingLayersTimerFired();
 
     // Returns true if any layer's compositing changed
-    void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer&, OverlapMap&, struct CompositingState&, bool& layersChanged, bool& descendantHas3DTransform);
+    void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer&, OverlapMap&, CompositingState&, bool& layersChanged, bool& descendantHas3DTransform);
 
     void computeRegionCompositingRequirements(RenderNamedFlowFragment*, OverlapMap&, CompositingState&, bool& layersChanged, bool& anyDescendantHas3DTransform);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to