Skip to content

Commit bda153e

Browse files
Ahmad-S792Ahmad Saleem
authored andcommitted
[LegacySVG] Don't check 'visibility' in LegacyRenderSVGResourceMasker
https://bugs.webkit.org/show_bug.cgi?id=297045 rdar://157729389 Reviewed by Nikolas Zimmermann. This patch aligns WebKit with Gecko / Firefox and Blink / Chromium. Note, this bug does not exist in Layer Based SVG engine (LBSE). Merge: https://chromium.googlesource.com/chromium/src/+/51a75fa55ba71462963ddcf085995cf3eca66104 Since 'visibility' does not work in the same way as 'display', it's not possible to "prune" subtrees based on non-'visible' values of the property. Remove the check from the two methods that use it, and leave to lower levels to handle it. * Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceMasker.cpp: (WebCore::LegacyRenderSVGResourceMasker::drawContentIntoContext): (WebCore::LegacyRenderSVGResourceMasker::calculateMaskContentRepaintRect): * LayoutTests/svg/masking/mask-with-visibility-hidden-group-expected.html: Added. * LayoutTests/svg/masking/mask-with-visibility-hidden-group.html: Added. Canonical link: https://commits.webkit.org/305047@main
1 parent 4c9de0f commit bda153e

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!DOCTYPE html>
2+
<div style="width: 100px; height: 100px; background-color: green"></div>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<svg>
3+
<mask id="m">
4+
<g visibility="hidden">
5+
<rect width="100" height="100" fill="white" visibility="visible"/>
6+
<rect width="200" height="100" fill="white"/>
7+
</g>
8+
</mask>
9+
<rect width="200" height="100" fill="green" mask="url(#m)"/>
10+
</svg>

Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceMasker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ bool LegacyRenderSVGResourceMasker::drawContentIntoContext(GraphicsContext& cont
145145
if (renderer->needsLayout())
146146
return false;
147147
const CheckedRef style = renderer->style();
148-
if (style->display() == DisplayType::None || style->usedVisibility() != Visibility::Visible)
148+
if (style->display() == DisplayType::None)
149149
continue;
150150
SVGRenderingContext::renderSubtreeToContext(context, *renderer, maskContentTransformation);
151151
}
@@ -176,7 +176,7 @@ void LegacyRenderSVGResourceMasker::calculateMaskContentRepaintRect(RepaintRectC
176176
if (!renderer || !childNode->isSVGElement())
177177
continue;
178178
const CheckedRef style = renderer->style();
179-
if (style->display() == DisplayType::None || style->usedVisibility() != Visibility::Visible)
179+
if (style->display() == DisplayType::None)
180180
continue;
181181
m_maskContentBoundaries[repaintRectCalculation].unite(renderer->localToParentTransform().mapRect(renderer->repaintRectInLocalCoordinates(repaintRectCalculation)));
182182
}

0 commit comments

Comments
 (0)