Bug 200964

Summary: CHART.XKCD charts don't work in Safari
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ahmad.saleem792, ap, bfulgham, rniwa, sabouhallawa, simon.fraser, webkit-bug-importer, zimmermann
Priority: P2 Keywords: BrowserCompat, InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Reduction
none
Reduction none

Description Simon Fraser (smfr) 2019-08-20 20:46:33 PDT
https://timqian.com/chart.xkcd/

Scroll down to the Line Char and Bar Chart examples. They are missing the lines and bars in Safari. Works in Firefox and Chrome
Comment 1 Radar WebKit Bug Importer 2019-08-20 20:46:50 PDT
<rdar://problem/54541463>
Comment 2 Simon Fraser (smfr) 2019-08-20 20:52:57 PDT
Created attachment 376841 [details]
Reduction
Comment 3 Simon Fraser (smfr) 2019-08-20 20:53:19 PDT
It's a problem with the filter:

        <filter id="xkcdify" filterunits="userSpaceOnUse" x="-1000" y="-1000" width="10000" height="10000">
            <feturbulence type="fractalNoise" basefrequency="0.05" result="noise"></feturbulence>
            <fedisplacementmap scale="5" xchannelselector="R" ychannelselector="G" in="SourceGraphic" in2="noise"></fedisplacementmap>
        </filter>
Comment 4 Simon Fraser (smfr) 2019-08-20 20:55:51 PDT
Seems to be caused by the large width and height of the filter.
Comment 5 Simon Fraser (smfr) 2019-08-20 20:56:16 PDT
Created attachment 376843 [details]
Reduction
Comment 6 Simon Fraser (smfr) 2019-08-21 08:52:43 PDT
FilterEffect::apply() silently early returns at ImageBuffer::sizeNeedsClamping(m_absolutePaintRect.size())
Comment 7 Simon Fraser (smfr) 2019-08-21 09:11:30 PDT
Other browsers seem to be able to handle arbitrarily large width and height on the <filter> element (presumably they only make it as big as it needs to be).
Comment 8 Said Abou-Hallawa 2019-08-21 09:38:45 PDT
A related problem here is: I think the SVG shape should be rendered without filters if any of them fails to apply. 

The SVG rendering pipeline applies the SVG filters in the destructor SVGRenderingContext::~SVGRenderingContext(). So it is too late to fall back to drawing the shape at this stage. But I think we should change this structure and make it easier to detect errors and draw the minimum we could instead of drawing nothing.
Comment 9 Ahmad Saleem 2022-07-18 11:43:24 PDT
I am able to reproduce this bug using attached reduction in Safari 15.5 on macOS 12.4 and the test case does not render / show SVG like other browsers (Chrome Canary 105 and Firefox Nightly 104). Thanks!