WebKit Bugzilla
Attachment 371115 Details for
Bug 198455
: Non-composited negative z-order children should not trigger creation of a foreground layer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198455-20190601105911.patch (text/plain), 20.17 KB, created by
Simon Fraser (smfr)
on 2019-06-01 10:59:12 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Simon Fraser (smfr)
Created:
2019-06-01 10:59:12 PDT
Size:
20.17 KB
patch
obsolete
>Subversion Revision: 246008 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2458cfb74339378bebf54199c9dd048de52a7fdf..a53f2d7be9a20183558adce080dace19ea046cc8 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,26 @@ >+2019-06-01 Simon Fraser <simon.fraser@apple.com> >+ >+ 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 NOBODY (OOPS!). >+ >+ 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): >+ > 2019-05-31 Youenn Fablet <youenn@apple.com> > > Add an option to mute audio capture automatically when page is not visible >diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp >index 78cc1857ae7ba3a616013af874045d9f45a5d00e..1eafb8e0929b6dde618cb25c871645d48b7b60d1 100644 >--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp >+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp >@@ -978,7 +978,6 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor > // 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 && currentState.subtreeIsCompositing) { >- // make layer compositing > layer.setIndirectCompositingReason(IndirectCompositingReason::BackgroundLayer); > layerWillComposite(); > } >@@ -1250,7 +1249,7 @@ void RenderLayerCompositor::updateBackingAndHierarchy(RenderLayer& layer, Vector > #if !ASSERT_DISABLED > LayerListMutationDetector mutationChecker(layer); > #endif >- >+ > auto appendForegroundLayerIfNecessary = [&] { > // If a negative z-order child is compositing, we get a foreground layer which needs to get parented. > if (layer.negativeZOrderLayers().size()) { >@@ -3240,11 +3239,16 @@ bool RenderLayerCompositor::isRunningTransformAnimation(RenderLayerModelObject& > return renderer.animation().isRunningAnimationOnRenderer(renderer, CSSPropertyTransform); > } > >-// If an element has negative z-index children, those children render in front of the >+// If an element has composited negative z-index children, those children render in front of the > // layer background, so we need an extra 'contents' layer for the foreground of the layer object. > bool RenderLayerCompositor::needsContentsCompositingLayer(const RenderLayer& layer) const > { >- return layer.hasNegativeZOrderLayers(); >+ for (auto* layer : layer.negativeZOrderLayers()) { >+ if (layer->isComposited() || layer->hasCompositingDescendant()) >+ return true; >+ } >+ >+ return false; > } > > bool RenderLayerCompositor::requiresScrollLayer(RootLayerAttachment attachment) const >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index b258c5f1e81b1816d2352e9ec20a12d430b87628..0a3d93af58b5d0a15d04bb52c537878333eea7bf 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,25 @@ >+2019-06-01 Simon Fraser <simon.fraser@apple.com> >+ >+ 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 NOBODY (OOPS!). >+ >+ 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: >+ > 2019-05-31 Wenson Hsieh <wenson_hsieh@apple.com> > > Make tests that use UIHelper more robust under certain configurations >diff --git a/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt b/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt >index 6cf1890e0a31295d90f92e38d6519e167b298939..112a3f7c47720617c58c59b9d68b02e1ebd20281 100644 >--- a/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt >+++ b/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt >@@ -12,7 +12,13 @@ > (anchor 0.10 0.20) > (bounds 500.00 250.00) > (drawsContent 1) >- (children 1 >+ (children 2 >+ (GraphicsLayer >+ (position 50.00 50.00) >+ (bounds 100.00 100.00) >+ (contentsOpaque 1) >+ (drawsContent 1) >+ ) > (GraphicsLayer > (bounds 500.00 250.00) > (drawsContent 1) >@@ -21,12 +27,17 @@ > ) > (GraphicsLayer > (position 0.00 250.00) >- (anchor 0.33 0.33) >- (bounds 150.00 150.00) >+ (bounds 100.00 100.00) > (drawsContent 1) >- (children 1 >+ (children 2 >+ (GraphicsLayer >+ (position 50.00 50.00) >+ (bounds 100.00 100.00) >+ (contentsOpaque 1) >+ (drawsContent 1) >+ ) > (GraphicsLayer >- (bounds 150.00 150.00) >+ (bounds 100.00 100.00) > (drawsContent 1) > ) > ) >diff --git a/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex.html b/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex.html >index 3b0bfba3c4652676ea590ce044f2f450feac99cf..84a17e5f6c3652ac401560c2a676b0cd0bd7d381 100644 >--- a/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex.html >+++ b/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex.html >@@ -3,7 +3,7 @@ > overflow: hidden; > } > .composited { >- -webkit-transform: translateZ(0); >+ transform: translateZ(0); > } > > .box { >@@ -79,13 +79,13 @@ > > <div style="position: absolute; left: 0px; top: 0px; z-index: 0; " class="composited"> > <div class="inline"></div> >- <img style="position: absolute; left: 50px; top: 50px; z-index: -1;"> >+ <img class="composited" style="position: absolute; left: 50px; top: 50px; z-index: -1;"> > <img style="position: absolute; left: 400px; top: 150px; z-index: 0;" class="to-visible"> > </div> > > <div style="position: absolute; left: 0px; top: 250px; z-index: 0; " class="composited"> > <div class="inline"></div> >- <img style="position: absolute; left: 50px; top: 50px; z-index: -1;"> >+ <img class="composited" style="position: absolute; left: 50px; top: 50px; z-index: -1;"> > <img style="position: absolute; left: 400px; top: 150px; z-index: 0;" class="to-hidden"> > </div> > >diff --git a/LayoutTests/compositing/geometry/bounds-ignores-hidden-expected.txt b/LayoutTests/compositing/geometry/bounds-ignores-hidden-expected.txt >index cdfa362804e21727f040c487e1bd7ec3c446ff0b..70a00a8bbbe1658268a6b632df333fa21c34c763 100644 >--- a/LayoutTests/compositing/geometry/bounds-ignores-hidden-expected.txt >+++ b/LayoutTests/compositing/geometry/bounds-ignores-hidden-expected.txt >@@ -8,18 +8,15 @@ > (contentsOpaque 1) > (children 1 > (GraphicsLayer >- (offsetFromRenderer width=10 height=10) >- (position 10.00 10.00) >- (anchor -0.20 -0.20) >- (bounds 50.00 50.00) >- (contentsOpaque 1) >- (drawsContent 1) >- (children 1 >+ (children 2 > (GraphicsLayer >- (offsetFromRenderer width=10 height=10) >+ (position 10.00 10.00) > (bounds 50.00 50.00) >+ (contentsOpaque 1) > (drawsContent 1) > ) >+ (GraphicsLayer >+ ) > ) > ) > ) >diff --git a/LayoutTests/compositing/geometry/bounds-ignores-hidden.html b/LayoutTests/compositing/geometry/bounds-ignores-hidden.html >index 605c61017b21cb5df2794038827446ecfb60d8d0..adc0e1aa373ed523de1ff3020c3defe461cd7647 100644 >--- a/LayoutTests/compositing/geometry/bounds-ignores-hidden.html >+++ b/LayoutTests/compositing/geometry/bounds-ignores-hidden.html >@@ -1,6 +1,6 @@ > <style> > .composited { >- -webkit-transform: translateZ(0); >+ transform: translateZ(0); > } > > img { >@@ -23,7 +23,7 @@ > </script> > <body> > <div style="position: absolute; left: 0px; top: 0px; z-index: 106; " class="composited"> >- <img style="position: absolute; left: 10px; top: 10px; z-index: -2;"> >+ <img class="composited" style="position: absolute; left: 10px; top: 10px; z-index: -2;"> > <img style="position: absolute; left: 44940px; top: 15013px; z-index: 0; visibility: hidden;"> > </div> > <pre id="layers">Layer tree goes here in DRT</pre> >diff --git a/LayoutTests/compositing/layer-creation/composited-negative-z-subtree-expected.txt b/LayoutTests/compositing/layer-creation/composited-negative-z-subtree-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..a0c42bd7fdb4286a35f9bac508631d274985003a >--- /dev/null >+++ b/LayoutTests/compositing/layer-creation/composited-negative-z-subtree-expected.txt >@@ -0,0 +1,29 @@ >+(GraphicsLayer >+ (anchor 0.00 0.00) >+ (bounds 800.00 600.00) >+ (children 1 >+ (GraphicsLayer >+ (bounds 800.00 600.00) >+ (contentsOpaque 1) >+ (children 1 >+ (GraphicsLayer >+ (position 8.00 8.00) >+ (bounds 302.00 302.00) >+ (drawsContent 1) >+ (children 2 >+ (GraphicsLayer >+ (position 23.00 23.00) >+ (bounds 100.00 100.00) >+ (contentsOpaque 1) >+ ) >+ (GraphicsLayer >+ (bounds 302.00 302.00) >+ (drawsContent 1) >+ ) >+ ) >+ ) >+ ) >+ ) >+ ) >+) >+ >diff --git a/LayoutTests/compositing/layer-creation/composited-negative-z-subtree.html b/LayoutTests/compositing/layer-creation/composited-negative-z-subtree.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2b6f88010f5c0e8b99d47da13f1d383bb6c2de43 >--- /dev/null >+++ b/LayoutTests/compositing/layer-creation/composited-negative-z-subtree.html >@@ -0,0 +1,55 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <title>Tests that a composited layer down in the subtree of a negative z-index child triggers a foreground layer</title> >+ <style> >+ .container { >+ width: 300px; >+ height: 300px; >+ border: 1px solid black; >+ position: relative; >+ z-index: 0; >+ } >+ >+ .composited { >+ transform: translateZ(0); >+ background-color: orange; >+ width: 100px; >+ height: 100px; >+ } >+ >+ .negativez { >+ position: relative; >+ z-index: -1; >+ padding: 10px; >+ margin: 10px; >+ border: 2px solid gray; >+ } >+ >+ .contents { >+ margin: -80px 22px; >+ background-color: green; >+ width: 100px; >+ height: 100px; >+ } >+ </style> >+ <script> >+ if (window.testRunner) >+ testRunner.dumpAsText(); >+ >+ window.addEventListener('load', () => { >+ if (window.testRunner) >+ document.getElementById('layers').innerText = window.internals.layerTreeAsText(document); >+ }, false); >+ </script> >+</head> >+<body> >+ <div class="container"> >+ <div class="negativez child"> >+ <div class="composited child"></div> >+ </div> >+ <div class="contents"></div> >+ </div> >+<pre id="layers"></pre> >+</body> >+</html> >diff --git a/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt b/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt >index 1544090fae1f312e8e64b06b2416cd6c42644d5e..c2b0ba7ab4568ad4846c4c2e803f2889d0e61611 100644 >--- a/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt >+++ b/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt >@@ -38,7 +38,16 @@ Scrolled contents > GraphicsLayerPaintOverflowContents > GraphicsLayerPaintCompositedScroll > ) >- (children 1 >+ (children 2 >+ (GraphicsLayer >+ (position 30.00 50.00) >+ (bounds 100.00 100.00) >+ (contentsOpaque 1) >+ (paintingPhases >+ GraphicsLayerPaintBackground >+ GraphicsLayerPaintForeground >+ ) >+ ) > (GraphicsLayer > (offsetFromRenderer width=1 height=1) > (bounds 305.00 1020.00) >diff --git a/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html b/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html >index 8cc954bf5ac1d6d47341105360347602724aef05..e686ba755883b462b879e9ebfa75390b804907c4 100644 >--- a/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html >+++ b/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html >@@ -23,6 +23,7 @@ > width: 100px; > height: 100px; > background-color: blue; >+ transform: translateZ(0); > } > </style> > <script> >diff --git a/LayoutTests/platform/ios-wk2/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt b/LayoutTests/platform/ios-wk2/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt >index 902f97f5378e9c068306b2f4734467540d9410d0..be87a2c58a6c3c9a08247caf1a1ecfa78c6fcf62 100644 >--- a/LayoutTests/platform/ios-wk2/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt >+++ b/LayoutTests/platform/ios-wk2/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt >@@ -12,7 +12,13 @@ > (anchor 0.10 0.20) > (bounds 500.00 250.00) > (drawsContent 1) >- (children 1 >+ (children 2 >+ (GraphicsLayer >+ (position 50.00 50.00) >+ (bounds 100.00 100.00) >+ (contentsOpaque 1) >+ (drawsContent 1) >+ ) > (GraphicsLayer > (bounds 500.00 250.00) > (drawsContent 1) >@@ -21,12 +27,17 @@ > ) > (GraphicsLayer > (position 0.00 250.00) >- (anchor 0.33 0.33) >- (bounds 150.00 150.00) >+ (bounds 100.00 100.00) > (drawsContent 1) >- (children 1 >+ (children 2 >+ (GraphicsLayer >+ (position 50.00 50.00) >+ (bounds 100.00 100.00) >+ (contentsOpaque 1) >+ (drawsContent 1) >+ ) > (GraphicsLayer >- (bounds 150.00 150.00) >+ (bounds 100.00 100.00) > (drawsContent 1) > ) > ) >diff --git a/LayoutTests/platform/ios-wk2/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt b/LayoutTests/platform/ios-wk2/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt >index 1ff9ddb1437b5e5919387f4cd01db8dc859e55ae..11ea23c77a3feffec6ac8176807b4f8bdf2529a4 100644 >--- a/LayoutTests/platform/ios-wk2/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt >+++ b/LayoutTests/platform/ios-wk2/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt >@@ -38,7 +38,16 @@ Scrolled contents > GraphicsLayerPaintOverflowContents > GraphicsLayerPaintCompositedScroll > ) >- (children 1 >+ (children 2 >+ (GraphicsLayer >+ (position 30.00 50.00) >+ (bounds 100.00 100.00) >+ (contentsOpaque 1) >+ (paintingPhases >+ GraphicsLayerPaintBackground >+ GraphicsLayerPaintForeground >+ ) >+ ) > (GraphicsLayer > (offsetFromRenderer width=1 height=1) > (bounds 320.00 1020.00) >diff --git a/LayoutTests/platform/mac-wk1/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt b/LayoutTests/platform/mac-wk1/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt >index e30707a44edd62952adef07c8407e71d1744ec8e..78a95a75090fe3153fa91930fe1262630f3b8dc9 100644 >--- a/LayoutTests/platform/mac-wk1/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt >+++ b/LayoutTests/platform/mac-wk1/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt >@@ -1,2 +1,60 @@ > Scrolled contents >+(GraphicsLayer >+ (anchor 0.00 0.00) >+ (bounds 800.00 600.00) >+ (paintingPhases >+ GraphicsLayerPaintBackground >+ GraphicsLayerPaintForeground >+ ) >+ (children 1 >+ (GraphicsLayer >+ (bounds 800.00 600.00) >+ (contentsOpaque 1) >+ (paintingPhases >+ GraphicsLayerPaintBackground >+ GraphicsLayerPaintForeground >+ ) >+ (children 1 >+ (GraphicsLayer >+ (position 8.00 8.00) >+ (bounds 322.00 322.00) >+ (drawsContent 1) >+ (paintingPhases >+ GraphicsLayerPaintBackground >+ ) >+ (children 1 >+ (GraphicsLayer >+ (offsetFromRenderer width=1 height=1) >+ (position 1.00 1.00) >+ (bounds 305.00 305.00) >+ (paintingPhases >+ GraphicsLayerPaintBackground >+ GraphicsLayerPaintForeground >+ ) >+ (children 2 >+ (GraphicsLayer >+ (position 30.00 50.00) >+ (bounds 100.00 100.00) >+ (contentsOpaque 1) >+ (paintingPhases >+ GraphicsLayerPaintBackground >+ GraphicsLayerPaintForeground >+ ) >+ ) >+ (GraphicsLayer >+ (offsetFromRenderer width=1 height=1) >+ (bounds 305.00 305.00) >+ (drawsContent 1) >+ (paintingPhases >+ GraphicsLayerPaintForeground >+ ) >+ ) >+ ) >+ ) >+ ) >+ ) >+ ) >+ ) >+ ) >+) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198455
: 371115 |
371118