Bug 215602 - Leading white spaces should be ignored when parsing an SVG list property
Summary: Leading white spaces should be ignored when parsing an SVG list property
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-08-18 02:09 PDT by Mathias Bynens
Modified: 2020-08-26 17:06 PDT (History)
13 users (show)

See Also:


Attachments
test case showing either a red background (fail) or a green background (pass) (697 bytes, text/html)
2020-08-18 02:09 PDT, Mathias Bynens
no flags Details
test case with simpler workaround (751 bytes, text/html)
2020-08-18 02:19 PDT, Mathias Bynens
no flags Details
Patch (55.49 KB, patch)
2020-08-26 12:32 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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].