Bug 212820

Summary: SVG fragment reference fails in shadow tree under some circumstances
Product: WebKit Reporter: ian
Component: SVGAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, ahmad.saleem792, andresg_22, apinheiro, cdumez, cfleizach, changseok, dino, dmazzoni, esprehn+autocc, ews-watchlist, fmalita, fred.wang, glenn, gyuyoung.kim, jcraig, jdiggs, kangil.han, kondapallykalyan, pdr, rniwa, sabouhallawa, samuel_white, schenney, sergio, simon.fraser, webkit-bug-importer, zimmermann
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari 13   
Hardware: All   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 148695    
Attachments:
Description Flags
Repro
none
Expected example behavior (Chrome)
none
Actual behavior (Safari)
none
Expected and unexpected behavior in a project
none
reduced test case
none
WIP
ews-feeder: commit-queue-
WIP2 none

Description ian 2020-06-05 06:17:27 PDT
Created attachment 401145 [details]
Repro

filter:url(#myFilter), fill:url(#myPattern), etc. can fail in some circumstances when the SVG is in a shadowTree and there are multiple shadowTrees with that SVG in it. The result is no fill, no filter or the element disappearing. 

The attached example reproduces in Safari 13.1, STP 107, and iPadOS 13.5. 
It does not reproduce in Chrome 83 or FF 77.
Comment 1 ian 2020-06-05 06:18:24 PDT
Created attachment 401147 [details]
Expected example behavior (Chrome)
Comment 2 ian 2020-06-05 06:18:55 PDT
Created attachment 401148 [details]
Actual behavior (Safari)
Comment 3 ian 2020-06-05 06:22:37 PDT
Created attachment 401150 [details]
Expected and unexpected behavior in a project

It seems the issue manifests when there's only one instance of a shadowTree displayer with the offending SVG, except sometimes when the shadowTree is not the first child in the document that contains the offending SVG...
Comment 4 Radar WebKit Bug Importer 2020-06-07 13:46:20 PDT
<rdar://problem/64094920>
Comment 5 Said Abou-Hallawa 2020-06-08 12:25:57 PDT
Created attachment 401356 [details]
reduced test case

A reduced test case is attached.
Comment 6 Ahmad Saleem 2023-05-27 12:19:48 PDT
I am able to reproduce this bug in WebKit ToT / Safari 16.5.1 as well. Chrome Canary 116 and Firefox Nightly 115 works fine.
Comment 7 Ryosuke Niwa 2023-06-25 03:04:24 PDT
Created attachment 466820 [details]
WIP
Comment 8 Ryosuke Niwa 2023-06-26 00:03:50 PDT
Created attachment 466823 [details]
WIP2
Comment 9 Ryosuke Niwa 2023-06-26 15:58:06 PDT
Pull request: https://github.com/WebKit/WebKit/pull/15308
Comment 10 EWS 2023-06-27 15:03:25 PDT
Committed 265565@main (9057e67f7402): <https://commits.webkit.org/265565@main>

Reviewed commits have been landed. Closing PR #15308 and removing active labels.