Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REGRESSION (r293126): Gmail formatting menu/panel in compose view bec…
…omes blank/empty while scrolling https://bugs.webkit.org/show_bug.cgi?id=240625 <rdar://92984518> Reviewed by Alan Bujtas. Gmail uses the css `clip` property with negative offsets, which is surprising, and revealed a bug in the compositing code for clipping. When a stacking-context layer has overflow:hidden or clip:, we assume that the clip encloses all the descendants, so make a GraphicsLayer with masksToBounds as a parent of the child layers. When the layer has border-radius with uneven corners, we implement that with a shape layer which acts as a mask on that clipping GraphicsLayer. The content in question had CSS clip with negative offsets and border-radius, so the shape layer mask would clip out any content outside the border shape. So if the clip rect extends beyond the border, we need to follow a different code path, which pushes the clipping layers onto descendants; this code path is used for non-stacking context clipping, and for mix-blend-mode which needs to avoid the creation of the intermediate clipping layer. So generalize the `isolatesCompositedBlending()` code path to also be used in the scenario of CSS clip which extends outside the border box. Tests: compositing/clipping/css-clip-and-border-radius.html compositing/clipping/css-clip-non-stacking.html * Source/WebCore/rendering/RenderLayerCompositor.cpp: (WebCore::canUseDescendantClippingLayer): (WebCore::RenderLayerCompositor::clippedByAncestor const): (WebCore::RenderLayerCompositor::computeAncestorClippingStack const): (WebCore::RenderLayerCompositor::clipsCompositingDescendants): * LayoutTests/compositing/clipping/css-clip-and-border-radius-expected.html: Added. * LayoutTests/compositing/clipping/css-clip-and-border-radius.html: Added. * LayoutTests/compositing/clipping/css-clip-non-stacking-expected.html: Added. * LayoutTests/compositing/clipping/css-clip-non-stacking.html: Added. Canonical link: https://commits.webkit.org/250785@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294530 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
5 changed files
with
273 additions
and
5 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
LayoutTests/compositing/clipping/css-clip-and-border-radius-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<style> | ||
.container { | ||
position: absolute; | ||
z-index: 1; | ||
left: 100px; | ||
height: 50px; | ||
width: 500px; | ||
border-radius: 0 25px 25px 0; | ||
background-color: silver; | ||
box-sizing: border-box; | ||
transform: translateZ(0); | ||
} | ||
|
||
.child { | ||
position: absolute; | ||
top: 20px; | ||
left: 20px; | ||
height: 50px; | ||
width: 220px; | ||
border: 4px solid green; | ||
padding: 10px; | ||
background-color: orange; | ||
transform: translateZ(0); | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="container" style="top: 50px;"> | ||
<div class="child"> | ||
this element should not be clipped | ||
</div> | ||
</div> | ||
|
||
<div class="container" style="top: 200px; border-radius: 0px"> | ||
| ||
<div class="child"> | ||
this element should not be clipped | ||
</div> | ||
</div> | ||
|
||
<div class="container" style="top: 350px; overflow: hidden;"> | ||
<div class="child"> | ||
this element should be clipped | ||
</div> | ||
</div> | ||
|
||
<div class="container" style="top: 500px; overflow: hidden; border-radius: 0px"> | ||
| ||
<div class="child"> | ||
this element should be clipped | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
55 changes: 55 additions & 0 deletions
55
LayoutTests/compositing/clipping/css-clip-and-border-radius.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<style> | ||
.container { | ||
position: absolute; | ||
z-index: 1; | ||
left: 100px; | ||
height: 50px; | ||
width: 500px; | ||
border-radius: 0 25px 25px 0; | ||
background-color: silver; | ||
box-sizing: border-box; | ||
transform: translateZ(0); | ||
} | ||
|
||
.child { | ||
position: absolute; | ||
top: 20px; | ||
left: 20px; | ||
height: 50px; | ||
width: 220px; | ||
border: 4px solid green; | ||
padding: 10px; | ||
background-color: orange; | ||
transform: translateZ(0); | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="container" style="top: 50px; clip: rect(0px, 500px, 150px, 0px);"> | ||
<div class="child"> | ||
this element should not be clipped | ||
</div> | ||
</div> | ||
|
||
<div class="container" style="top: 200px; clip: rect(0px, 500px, 150px, 0px); border-radius: 0px"> | ||
<div class="child"> | ||
this element should not be clipped | ||
</div> | ||
</div> | ||
|
||
<div class="container" style="top: 350px; clip: rect(0px, 500px, 50px, 0px);"> | ||
<div class="child"> | ||
this element should be clipped | ||
</div> | ||
</div> | ||
|
||
<div class="container" style="top: 500px; clip: rect(0px, 500px, 50px, 0px); border-radius: 0px"> | ||
<div class="child"> | ||
this element should be clipped | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
65 changes: 65 additions & 0 deletions
65
LayoutTests/compositing/clipping/css-clip-non-stacking-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<style> | ||
.container { | ||
position: absolute; | ||
left: 100px; | ||
height: 50px; | ||
width: 500px; | ||
border-radius: 0 25px 25px 0; | ||
background-color: silver; | ||
box-sizing: border-box; | ||
} | ||
|
||
.child { | ||
position: absolute; | ||
top: 20px; | ||
left: 20px; | ||
height: 50px; | ||
width: 220px; | ||
border: 4px solid green; | ||
padding: 10px; | ||
background-color: orange; | ||
transform: translateZ(0); | ||
} | ||
|
||
.compositing-trigger { | ||
position: absolute; | ||
top: 40px; | ||
left: 110px; | ||
width: 20px; | ||
height: 520px; | ||
background-color: gray; | ||
transform: translateZ(0); | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="compositing-trigger"></div> | ||
|
||
<div class="container" style="top: 50px;"> | ||
<div class="child"> | ||
this element should not be clipped | ||
</div> | ||
</div> | ||
|
||
<div class="container" style="top: 200px; border-radius: 0px"> | ||
<div class="child"> | ||
this element should not be clipped | ||
</div> | ||
</div> | ||
|
||
<div class="container" style="top: 350px; overflow: hidden"> | ||
<div class="child"> | ||
this element should be clipped | ||
</div> | ||
</div> | ||
|
||
<div class="container" style="top: 500px; overflow: hidden; border-radius: 0px"> | ||
<div class="child"> | ||
this element should be clipped | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
65 changes: 65 additions & 0 deletions
65
LayoutTests/compositing/clipping/css-clip-non-stacking.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<style> | ||
.container { | ||
position: absolute; | ||
left: 100px; | ||
height: 50px; | ||
width: 500px; | ||
border-radius: 0 25px 25px 0; | ||
background-color: silver; | ||
box-sizing: border-box; | ||
} | ||
|
||
.child { | ||
position: absolute; | ||
top: 20px; | ||
left: 20px; | ||
height: 50px; | ||
width: 220px; | ||
border: 4px solid green; | ||
padding: 10px; | ||
background-color: orange; | ||
transform: translateZ(0); | ||
} | ||
|
||
.compositing-trigger { | ||
position: absolute; | ||
top: 40px; | ||
left: 110px; | ||
width: 20px; | ||
height: 520px; | ||
background-color: gray; | ||
transform: translateZ(0); | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="compositing-trigger"></div> | ||
|
||
<div class="container" style="top: 50px; clip: rect(0px, 500px, 150px, 0px);"> | ||
<div class="child"> | ||
this element should not be clipped | ||
</div> | ||
</div> | ||
|
||
<div class="container" style="top: 200px; clip: rect(0px, 500px, 150px, 0px); border-radius: 0px"> | ||
<div class="child"> | ||
this element should not be clipped | ||
</div> | ||
</div> | ||
|
||
<div class="container" style="top: 350px; clip: rect(0px, 500px, 50px, 0px);"> | ||
<div class="child"> | ||
this element should be clipped | ||
</div> | ||
</div> | ||
|
||
<div class="container" style="top: 500px; clip: rect(0px, 500px, 50px, 0px); border-radius: 0px"> | ||
<div class="child"> | ||
this element should be clipped | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters