Bug 215602

Summary: Leading white spaces should be ignored when parsing an SVG list property
Product: WebKit Reporter: Mathias Bynens <mathias>
Component: SVGAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, ews-watchlist, fmalita, gyuyoung.kim, mathias, mmaxfield, pdr, sabouhallawa, sam, schenney, sergio, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
test case showing either a red background (fail) or a green background (pass)
none
test case with simpler workaround
none
Patch none

Description Mathias Bynens 2020-08-18 02:09:27 PDT
Created attachment 406774 [details]
test case showing either a red background (fail) or a green background (pass)

This SVG filter definition doesn't have an effect, because Safari apparently cannot handle the newline characters in the `values` attribute value:

  <filter id="f">
    <feColorMatrix values="
      0 0 0 0 0
      1 1 1 0 0
      0 0 0 0 0
      0 0 0 1 0">
  </filter>

Rewriting the attribute value without any newlines (or dynamically updating the attribute value via JS, as done in the attached test case) causes the filter to work as expected:

  <filter id="f">
    <feColorMatrix values="0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0">
  </filter>

Please support newlines in `<feColorMatrix values>`.
Comment 1 Mathias Bynens 2020-08-18 02:19:03 PDT
Created attachment 406775 [details]
test case with simpler workaround
Comment 2 Mathias Bynens 2020-08-18 02:20:32 PDT
Turns out only the leading newline is problematic. The other newlines don’t need to be removed.

Rewriting

  <filter id="f">
    <feColorMatrix values="
      0 0 0 0 0
      1 1 1 0 0
      0 0 0 0 0
      0 0 0 1 0">
  </filter>

as

  <filter id="f">
    <feColorMatrix values="0 0 0 0 0
                           1 1 1 0 0
                           0 0 0 0 0
                           0 0 0 1 0">
  </filter>

…is a sufficient workaround.
Comment 3 Radar WebKit Bug Importer 2020-08-25 02:10:17 PDT
<rdar://problem/67726601>
Comment 4 Said Abou-Hallawa 2020-08-26 12:32:35 PDT
Created attachment 407320 [details]
Patch
Comment 5 Sam Weinig 2020-08-26 14:45:17 PDT
Comment on attachment 407320 [details]
Patch

Nice. Our whitespace ignoring for SVG is quite odd, glad to see we improving on inconsistencies here.
Comment 6 EWS 2020-08-26 17:06:35 PDT
Committed r266206: <https://trac.webkit.org/changeset/266206>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 407320 [details].