Title: [242274] branches/safari-607.1.40.0-branch
Revision
242274
Author
bshaf...@apple.com
Date
2019-03-01 11:21:39 -0800 (Fri, 01 Mar 2019)

Log Message

Cherry-pick r242248. rdar://problem/48503712

    [iOS] Dark flash when opening Google AMP pages
    https://bugs.webkit.org/show_bug.cgi?id=195193
    rdar://problem/48326442

    Reviewed by Zalan Bujtas.

    Source/WebCore:

    After the incremental compositing updates changes, it was possible for a change in the size
    of an overflow:hidden element to fail to update the "ancestor clipping layer" geometry on
    a composited descendant that is not a descendant in z-order. When Google search results
    create the <iframe> that contain AMP contents, we'd fail to update a zero-sized clipping layer,
    leaving the #222 background of an intermediate element visible.

    Fix by setting a flag in RenderLayer::updateLayerPosition() (which is called in containing block order)
    that sets the "needs geometry update" dirty bit on containing-block-descendant layers. Currently
    this flag affects all descendants; in future, we might be able to clear it for grand-children.

    Tests: compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html
           compositing/geometry/ancestor-clip-change.html

    * rendering/RenderLayer.cpp:
    (WebCore::RenderLayer::updateLayerPositions):
    (WebCore::RenderLayer::updateLayerPosition):
    * rendering/RenderLayer.h:
    * rendering/RenderLayerBacking.cpp:
    (WebCore::RenderLayerBacking::updateAfterLayout):
    * rendering/RenderLayerBacking.h:

    LayoutTests:

    Tests that change the size of a clipping layer with non-z-order composited descendant, with
    a couple of layer tree configurations.

    * compositing/geometry/ancestor-clip-change-expected.html: Added.
    * compositing/geometry/ancestor-clip-change-interleaved-stacking-context-expected.html: Added.
    * compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html: Added.
    * compositing/geometry/ancestor-clip-change.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242248 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-607.1.40.0-branch/LayoutTests/ChangeLog (242273 => 242274)


--- branches/safari-607.1.40.0-branch/LayoutTests/ChangeLog	2019-03-01 19:21:15 UTC (rev 242273)
+++ branches/safari-607.1.40.0-branch/LayoutTests/ChangeLog	2019-03-01 19:21:39 UTC (rev 242274)
@@ -1,3 +1,64 @@
+2019-03-01  Babak Shafiei  <bshaf...@apple.com>
+
+        Cherry-pick r242248. rdar://problem/48503712
+
+    [iOS] Dark flash when opening Google AMP pages
+    https://bugs.webkit.org/show_bug.cgi?id=195193
+    rdar://problem/48326442
+    
+    Reviewed by Zalan Bujtas.
+    
+    Source/WebCore:
+    
+    After the incremental compositing updates changes, it was possible for a change in the size
+    of an overflow:hidden element to fail to update the "ancestor clipping layer" geometry on
+    a composited descendant that is not a descendant in z-order. When Google search results
+    create the <iframe> that contain AMP contents, we'd fail to update a zero-sized clipping layer,
+    leaving the #222 background of an intermediate element visible.
+    
+    Fix by setting a flag in RenderLayer::updateLayerPosition() (which is called in containing block order)
+    that sets the "needs geometry update" dirty bit on containing-block-descendant layers. Currently
+    this flag affects all descendants; in future, we might be able to clear it for grand-children.
+    
+    Tests: compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html
+           compositing/geometry/ancestor-clip-change.html
+    
+    * rendering/RenderLayer.cpp:
+    (WebCore::RenderLayer::updateLayerPositions):
+    (WebCore::RenderLayer::updateLayerPosition):
+    * rendering/RenderLayer.h:
+    * rendering/RenderLayerBacking.cpp:
+    (WebCore::RenderLayerBacking::updateAfterLayout):
+    * rendering/RenderLayerBacking.h:
+    
+    LayoutTests:
+    
+    Tests that change the size of a clipping layer with non-z-order composited descendant, with
+    a couple of layer tree configurations.
+    
+    * compositing/geometry/ancestor-clip-change-expected.html: Added.
+    * compositing/geometry/ancestor-clip-change-interleaved-stacking-context-expected.html: Added.
+    * compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html: Added.
+    * compositing/geometry/ancestor-clip-change.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-02-28  Simon Fraser  <simon.fra...@apple.com>
+
+            [iOS] Dark flash when opening Google AMP pages
+            https://bugs.webkit.org/show_bug.cgi?id=195193
+            rdar://problem/48326442
+
+            Reviewed by Zalan Bujtas.
+
+            Tests that change the size of a clipping layer with non-z-order composited descendant, with
+            a couple of layer tree configurations.
+
+            * compositing/geometry/ancestor-clip-change-expected.html: Added.
+            * compositing/geometry/ancestor-clip-change-interleaved-stacking-context-expected.html: Added.
+            * compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html: Added.
+            * compositing/geometry/ancestor-clip-change.html: Added.
+
 2019-02-24  Babak Shafiei  <bshaf...@apple.com>
 
         Cherry-pick r241915. rdar://problem/48298733

Added: branches/safari-607.1.40.0-branch/LayoutTests/compositing/geometry/ancestor-clip-change-expected.html (0 => 242274)


--- branches/safari-607.1.40.0-branch/LayoutTests/compositing/geometry/ancestor-clip-change-expected.html	                        (rev 0)
+++ branches/safari-607.1.40.0-branch/LayoutTests/compositing/geometry/ancestor-clip-change-expected.html	2019-03-01 19:21:39 UTC (rev 242274)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        body {
+            height: 1000px;
+        }
+        .clipper {
+            margin: 20px;
+            padding: 10px;
+            width: 300px;
+            height: 300px;
+            overflow: hidden;
+            background-color: gray;
+        }
+        .content {
+            transform: translateZ(0);
+            background-color: green;
+            height: 300px;
+        }
+    </style>
+</head>
+<body>
+    <div class="clipper">
+        <div class="content">
+            &nbsp;
+        </div>
+    </div>
+</body>
+</html>

Added: branches/safari-607.1.40.0-branch/LayoutTests/compositing/geometry/ancestor-clip-change-interleaved-stacking-context-expected.html (0 => 242274)


--- branches/safari-607.1.40.0-branch/LayoutTests/compositing/geometry/ancestor-clip-change-interleaved-stacking-context-expected.html	                        (rev 0)
+++ branches/safari-607.1.40.0-branch/LayoutTests/compositing/geometry/ancestor-clip-change-interleaved-stacking-context-expected.html	2019-03-01 19:21:39 UTC (rev 242274)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        body {
+            height: 1000px;
+        }
+        .outer-clipper {
+            position: relative;
+            width: 360px;
+            height: 360px;
+            border: 2px solid orange;
+        }
+        .clipper {
+            margin: 20px;
+            padding: 10px;
+            width: 300px;
+            height: 300px;
+            overflow: hidden;
+            background-color: gray;
+        }
+        .content {
+            transform: translateZ(0);
+            background-color: green;
+            height: 300px;
+        }
+    </style>
+</head>
+<body>
+        <div class="outer-clipper">
+            <div class="clipper">
+                <div class="content">
+                    &nbsp;
+                </div>
+            </div>
+        </div>
+</body>
+</html>

Added: branches/safari-607.1.40.0-branch/LayoutTests/compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html (0 => 242274)


