⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 246017 in webkit


Ignore:
Timestamp:
Jun 1, 2019, 2:40:04 PM (7 years ago)
Author:
Simon Fraser
Message:

Non-composited negative z-order children should not trigger creation of a foreground layer
https://bugs.webkit.org/show_bug.cgi?id=198455

Reviewed by Sam Weinig.
Source/WebCore:

The existing code triggered creation of a foreground layer on RenderLayerBacking when
the negative z-order list was non-empty. This isn't necessary; we can paint the negative
z-order children just fine.

We only need a foreground layer when the negative z-order layers are composited or
have composited descendants.

This will reduce backing store memory use in some cases.

Test: compositing/layer-creation/composited-negative-z-subtree.html

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::computeCompositingRequirements):
(WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
(WebCore::RenderLayerCompositor::needsContentsCompositingLayer const):

LayoutTests:

Change existing tests that use negative z-order layers to trigger foreground layer
creation to use compositing on those negative z-order layers.

  • compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt:
  • compositing/geometry/bounds-ignores-hidden-dynamic-negzindex.html:
  • compositing/geometry/bounds-ignores-hidden-expected.txt:
  • compositing/geometry/bounds-ignores-hidden.html:
  • compositing/layer-creation/composited-negative-z-subtree-expected.txt: Added.
  • compositing/layer-creation/composited-negative-z-subtree.html: Added.
  • compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt:
  • compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html:
  • platform/ios-wk2/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt:
  • platform/ios-wk2/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt:
  • platform/mac-wk1/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt:
Location:
trunk
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r246016 r246017  
     12019-06-01  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Non-composited negative z-order children should not trigger creation of a foreground layer
     4        https://bugs.webkit.org/show_bug.cgi?id=198455
     5
     6        Reviewed by Sam Weinig.
     7       
     8        Change existing tests that use negative z-order layers to trigger foreground layer
     9        creation to use compositing on those negative z-order layers.
     10
     11        * compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt:
     12        * compositing/geometry/bounds-ignores-hidden-dynamic-negzindex.html:
     13        * compositing/geometry/bounds-ignores-hidden-expected.txt:
     14        * compositing/geometry/bounds-ignores-hidden.html:
     15        * compositing/layer-creation/composited-negative-z-subtree-expected.txt: Added.
     16        * compositing/layer-creation/composited-negative-z-subtree.html: Added.
     17        * compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt:
     18        * compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html:
     19        * platform/ios-wk2/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt:
     20        * platform/ios-wk2/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt:
     21        * platform/mac-wk1/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt:
     22
    1232019-06-01  Devin Rousso  <drousso@apple.com>
    224
  • trunk/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt

    r168244 r246017  
    1313          (bounds 500.00 250.00)
    1414          (drawsContent 1)
    15           (children 1
     15          (children 2
     16            (GraphicsLayer
     17              (position 50.00 50.00)
     18              (bounds 100.00 100.00)
     19              (contentsOpaque 1)
     20              (drawsContent 1)
     21            )
    1622            (GraphicsLayer
    1723              (bounds 500.00 250.00)
     
    2228        (GraphicsLayer
    2329          (position 0.00 250.00)
    24           (anchor 0.33 0.33)
    25           (bounds 150.00 150.00)
     30          (bounds 100.00 100.00)
    2631          (drawsContent 1)
    27           (children 1
     32          (children 2
    2833            (GraphicsLayer
    29               (bounds 150.00 150.00)
     34              (position 50.00 50.00)
     35              (bounds 100.00 100.00)
     36              (contentsOpaque 1)
     37              (drawsContent 1)
     38            )
     39            (GraphicsLayer
     40              (bounds 100.00 100.00)
    3041              (drawsContent 1)
    3142            )
  • trunk/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex.html

    r130689 r246017  
    44    }
    55    .composited {
    6         -webkit-transform: translateZ(0);
     6        transform: translateZ(0);
    77    }
    88
     
    8080    <div style="position: absolute; left: 0px; top: 0px; z-index: 0; " class="composited">
    8181        <div class="inline"></div>
    82         <img style="position: absolute; left: 50px; top: 50px; z-index: -1;">
     82        <img class="composited" style="position: absolute; left: 50px; top: 50px; z-index: -1;">
    8383        <img style="position: absolute; left: 400px; top: 150px; z-index: 0;" class="to-visible">
    8484    </div>
     
    8686    <div style="position: absolute; left: 0px; top: 250px; z-index: 0; " class="composited">
    8787        <div class="inline"></div>
    88         <img style="position: absolute; left: 50px; top: 50px; z-index: -1;">
     88        <img class="composited" style="position: absolute; left: 50px; top: 50px; z-index: -1;">
    8989        <img style="position: absolute; left: 400px; top: 150px; z-index: 0;" class="to-hidden">
    9090    </div>
  • trunk/LayoutTests/compositing/geometry/bounds-ignores-hidden-expected.txt

    r225897 r246017  
    99      (children 1
    1010        (GraphicsLayer
    11           (offsetFromRenderer width=10 height=10)
    12           (position 10.00 10.00)
    13           (anchor -0.20 -0.20)
    14           (bounds 50.00 50.00)
    15           (contentsOpaque 1)
    16           (drawsContent 1)
    17           (children 1
     11          (children 2
    1812            (GraphicsLayer
    19               (offsetFromRenderer width=10 height=10)
     13              (position 10.00 10.00)
    2014              (bounds 50.00 50.00)
     15              (contentsOpaque 1)
    2116              (drawsContent 1)
     17            )
     18            (GraphicsLayer
    2219            )
    2320          )
  • trunk/LayoutTests/compositing/geometry/bounds-ignores-hidden.html

    r130689 r246017  
    11<style>
    22  .composited {
    3     -webkit-transform: translateZ(0);
     3    transform: translateZ(0);
    44  }
    55 
     
    2424<body>
    2525    <div style="position: absolute; left: 0px; top: 0px; z-index: 106; " class="composited">
    26         <img style="position: absolute; left: 10px; top: 10px; z-index: -2;">
     26        <img class="composited" style="position: absolute; left: 10px; top: 10px; z-index: -2;">
    2727        <img style="position: absolute; left: 44940px; top: 15013px; z-index: 0; visibility: hidden;">
    2828    </div>
  • trunk/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt

    r245977 r246017  
    3939                    GraphicsLayerPaintCompositedScroll
    4040                    )
    41                   (children 1
     41                  (children 2
     42                    (GraphicsLayer
     43                      (position 30.00 50.00)
     44                      (bounds 100.00 100.00)
     45                      (contentsOpaque 1)
     46                      (paintingPhases
     47                        GraphicsLayerPaintBackground
     48                        GraphicsLayerPaintForeground
     49                        )
     50                    )
    4251                    (GraphicsLayer
    4352                      (offsetFromRenderer width=1 height=1)
  • trunk/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html

    r245977 r246017  
    2424            height: 100px;
    2525            background-color: blue;
     26            transform: translateZ(0);
    2627        }
    2728    </style>
  • trunk/LayoutTests/platform/ios-wk2/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt

    r177052 r246017  
    1313          (bounds 500.00 250.00)
    1414          (drawsContent 1)
    15           (children 1
     15          (children 2
     16            (GraphicsLayer
     17              (position 50.00 50.00)
     18              (bounds 100.00 100.00)
     19              (contentsOpaque 1)
     20              (drawsContent 1)
     21            )
    1622            (GraphicsLayer
    1723              (bounds 500.00 250.00)
     
    2228        (GraphicsLayer
    2329          (position 0.00 250.00)
    24           (anchor 0.33 0.33)
    25           (bounds 150.00 150.00)
     30          (bounds 100.00 100.00)
    2631          (drawsContent 1)
    27           (children 1
     32          (children 2
    2833            (GraphicsLayer
    29               (bounds 150.00 150.00)
     34              (position 50.00 50.00)
     35              (bounds 100.00 100.00)
     36              (contentsOpaque 1)
     37              (drawsContent 1)
     38            )
     39            (GraphicsLayer
     40              (bounds 100.00 100.00)
    3041              (drawsContent 1)
    3142            )
  • trunk/LayoutTests/platform/ios-wk2/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt

    r245977 r246017  
    3939                    GraphicsLayerPaintCompositedScroll
    4040                    )
    41                   (children 1
     41                  (children 2
     42                    (GraphicsLayer
     43                      (position 30.00 50.00)
     44                      (bounds 100.00 100.00)
     45                      (contentsOpaque 1)
     46                      (paintingPhases
     47                        GraphicsLayerPaintBackground
     48                        GraphicsLayerPaintForeground
     49                        )
     50                    )
    4251                    (GraphicsLayer
    4352                      (offsetFromRenderer width=1 height=1)
  • trunk/LayoutTests/platform/mac-wk1/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt

    r245977 r246017  
    11Scrolled contents
     2(GraphicsLayer
     3  (anchor 0.00 0.00)
     4  (bounds 800.00 600.00)
     5  (paintingPhases
     6    GraphicsLayerPaintBackground
     7    GraphicsLayerPaintForeground
     8    )
     9  (children 1
     10    (GraphicsLayer
     11      (bounds 800.00 600.00)
     12      (contentsOpaque 1)
     13      (paintingPhases
     14        GraphicsLayerPaintBackground
     15        GraphicsLayerPaintForeground
     16        )
     17      (children 1
     18        (GraphicsLayer
     19          (position 8.00 8.00)
     20          (bounds 322.00 322.00)
     21          (drawsContent 1)
     22          (paintingPhases
     23            GraphicsLayerPaintBackground
     24            )
     25          (children 1
     26            (GraphicsLayer
     27              (offsetFromRenderer width=1 height=1)
     28              (position 1.00 1.00)
     29              (bounds 305.00 305.00)
     30              (paintingPhases
     31                GraphicsLayerPaintBackground
     32                GraphicsLayerPaintForeground
     33                )
     34              (children 2
     35                (GraphicsLayer
     36                  (position 30.00 50.00)
     37                  (bounds 100.00 100.00)
     38                  (contentsOpaque 1)
     39                  (paintingPhases
     40                    GraphicsLayerPaintBackground
     41                    GraphicsLayerPaintForeground
     42                    )
     43                )
     44                (GraphicsLayer
     45                  (offsetFromRenderer width=1 height=1)
     46                  (bounds 305.00 305.00)
     47                  (drawsContent 1)
     48                  (paintingPhases
     49                    GraphicsLayerPaintForeground
     50                    )
     51                )
     52              )
     53            )
     54          )
     55        )
     56      )
     57    )
     58  )
     59)
    260
  • trunk/Source/WebCore/ChangeLog

    r246014 r246017  
     12019-06-01  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Non-composited negative z-order children should not trigger creation of a foreground layer
     4        https://bugs.webkit.org/show_bug.cgi?id=198455
     5
     6        Reviewed by Sam Weinig.
     7
     8        The existing code triggered creation of a foreground layer on RenderLayerBacking when
     9        the negative z-order list was non-empty. This isn't necessary; we can paint the negative
     10        z-order children just fine.
     11
     12        We only need a foreground layer when the negative z-order layers are composited or
     13        have composited descendants.
     14
     15        This will reduce backing store memory use in some cases.
     16
     17        Test: compositing/layer-creation/composited-negative-z-subtree.html
     18
     19        * rendering/RenderLayerCompositor.cpp:
     20        (WebCore::RenderLayerCompositor::computeCompositingRequirements):
     21        (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
     22        (WebCore::RenderLayerCompositor::needsContentsCompositingLayer const):
     23
    1242019-06-01  Andy Estes  <aestes@apple.com>
    225
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r245950 r246017  
    979979        // (since we need to ensure that the -ve z-order child renders underneath our contents).
    980980        if (!willBeComposited && currentState.subtreeIsCompositing) {
    981             // make layer compositing
    982981            layer.setIndirectCompositingReason(IndirectCompositingReason::BackgroundLayer);
    983982            layerWillComposite();
     
    12511250    LayerListMutationDetector mutationChecker(layer);
    12521251#endif
    1253    
     1252
    12541253    auto appendForegroundLayerIfNecessary = [&] {
    12551254        // If a negative z-order child is compositing, we get a foreground layer which needs to get parented.
     
    32413240}
    32423241
    3243 // If an element has negative z-index children, those children render in front of the
     3242// If an element has composited negative z-index children, those children render in front of the
    32443243// layer background, so we need an extra 'contents' layer for the foreground of the layer object.
    32453244bool RenderLayerCompositor::needsContentsCompositingLayer(const RenderLayer& layer) const
    32463245{
    3247     return layer.hasNegativeZOrderLayers();
     3246    for (auto* layer : layer.negativeZOrderLayers()) {
     3247        if (layer->isComposited() || layer->hasCompositingDescendant())
     3248            return true;
     3249    }
     3250
     3251    return false;
    32483252}
    32493253
Note: See TracChangeset for help on using the changeset viewer.