Skip to content

Commit

Permalink
Combining backface-visibility:hidden and backdrop-filter stops the ba…
Browse files Browse the repository at this point in the history
…ckface from being hidden.

https://bugs.webkit.org/show_bug.cgi?id=249952
<rdar://103940530>

Reviewed by Simon Fraser.

Structural layers created for backdrop-filter should still have the double sided property set.

* LayoutTests/css3/filters/backdrop/backdrop-filter-with-backface-visibility-expected.html: Added.
* LayoutTests/css3/filters/backdrop/backdrop-filter-with-backface-visibility.html: Added.
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateBackfaceVisibility):

Canonical link: https://commits.webkit.org/268427@main
  • Loading branch information
mattwoodrow committed Sep 26, 2023
1 parent ad35360 commit 93bef58
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE HTML>
<html>
<head>
<title>This tests that an element with backface-visibility hidden does not show its backdrop filter.</title>
<style>
div {
width: 200px;
height: 200px;
position: absolute;
}

#behind {
background: green;
}
</style>
</head>
<body>
<div id="behind"></div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE HTML>
<html>
<head>
<title>This tests that an element with backface-visibility hidden does not show its backdrop filter.</title>
<style>
div {
width: 200px;
height: 200px;
position: absolute;
}

#behind {
background: green;
}

#outer {
transform-style: preserve-3d;
transform: rotateX(180deg);
}

#inner {
transform: rotateX(0deg);
background: red;
backface-visibility: hidden;
-webkit-backdrop-filter: blur(1px);
}
</style>
</head>
<body>
<div id="behind"></div>
<div id="outer">
<div id="inner">
</div>
</div>
</body>
</html>
3 changes: 2 additions & 1 deletion Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2435,7 +2435,8 @@ void GraphicsLayerCA::updateContentsOpaque(float pageScaleFactor)

void GraphicsLayerCA::updateBackfaceVisibility()
{
if (m_structuralLayer && structuralLayerPurpose() == StructuralLayerForReplicaFlattening) {
if (m_structuralLayer && (structuralLayerPurpose() == StructuralLayerForReplicaFlattening || structuralLayerPurpose() == StructuralLayerForBackdrop)) {

m_structuralLayer->setDoubleSided(m_backfaceVisibility);

if (m_layerClones) {
Expand Down

0 comments on commit 93bef58

Please sign in to comment.