--- branches/safari-607.1.40.0-branch/LayoutTests/compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html	                        (rev 0)
+++ branches/safari-607.1.40.0-branch/LayoutTests/compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html	2019-03-01 19:21:39 UTC (rev 242274)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        body {
+            height: 1000px;
+        }
+        .outer-clipper {
+            position: relative;
+            width: 360px;
+            height: 360px;
+            border: 2px solid orange;
+        }
+        .clipper {
+            margin: 20px;
+            padding: 10px;
+            width: 300px;
+            height: 100px;
+            overflow: hidden;
+            background-color: gray;
+        }
+        .changed .clipper {
+            height: 300px;
+        }
+        .content {
+            transform: translateZ(0);
+            background-color: green;
+            height: 300px;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        window.addEventListener('load', () => {
+            requestAnimationFrame(() => {
+                document.body.classList.add('changed');
+
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            });
+        }, false);
+    </script>
+</head>
+<body>
+        <div class="outer-clipper">
+            <div class="clipper">
+                <div class="content">
+                    &nbsp;
+                </div>
+            </div>
+        </div>
+</body>
+</html>

Added: branches/safari-607.1.40.0-branch/LayoutTests/compositing/geometry/ancestor-clip-change.html (0 => 242274)


--- branches/safari-607.1.40.0-branch/LayoutTests/compositing/geometry/ancestor-clip-change.html	                        (rev 0)
+++ branches/safari-607.1.40.0-branch/LayoutTests/compositing/geometry/ancestor-clip-change.html	2019-03-01 19:21:39 UTC (rev 242274)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        body {
+            height: 1000px;
+        }
+        .clipper {
+            margin: 20px;
+            padding: 10px;
+            width: 300px;
+            height: 100px;
+            overflow: hidden;
+            background-color: gray;
+        }
+        .changed .clipper {
+            height: 300px;
+        }
+        .content {
+            transform: translateZ(0);
+            background-color: green;
+            height: 300px;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        window.addEventListener('load', () => {
+            requestAnimationFrame(() => {
+                document.body.classList.add('changed');
+
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            });
+        }, false);
+    </script>
+</head>
+<body>
+    <div class="clipper">
+        <div class="content">
+            &nbsp;
+        </div>
+    </div>
+</body>
+</html>

Modified: branches/safari-607.1.40.0-branch/Source/WebCore/ChangeLog (242273 => 242274)


--- branches/safari-607.1.40.0-branch/Source/WebCore/ChangeLog	2019-03-01 19:21:15 UTC (rev 242273)
+++ branches/safari-607.1.40.0-branch/Source/WebCore/ChangeLog	2019-03-01 19:21:39 UTC (rev 242274)
@@ -1,3 +1,77 @@
+2019-03-01  Babak Shafiei  <bshaf...@apple.com>
+
+        Cherry-pick r242248. rdar://problem/48503712
+
+    [iOS] Dark flash when opening Google AMP pages
+    https://bugs.webkit.org/show_bug.cgi?id=195193
+    rdar://problem/48326442
+    
+    Reviewed by Zalan Bujtas.
+    
+    Source/WebCore:
+    
+    After the incremental compositing updates changes, it was possible for a change in the size
+    of an overflow:hidden element to fail to update the "ancestor clipping layer" geometry on
+    a composited descendant that is not a descendant in z-order. When Google search results
+    create the <iframe> that contain AMP contents, we'd fail to update a zero-sized clipping layer,
+    leaving the #222 background of an intermediate element visible.
+    
+    Fix by setting a flag in RenderLayer::updateLayerPosition() (which is called in containing block order)
+    that sets the "needs geometry update" dirty bit on containing-block-descendant layers. Currently
+    this flag affects all descendants; in future, we might be able to clear it for grand-children.
+    
+    Tests: compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html
+           compositing/geometry/ancestor-clip-change.html
+    
+    * rendering/RenderLayer.cpp:
+    (WebCore::RenderLayer::updateLayerPositions):
+    (WebCore::RenderLayer::updateLayerPosition):
+    * rendering/RenderLayer.h:
+    * rendering/RenderLayerBacking.cpp:
+    (WebCore::RenderLayerBacking::updateAfterLayout):
+    * rendering/RenderLayerBacking.h:
+    
+    LayoutTests:
+    
+    Tests that change the size of a clipping layer with non-z-order composited descendant, with
+    a couple of layer tree configurations.
+    
+    * compositing/geometry/ancestor-clip-change-expected.html: Added.
+    * compositing/geometry/ancestor-clip-change-interleaved-stacking-context-expected.html: Added.
+    * compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html: Added.
+    * compositing/geometry/ancestor-clip-change.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-02-28  Simon Fraser  <simon.fra...@apple.com>
+
+            [iOS] Dark flash when opening Google AMP pages
+            https://bugs.webkit.org/show_bug.cgi?id=195193
+            rdar://problem/48326442
+
+            Reviewed by Zalan Bujtas.
+
+            After the incremental compositing updates changes, it was possible for a change in the size
+            of an overflow:hidden element to fail to update the "ancestor clipping layer" geometry on
+            a composited descendant that is not a descendant in z-order. When Google search results
+            create the <iframe> that contain AMP contents, we'd fail to update a zero-sized clipping layer,
+            leaving the #222 background of an intermediate element visible.
+
+            Fix by setting a flag in RenderLayer::updateLayerPosition() (which is called in containing block order)
+            that sets the "needs geometry update" dirty bit on containing-block-descendant layers. Currently
+            this flag affects all descendants; in future, we might be able to clear it for grand-children.
+
+            Tests: compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html
+                   compositing/geometry/ancestor-clip-change.html
+
+            * rendering/RenderLayer.cpp:
+            (WebCore::RenderLayer::updateLayerPositions):
+            (WebCore::RenderLayer::updateLayerPosition):
+            * rendering/RenderLayer.h:
+            * rendering/RenderLayerBacking.cpp:
+            (WebCore::RenderLayerBacking::updateAfterLayout):
+            * rendering/RenderLayerBacking.h:
+
 2019-02-28  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r242204. rdar://problem/48483749

Modified: branches/safari-607.1.40.0-branch/Source/WebCore/rendering/RenderLayer.cpp (242273 => 242274)


--- branches/safari-607.1.40.0-branch/Source/WebCore/rendering/RenderLayer.cpp	2019-03-01 19:21:15 UTC (rev 242273)
+++ branches/safari-607.1.40.0-branch/Source/WebCore/rendering/RenderLayer.cpp	2019-03-01 19:21:39 UTC (rev 242274)
@@ -850,10 +850,7 @@
 
 void RenderLayer::updateLayerPositions(RenderGeometryMap* geometryMap, OptionSet<UpdateLayerPositionsFlag> flags)
 {
-    updateLayerPosition(); // For relpositioned layers or non-positioned layers,
-                           // we need to keep in sync, since we may have shifted relative
-                           // to our parent layer.
-
+    updateLayerPosition(&flags);
     applyPostLayoutScrollPositionIfNeeded();
 
     if (geometryMap)
@@ -954,7 +951,7 @@
     }
 
     if (isComposited())
-        backing()->updateAfterLayout(flags.contains(NeedsFullRepaintInBacking));
+        backing()->updateAfterLayout(flags.contains(ContainingClippingLayerChangedSize), flags.contains(NeedsFullRepaintInBacking));
 
     if (geometryMap)
         geometryMap->popMappingsToAncestor(parent());
@@ -1500,7 +1497,7 @@
     return has3DTransform();
 }
 
-bool RenderLayer::updateLayerPosition()
+bool RenderLayer::updateLayerPosition(OptionSet<UpdateLayerPositionsFlag>* flags)
 {
     LayoutPoint localPoint;
     LayoutSize inlineBoundingBoxOffset; // We don't put this into the RenderLayer x/y for inlines, so we need to subtract it out when done.
@@ -1518,6 +1515,10 @@
                 // Trigger RenderLayerCompositor::requiresCompositingForFrame() which depends on the contentBoxRect size.
                 setNeedsPostLayoutCompositingUpdate();
             }
+
+            if (flags && renderer().hasOverflowClip())
+                flags->add(ContainingClippingLayerChangedSize);
+
             setSize(newSize);
         }
         

Modified: branches/safari-607.1.40.0-branch/Source/WebCore/rendering/RenderLayer.h (242273 => 242274)


--- branches/safari-607.1.40.0-branch/Source/WebCore/rendering/RenderLayer.h	2019-03-01 19:21:15 UTC (rev 242273)
+++ branches/safari-607.1.40.0-branch/Source/WebCore/rendering/RenderLayer.h	2019-03-01 19:21:39 UTC (rev 242274)
@@ -498,11 +498,12 @@
     bool canRender3DTransforms() const;
 
     enum UpdateLayerPositionsFlag {
-        CheckForRepaint                 = 1 << 0,
-        NeedsFullRepaintInBacking       = 1 << 1,
-        UpdatePagination                = 1 << 2,
-        SeenTransformedLayer            = 1 << 3,
-        Seen3DTransformedLayer          = 1 << 4,
+        CheckForRepaint                     = 1 << 0,
+        NeedsFullRepaintInBacking           = 1 << 1,
+        ContainingClippingLayerChangedSize  = 1 << 2,
+        UpdatePagination                    = 1 << 3,
+        SeenTransformedLayer                = 1 << 4,
+        Seen3DTransformedLayer              = 1 << 5,
     };
     static constexpr OptionSet<UpdateLayerPositionsFlag> updateLayerPositionsDefaultFlags() { return { CheckForRepaint }; }
 
@@ -925,7 +926,7 @@
     void updateScrollbarsAfterLayout();
 
     // Returns true if the position changed.
-    bool updateLayerPosition();
+    bool updateLayerPosition(OptionSet<UpdateLayerPositionsFlag>* = nullptr);
 
     void updateLayerPositions(RenderGeometryMap* = nullptr, OptionSet<UpdateLayerPositionsFlag> = updateLayerPositionsDefaultFlags());
 

Modified: branches/safari-607.1.40.0-branch/Source/WebCore/rendering/RenderLayerBacking.cpp (242273 => 242274)


--- branches/safari-607.1.40.0-branch/Source/WebCore/rendering/RenderLayerBacking.cpp	2019-03-01 19:21:15 UTC (rev 242273)
+++ branches/safari-607.1.40.0-branch/Source/WebCore/rendering/RenderLayerBacking.cpp	2019-03-01 19:21:39 UTC (rev 242274)
@@ -640,7 +640,7 @@
     }
 }
 
-void RenderLayerBacking::updateAfterLayout(bool needsFullRepaint)
+void RenderLayerBacking::updateAfterLayout(bool needsClippingUpdate, bool needsFullRepaint)
 {
     LOG(Compositing, "RenderLayerBacking %p updateAfterLayout (layer %p)", this, &m_owningLayer);
 
@@ -651,7 +651,8 @@
         m_owningLayer.setNeedsCompositingGeometryUpdate();
         // This layer's geometry affects those of its children.
         m_owningLayer.setChildrenNeedCompositingGeometryUpdate();
-    }
+    } else if (needsClippingUpdate)
+        m_owningLayer.setNeedsCompositingGeometryUpdate();
     
     if (needsFullRepaint && canIssueSetNeedsDisplay())
         setContentsNeedDisplay();

Modified: branches/safari-607.1.40.0-branch/Source/WebCore/rendering/RenderLayerBacking.h (242273 => 242274)


--- branches/safari-607.1.40.0-branch/Source/WebCore/rendering/RenderLayerBacking.h	2019-03-01 19:21:15 UTC (rev 242273)
+++ branches/safari-607.1.40.0-branch/Source/WebCore/rendering/RenderLayerBacking.h	2019-03-01 19:21:39 UTC (rev 242274)
@@ -80,7 +80,7 @@
     // Update contents and clipping structure.
     void updateDrawsContent();
     
-    void updateAfterLayout(bool needsFullRepaint);
+    void updateAfterLayout(bool needsClippingUpdate, bool needsFullRepaint);
     
     GraphicsLayer* graphicsLayer() const { return m_graphicsLayer.get(); }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to