Skip to content

Commit

Permalink
Backdrop-filter forces compositing on the root element and uses extra…
Browse files Browse the repository at this point in the history
… memory.

https://bugs.webkit.org/show_bug.cgi?id=271340
<rdar://123831236>

Reviewed by Simon Fraser.

The backdrop-filter spec requires that the root element be a backdrop root, and creates a separate
compositing layer, separate from the base background color of the view. However, most tests are
expecting the base white color to be included in the captured backdrop.

I've filed w3c/fxtf-drafts#557 to try resolve the spec/implementation mismatch.

This change makes the root element only a backdrop root if it also has one of the other grouping
graphics properties. Notably not included is the 'view-transition-name' property, since this is
present on the root as a default UA style.

It also changes RenderView::rootElementShouldPaintBaseBackground so that we don't paint the base
background color as part of the root element's background, if we did end up making the root element
a backdrop root.

It also ensures the default value of CSSUnprefixedBackdropFilterEnabled is always false for
WebKitLegacy, rather than correctly support root background rendering with backdrop filter.

* LayoutTests/compositing/filters/backdrop-filter-root-element-no-backdrop-root-expected.txt: Added.
* LayoutTests/compositing/filters/backdrop-filter-root-element-no-backdrop-root.html: Added.
* LayoutTests/css3/filters/backdrop/backdrop-filter-does-not-size-properly-absolute-expected.txt:
* LayoutTests/css3/filters/backdrop/backdrop-filter-does-not-size-properly-border-and-padding-expected.txt:
* LayoutTests/css3/filters/backdrop/backdrop-filter-with-cliprect-expected.txt:
* LayoutTests/css3/filters/backdrop/backdrop-filter-with-mask-expected.txt:
* LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-changing-expected.txt:
* LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-expected.txt:
* LayoutTests/css3/filters/backdrop/resource-use-add-more-layers-expected.txt:
* LayoutTests/css3/filters/backdrop/resource-use-excessive-expected.txt:
* LayoutTests/css3/filters/backdrop/resource-use-ok-expected.txt:
* LayoutTests/css3/filters/backdrop/resource-use-remove-some-layers-expected.txt:
* LayoutTests/platform/glib/compositing/filters/backdrop-filter-root-element-no-backdrop-root-expected.txt: Added.
* LayoutTests/platform/glib/css3/filters/backdrop/backdrop-filter-does-not-size-properly-absolute-expected.txt:
* LayoutTests/platform/glib/css3/filters/backdrop/backdrop-filter-does-not-size-properly-border-and-padding-expected.txt:
* LayoutTests/platform/glib/css3/filters/backdrop/backdrop-filter-with-cliprect-expected.txt:
* LayoutTests/platform/glib/css3/filters/backdrop/backdrop-filter-with-mask-expected.txt:
* LayoutTests/platform/glib/css3/filters/backdrop/backdrop-with-visibility-hidden-changing-expected.txt:
* LayoutTests/platform/glib/css3/filters/backdrop/backdrop-with-visibility-hidden-expected.txt:
* LayoutTests/platform/glib/css3/filters/backdrop/resource-use-add-more-layers-expected.txt:
* LayoutTests/platform/glib/css3/filters/backdrop/resource-use-excessive-expected.txt:
* LayoutTests/platform/glib/css3/filters/backdrop/resource-use-ok-expected.txt:
* LayoutTests/platform/glib/css3/filters/backdrop/resource-use-remove-some-layers-expected.txt:
* LayoutTests/platform/ios/css3/filters/backdrop/backdrop-filter-does-not-size-properly-absolute-expected.txt:
* LayoutTests/platform/ios/css3/filters/backdrop/backdrop-filter-with-cliprect-expected.txt:
* LayoutTests/platform/ios/css3/filters/backdrop/backdrop-filter-with-mask-expected.txt:
* LayoutTests/platform/mac-wk1/TestExpectations:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::computeCanBeBackdropRoot const):
* Source/WebCore/rendering/RenderView.cpp:
(WebCore::RenderView::rootElementShouldPaintBaseBackground const):

Canonical link: https://commits.webkit.org/276749@main
  • Loading branch information
