Changeset 242248 in webkit


Ignore:
Timestamp:
Feb 28, 2019 5:54:59 PM (5 years ago)
Author:
Simon Fraser
Message:

[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.
Location:
trunk
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r242241 r242248  
     12019-02-28  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS] Dark flash when opening Google AMP pages
     4        https://bugs.webkit.org/show_bug.cgi?id=195193
     5        rdar://problem/48326442
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        Tests that change the size of a clipping layer with non-z-order composited descendant, with
     10        a couple of layer tree configurations.
     11
     12        * compositing/geometry/ancestor-clip-change-expected.html: Added.
     13        * compositing/geometry/ancestor-clip-change-interleaved-stacking-context-expected.html: Added.
     14        * compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html: Added.
     15        * compositing/geometry/ancestor-clip-change.html: Added.
     16
    1172019-02-28  Joseph Pecoraro  <pecoraro@apple.com>
    218
  • trunk/Source/WebCore/ChangeLog

    r242237 r242248  
     12019-02-28  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS] Dark flash when opening Google AMP pages
     4        https://bugs.webkit.org/show_bug.cgi?id=195193
     5        rdar://problem/48326442
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        After the incremental compositing updates changes, it was possible for a change in the size
     10        of an overflow:hidden element to fail to update the "ancestor clipping layer" geometry on
     11        a composited descendant that is not a descendant in z-order. When Google search results
     12        create the <iframe> that contain AMP contents, we'd fail to update a zero-sized clipping layer,
     13        leaving the #222 background of an intermediate element visible.
     14
     15        Fix by setting a flag in RenderLayer::updateLayerPosition() (which is called in containing block order)
     16        that sets the "needs geometry update" dirty bit on containing-block-descendant layers. Currently
     17        this flag affects all descendants; in future, we might be able to clear it for grand-children.
     18
     19        Tests: compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html
     20               compositing/geometry/ancestor-clip-change.html
     21
     22        * rendering/RenderLayer.cpp:
     23        (WebCore::RenderLayer::updateLayerPositions):
     24        (WebCore::RenderLayer::updateLayerPosition):
     25        * rendering/RenderLayer.h:
     26        * rendering/RenderLayerBacking.cpp:
     27        (WebCore::RenderLayerBacking::updateAfterLayout):
     28        * rendering/RenderLayerBacking.h:
     29
    1302019-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
    231
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r241150 r242248  
    849849void RenderLayer::updateLayerPositions(RenderGeometryMap* geometryMap, OptionSet<UpdateLayerPositionsFlag> flags)
    850850{
    851     updateLayerPosition(); // For relpositioned layers or non-positioned layers,
    852                            // we need to keep in sync, since we may have shifted relative
    853                            // to our parent layer.
    854 
     851    updateLayerPosition(&flags);
    855852    applyPostLayoutScrollPositionIfNeeded();
    856853
     
    953950
    954951    if (isComposited())
    955         backing()->updateAfterLayout(flags.contains(NeedsFullRepaintInBacking));
     952        backing()->updateAfterLayout(flags.contains(ContainingClippingLayerChangedSize), flags.contains(NeedsFullRepaintInBacking));
    956953
    957954    if (geometryMap)
     
    14991496}
    15001497
    1501 bool RenderLayer::updateLayerPosition()
     1498bool RenderLayer::updateLayerPosition(OptionSet<UpdateLayerPositionsFlag>* flags)
    15021499{
    15031500    LayoutPoint localPoint;
     
    15171514                setNeedsPostLayoutCompositingUpdate();
    15181515            }
     1516
     1517            if (flags && renderer().hasOverflowClip())
     1518                flags->add(ContainingClippingLayerChangedSize);
     1519
    15191520            setSize(newSize);
    15201521        }
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r241150 r242248  
    506506
    507507    enum UpdateLayerPositionsFlag {
    508         CheckForRepaint                 = 1 << 0,
    509         NeedsFullRepaintInBacking       = 1 << 1,
    510         UpdatePagination                = 1 << 2,
    511         SeenTransformedLayer            = 1 << 3,
    512         Seen3DTransformedLayer          = 1 << 4,
     508        CheckForRepaint                     = 1 << 0,
     509        NeedsFullRepaintInBacking           = 1 << 1,
     510        ContainingClippingLayerChangedSize  = 1 << 2,
     511        UpdatePagination                    = 1 << 3,
     512        SeenTransformedLayer                = 1 << 4,
     513        Seen3DTransformedLayer              = 1 << 5,
    513514    };
    514515    static constexpr OptionSet<UpdateLayerPositionsFlag> updateLayerPositionsDefaultFlags() { return { CheckForRepaint }; }
     
    932933
    933934    // Returns true if the position changed.
    934     bool updateLayerPosition();
     935    bool updateLayerPosition(OptionSet<UpdateLayerPositionsFlag>* = nullptr);
    935936
    936937    void updateLayerPositions(RenderGeometryMap* = nullptr, OptionSet<UpdateLayerPositionsFlag> = updateLayerPositionsDefaultFlags());
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r242205 r242248  
    652652}
    653653
    654 void RenderLayerBacking::updateAfterLayout(bool needsFullRepaint)
     654void RenderLayerBacking::updateAfterLayout(bool needsClippingUpdate, bool needsFullRepaint)
    655655{
    656656    LOG(Compositing, "RenderLayerBacking %p updateAfterLayout (layer %p)", this, &m_owningLayer);
     
    663663        // This layer's geometry affects those of its children.
    664664        m_owningLayer.setChildrenNeedCompositingGeometryUpdate();
    665     }
     665    } else if (needsClippingUpdate)
     666        m_owningLayer.setNeedsCompositingGeometryUpdate();
    666667   
    667668    if (needsFullRepaint && canIssueSetNeedsDisplay())
  • trunk/Source/WebCore/rendering/RenderLayerBacking.h

    r241788 r242248  
    8484    void updateDrawsContent();
    8585   
    86     void updateAfterLayout(bool needsFullRepaint);
     86    void updateAfterLayout(bool needsClippingUpdate, bool needsFullRepaint);
    8787   
    8888    GraphicsLayer* graphicsLayer() const { return m_graphicsLayer.get(); }
Note: See TracChangeset for help on using the changeset viewer.