Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
SVG clip-path is sometimes broken on stevejobsarchive.com
https://bugs.webkit.org/show_bug.cgi?id=255577 rdar://107885344 Reviewed by Said Abou-Hallawa. http://book.stevejobsarchive.com/ uses CSS clip-path with a reference to an SVG <clipPath> element which contains text. In this configuration, RenderSVGResourceClipper::applyClippingToContext() falls back to a code path that uses an ImageBuffer as a mask, and it caches the ImageBuffer between calls. This caused a problem when DOM Rendering in the GPU Process was enabled; this code is first hit for a "fake" paint with a NullGraphicsContext which is updating EventRegions, called out of `RenderLayerBacking::updateEventRegion()`. The NullGraphicsContext will make a local ImageBuffer. If we then hit this same code for actual painting with a painting GraphicsContext, we'll use that cached ImageBuffer, rather than creating a new one with appropriate GPU Process backing. Fix this by adding `isPaintingDisabled` to the criteria used to decide if the cached buffer can be re-used. * LayoutTests/svg/masking/masking-with-event-region-expected.html: Added. * LayoutTests/svg/masking/masking-with-event-region.html: Added. * Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp: (WebCore::RenderSVGResourceClipper::computeInputs): (WebCore::RenderSVGResourceClipper::applyClippingToContext): * Source/WebCore/rendering/svg/RenderSVGResourceClipper.h: (WebCore::ClipperData::Inputs::operator== const): Canonical link: https://commits.webkit.org/263087@main
- Loading branch information
Showing
4 changed files
with
99 additions
and
9 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
LayoutTests/svg/masking/masking-with-event-region-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,35 @@ | ||
<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] --> | ||
<html> | ||
<head> | ||
<style> | ||
#test-clip-text { | ||
font-family: system-ui; | ||
font-weight: 900; | ||
font-size: 60px; | ||
} | ||
.clipped { | ||
position: absolute; | ||
width: 200px; | ||
height: 100px; | ||
z-index: 1; | ||
top: 5px; | ||
left: 50px; | ||
clip-path: url("#test-clip-text"); | ||
background-color: blue; | ||
} | ||
.composited { | ||
transform: translateZ(0); | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0"> | ||
<defs> | ||
<clipPath id="test-clip-text"> | ||
<text x="5" y="50">TEST</text> | ||
</clipPath> | ||
</defs> | ||
</svg> | ||
<div class="composited clipped"></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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] --> | ||
<html> | ||
<head> | ||
<style> | ||
.scroller { | ||
position: absolute; | ||
width: 300px; | ||
height: 300px; | ||
overflow: scroll; | ||
background: white; | ||
z-index: 3; | ||
margin: 100px; | ||
opacity: 0; | ||
} | ||
|
||
.contents { | ||
height: 120%; | ||
} | ||
|
||
#test-clip-text { | ||
font-family: system-ui; | ||
font-weight: 900; | ||
font-size: 60px; | ||
} | ||
.clipped { | ||
position: absolute; | ||
width: 200px; | ||
height: 100px; | ||
z-index: 1; | ||
top: 5px; | ||
left: 50px; | ||
clip-path: url("#test-clip-text"); | ||
background-color: blue; | ||
} | ||
.composited { | ||
transform: translateZ(0); | ||
} | ||
|
||
</style> | ||
</head> | ||
<body> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0"> | ||
<defs> | ||
<clipPath id="test-clip-text"> | ||
<text x="5" y="50">TEST</text> | ||
</clipPath> | ||
</defs> | ||
</svg> | ||
<div class="composited clipped"></div> | ||
|
||
<!-- scroller triggers event region generation --> | ||
<div class="composited scroller"> | ||
<div class="contents"> | ||
scroller | ||
</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
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