Commit ccba346
Fix clipping when <use> element in <clipPath> has visibility:hidden but references visible content
https://bugs.webkit.org/show_bug.cgi?id=304896
rdar://167491519
Reviewed by Nikolas Zimmermann and Brent Fulgham.
This patch aligns WebKit with Gecko / Firefox and Blink / Chromium. Additionally,
it fixes the bug in both LegacySVG and Layer Based SVG engine (LBSE).
Merge: https://chromium.googlesource.com/chromium/src/+/53cbed151cea16f4d27cc887a272d9e672c41b75
When a <use> element inside a <clipPath> has visibility:hidden, but the element
it references has visibility:visible, the clipping should still be applied based
on the referenced element's visibility, not the <use> element's visibility.
Previously, WebKit incorrectly checked the <use> element's own visibility state,
causing valid clips to be ignored. Now we correctly look through to the referenced
element to determine if clipping should be applied
And remove reportError() to print error info for <clipPath> usage on SVGUseElement.
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceClipper.cpp:
(WebCore::LegacyRenderSVGResourceClipper::pathOnlyClipping):
(WebCore::LegacyRenderSVGResourceClipper::drawContentIntoMaskImage):
(WebCore::LegacyRenderSVGResourceClipper::calculateClipContentRepaintRect):
* Source/WebCore/svg/SVGClipPathElement.cpp:
(WebCore::SVGClipPathElement::shouldApplyPathClipping const):
(WebCore::SVGClipPathElement::calculateClipContentRepaintRect):
* Source/WebCore/svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::visibleTargetGraphicsElementForClipping const):
(WebCore::SVGUseElement::toClipPath):
* Source/WebCore/svg/SVGUseElement.h:
* LayoutTests/svg/clip-path/visible-clip-path-as-hidden-use-element-expected.html: Added.
* LayoutTests/svg/clip-path/visible-clip-path-as-hidden-use-element.html: Added.
* LayoutTests/svg/clip-path/visible-nested-clip-path-as-hidden-use-element-expected.html: Added.
* LayoutTests/svg/clip-path/visible-nested-clip-path-as-hidden-use-element.html: Added.
Canonical link: https://commits.webkit.org/305374@main1 parent 6aad1a4 commit ccba346
File tree
8 files changed
+93
-24
lines changed- LayoutTests/svg/clip-path
- Source/WebCore
- rendering/svg/legacy
- svg
8 files changed
+93
-24
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
Lines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
125 | | - | |
126 | 124 | | |
127 | | - | |
| 125 | + | |
128 | 126 | | |
129 | 127 | | |
130 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
131 | 134 | | |
132 | 135 | | |
133 | 136 | | |
| |||
265 | 268 | | |
266 | 269 | | |
267 | 270 | | |
268 | | - | |
| 271 | + | |
269 | 272 | | |
270 | 273 | | |
271 | 274 | | |
| |||
304 | 307 | | |
305 | 308 | | |
306 | 309 | | |
307 | | - | |
308 | | - | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
309 | 318 | | |
310 | 319 | | |
311 | 320 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | 149 | | |
155 | | - | |
| 150 | + | |
156 | 151 | | |
157 | 152 | | |
158 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
162 | 167 | | |
163 | 168 | | |
164 | 169 | | |
| |||
191 | 196 | | |
192 | 197 | | |
193 | 198 | | |
194 | | - | |
| 199 | + | |
| 200 | + | |
195 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
196 | 209 | | |
197 | 210 | | |
198 | 211 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
345 | 369 | | |
346 | 370 | | |
347 | 371 | | |
348 | 372 | | |
349 | | - | |
350 | | - | |
| 373 | + | |
| 374 | + | |
351 | 375 | | |
352 | 376 | | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
| 377 | + | |
360 | 378 | | |
361 | 379 | | |
362 | 380 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| |||
0 commit comments