mattwoodrow committed Mar 27, 2024
1 parent 5aafbde commit 7ffc7f9
Show file tree
Hide file tree
Showing 36 changed files with 801 additions and 826 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(GraphicsLayer
(anchor 0.00 0.00)
(bounds 800.00 600.00)
(children 1
(GraphicsLayer
(bounds 800.00 600.00)
(contentsOpaque 1)
(backgroundColor #008000)
(children 1
(GraphicsLayer
(position 8.00 13.00)
)
)
)
)
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!doctype HTML>
<html style="background-color:green">
<head>
<script type="text/javascript" charset="utf-8">
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}

function doTest()
{
if (window.testRunner) {
document.getElementById('layers').innerText = window.internals.layerTreeAsText(document);
testRunner.notifyDone();
}
}

window.addEventListener('load', doTest, false);
</script>
</head>
<body>
<div style="backdrop-filter: blur(20px)"></div>
<pre id="layers">Layer tree appears here in DRT.</pre>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,16 @@ foo foobar
(contentsOpaque 1)
(children 1
(GraphicsLayer
(bounds 800.00 600.00)
(position 8.00 8.00)
(bounds 342.00 318.00)
(drawsContent 1)
(children 1
(GraphicsLayer
(position 8.00 8.00)
(bounds 342.00 318.00)
(drawsContent 1)
(structural layer
(position 179.00 167.00)
(bounds 342.00 318.00)
)
(backdrop layer
(position 0.00 0.00)
(bounds 100.00 200.00)
)
)
(structural layer
(position 179.00 167.00)
(bounds 342.00 318.00)
)
(backdrop layer
(position 0.00 0.00)
(bounds 100.00 200.00)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,16 @@ foo
(contentsOpaque 1)
(children 1
(GraphicsLayer
(bounds 800.00 600.00)
(position 8.00 8.00)
(bounds 180.00 280.00)
(drawsContent 1)
(children 1
(GraphicsLayer
(position 8.00 8.00)
(bounds 180.00 280.00)
(drawsContent 1)
(structural layer
(position 98.00 148.00)
(bounds 180.00 280.00)
)
(backdrop layer
(position 0.00 0.00)
(bounds 180.00 280.00)
)
)
(structural layer
(position 98.00 148.00)
(bounds 180.00 280.00)
)
(backdrop layer
(position 0.00 0.00)
(bounds 180.00 280.00)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,16 @@ bar
(contentsOpaque 1)
(children 1
(GraphicsLayer
(bounds 800.00 600.00)
(position 8.00 26.00)
(bounds 120.00 120.00)
(drawsContent 1)
(children 1
(GraphicsLayer
(position 8.00 26.00)
(bounds 120.00 120.00)
(drawsContent 1)
(structural layer
(position 68.00 86.00)
(bounds 120.00 120.00)
)
(backdrop layer
(position 0.00 0.00)
(bounds 120.00 120.00)
)
)
(structural layer
(position 68.00 86.00)
(bounds 120.00 120.00)
)
(backdrop layer
(position 0.00 0.00)
(bounds 120.00 120.00)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,21 @@ bar
(contentsOpaque 1)
(children 1
(GraphicsLayer
(bounds 800.00 600.00)
(position 8.00 26.00)
(bounds 120.00 120.00)
(drawsContent 1)
(children 1
(mask layer)
(GraphicsLayer
(position 8.00 26.00)
(bounds 120.00 120.00)
(drawsContent 1)
(mask layer)
(GraphicsLayer
(bounds 120.00 120.00)
(drawsContent 1)
)
(structural layer
(position 68.00 86.00)
(bounds 120.00 120.00)
)
(backdrop layer
(position 0.00 0.00)
(bounds 120.00 120.00)
)
)
(structural layer
(position 68.00 86.00)
(bounds 120.00 120.00)
)
(backdrop layer
(position 0.00 0.00)
(bounds 120.00 120.00)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,16 @@ Dump when filter is visible:
(contentsOpaque 1)
(children 1
(GraphicsLayer
(bounds 800.00 600.00)
(position 0.00 150.00)
(bounds 402.00 52.00)
(drawsContent 1)
(children 1
(GraphicsLayer
(position 0.00 150.00)
(bounds 402.00 52.00)
(drawsContent 1)
(structural layer
(position 201.00 176.00)
(bounds 402.00 52.00)
)
(backdrop layer
(position 0.00 0.00)
(bounds 402.00 52.00)
)
)
(structural layer
(position 201.00 176.00)
(bounds 402.00 52.00)
)
(backdrop layer
(position 0.00 0.00)
(bounds 402.00 52.00)
)
)
)
Expand All @@ -40,23 +34,17 @@ Dump when filter is hidden:
(contentsOpaque 1)
(children 1
(GraphicsLayer
(bounds 800.00 600.00)
(drawsContent 1)
(children 1
(GraphicsLayer
(position 0.00 150.00)
(bounds 402.00 52.00)
(contentsVisible 0)
(structural layer
(position 201.00 176.00)
(bounds 402.00 52.00)
)
(backdrop layer
(position 0.00 0.00)
(bounds 402.00 52.00)
(hidden)
)
)
(position 0.00 150.00)
(bounds 402.00 52.00)
(contentsVisible 0)
(structural layer
(position 201.00 176.00)
(bounds 402.00 52.00)
)
(backdrop layer
(position 0.00 0.00)
(bounds 402.00 52.00)
(hidden)
)
)
)
Expand All @@ -73,22 +61,16 @@ Dump when filter is visible again:
(contentsOpaque 1)
(children 1
(GraphicsLayer
(bounds 800.00 600.00)
(position 0.00 150.00)
(bounds 402.00 52.00)
(drawsContent 1)
(children 1
(GraphicsLayer
(position 0.00 150.00)
(bounds 402.00 52.00)
(drawsContent 1)
(structural layer
(position 201.00 176.00)
(bounds 402.00 52.00)
)
(backdrop layer
(position 0.00 0.00)
(bounds 402.00 52.00)
)
)
(structural layer
(position 201.00 176.00)
(bounds 402.00 52.00)
)
(backdrop layer
(position 0.00 0.00)
(bounds 402.00 52.00)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,17 @@
(contentsOpaque 1)
(children 1
(GraphicsLayer
(bounds 800.00 600.00)
(drawsContent 1)
(children 1
(GraphicsLayer
(position 0.00 150.00)
(bounds 402.00 52.00)
(contentsVisible 0)
(structural layer
(position 201.00 176.00)
(bounds 402.00 52.00)
)
(backdrop layer
(position 0.00 0.00)
(bounds 402.00 52.00)
(hidden)
)
)
(position 0.00 150.00)
(bounds 402.00 52.00)
(contentsVisible 0)
(structural layer
(position 201.00 176.00)
(bounds 402.00 52.00)
)
(backdrop layer
(position 0.00 0.00)
(bounds 402.00 52.00)
(hidden)
)
)
)
Expand Down
Loading

0 comments on commit 7ffc7f9

Please sign in to comment.