Title: [215750] trunk/Source/WebCore
Revision
215750
Author
an...@apple.com
Date
2017-04-25 12:20:17 -0700 (Tue, 25 Apr 2017)

Log Message

REGRESSION (r215469): [ios-simulator-wk2] LayoutTest compositing/animation/animation-backing.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=171060
<rdar://problem/31771174>

Reviewed by Simon Fraser.

Accelerated transform animations move underlying layers without invalidating GraphicsLayers.
To update tile coverage we need to commit such subtrees even if there are not other changes.

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::GraphicsLayerCA):
(WebCore::GraphicsLayerCA::needsCommit):

    Commit subtrees with accelerated transform animations.
    Factor into a function.

(WebCore::GraphicsLayerCA::recursiveCommitChanges):

    Track if descendants had any accelerated transform animations after commit.

* platform/graphics/ca/GraphicsLayerCA.h:
(WebCore::GraphicsLayerCA::hasDescendantsWithRunningTransformAnimations):
(WebCore::GraphicsLayerCA::setHasDescendantsWithRunningTransformAnimations):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (215749 => 215750)


--- trunk/Source/WebCore/ChangeLog	2017-04-25 19:15:00 UTC (rev 215749)
+++ trunk/Source/WebCore/ChangeLog	2017-04-25 19:20:17 UTC (rev 215750)
@@ -1,3 +1,29 @@
+2017-04-25  Antti Koivisto  <an...@apple.com>
+
+        REGRESSION (r215469): [ios-simulator-wk2] LayoutTest compositing/animation/animation-backing.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=171060
+        <rdar://problem/31771174>
+
+        Reviewed by Simon Fraser.
+
+        Accelerated transform animations move underlying layers without invalidating GraphicsLayers.
+        To update tile coverage we need to commit such subtrees even if there are not other changes.
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::GraphicsLayerCA):
+        (WebCore::GraphicsLayerCA::needsCommit):
+
+            Commit subtrees with accelerated transform animations.
+            Factor into a function.
+
+        (WebCore::GraphicsLayerCA::recursiveCommitChanges):
+
+            Track if descendants had any accelerated transform animations after commit.
+
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        (WebCore::GraphicsLayerCA::hasDescendantsWithRunningTransformAnimations):
+        (WebCore::GraphicsLayerCA::setHasDescendantsWithRunningTransformAnimations):
+
 2017-04-25  Eric Carlson  <eric.carl...@apple.com>
 
         [MediaStream macOS] Unable to apply frameRate constraint

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (215749 => 215750)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2017-04-25 19:15:00 UTC (rev 215749)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2017-04-25 19:20:17 UTC (rev 215750)
@@ -390,11 +390,6 @@
 
 GraphicsLayerCA::GraphicsLayerCA(Type layerType, GraphicsLayerClient& client)
     : GraphicsLayer(layerType, client)
-    , m_needsFullRepaint(false)
-    , m_usingBackdropLayerType(false)
-    , m_isViewportConstrained(false)
-    , m_intersectsCoverageRect(false)
-    , m_hasEverPainted(false)
 {
 }
 
@@ -1410,11 +1405,28 @@
     }
 }
 
+bool GraphicsLayerCA::needsCommit(const CommitState& commitState)
+{
+    if (commitState.ancestorHadChanges)
+        return true;
+    if (m_uncommittedChanges)
+        return true;
+    if (hasDescendantsWithUncommittedChanges())
+        return true;
+    // Accelerated transforms move the underlying layers without GraphicsLayers getting invalidated.
+    if (isRunningTransformAnimation())
+        return true;
+    if (hasDescendantsWithRunningTransformAnimations())
+        return true;
+
+    return false;
+}
+
 // rootRelativeTransformForScaling is a transform from the root, but for layers with transform animations, it cherry-picked the state of the
 // animation that contributes maximally to the scale (on every layer with animations down the hierarchy).
 void GraphicsLayerCA::recursiveCommitChanges(const CommitState& commitState, const TransformState& state, float pageScaleFactor, const FloatPoint& positionRelativeToBase, bool affectedByPageScale)
 {
-    if (!commitState.ancestorHadChanges && !m_uncommittedChanges && !hasDescendantsWithUncommittedChanges())
+    if (!needsCommit(commitState))
         return;
 
     TransformState localState = state;
@@ -1487,10 +1499,15 @@
 
     const Vector<GraphicsLayer*>& childLayers = children();
     size_t numChildren = childLayers.size();
+
+    bool hasDescendantsWithRunningTransformAnimations = false;
     
     for (size_t i = 0; i < numChildren; ++i) {
         GraphicsLayerCA& currentChild = downcast<GraphicsLayerCA>(*childLayers[i]);
         currentChild.recursiveCommitChanges(childCommitState, localState, pageScaleFactor, baseRelativePosition, affectedByPageScale);
+
+        if (currentChild.isRunningTransformAnimation() || currentChild.hasDescendantsWithRunningTransformAnimations())
+            hasDescendantsWithRunningTransformAnimations = true;
     }
 
     if (GraphicsLayerCA* replicaLayer = downcast<GraphicsLayerCA>(m_replicaLayer))
@@ -1500,6 +1517,7 @@
         maskLayer->commitLayerChangesAfterSublayers(childCommitState);
 
     setHasDescendantsWithUncommittedChanges(false);
+    setHasDescendantsWithRunningTransformAnimations(hasDescendantsWithRunningTransformAnimations);
 
     bool hadDirtyRects = m_uncommittedChanges & DirtyRectsChanged;
     commitLayerChangesAfterSublayers(childCommitState);

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (215749 => 215750)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2017-04-25 19:15:00 UTC (rev 215749)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2017-04-25 19:20:17 UTC (rev 215750)
@@ -159,6 +159,7 @@
         bool ancestorHasTransformAnimation { false };
         bool ancestorIsViewportConstrained { false };
     };
+    bool needsCommit(const CommitState&);
     void recursiveCommitChanges(const CommitState&, const TransformState&, float pageScaleFactor = 1, const FloatPoint& positionRelativeToBase = FloatPoint(), bool affectedByPageScale = false);
 
     WEBCORE_EXPORT void flushCompositingState(const FloatRect&) override;
@@ -509,6 +510,9 @@
     void noteSublayersChanged(ScheduleFlushOrNot = ScheduleFlush);
     void noteChangesForScaleSensitiveProperties();
 
+    bool hasDescendantsWithRunningTransformAnimations() const { return m_hasDescendantsWithRunningTransformAnimations; }
+    void setHasDescendantsWithRunningTransformAnimations(bool b) { m_hasDescendantsWithRunningTransformAnimations = b; }
+
     void propagateLayerChangeToReplicas(ScheduleFlushOrNot = ScheduleFlush);
 
     void repaintLayerDirtyRects();
@@ -541,11 +545,12 @@
     FloatRect m_coverageRect; // Area for which we should maintain backing store, in the coordinate space of this layer.
     
     ContentsLayerPurpose m_contentsLayerPurpose { NoContentsLayer };
-    bool m_needsFullRepaint : 1;
-    bool m_usingBackdropLayerType : 1;
-    bool m_isViewportConstrained : 1;
-    bool m_intersectsCoverageRect : 1;
-    bool m_hasEverPainted : 1;
+    bool m_needsFullRepaint { false };
+    bool m_usingBackdropLayerType { false };
+    bool m_isViewportConstrained { false };
+    bool m_intersectsCoverageRect { false };
+    bool m_hasEverPainted { false };
+    bool m_hasDescendantsWithRunningTransformAnimations { false };
 
     Color m_contentsSolidColor;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to