<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>225120</bug_id>
          
          <creation_ts>2021-04-27 13:19:51 -0700</creation_ts>
          <short_desc>SVG filter is applied twice when applied to the root &lt;svg&gt; element</short_desc>
          <delta_ts>2023-11-29 12:22:31 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>SVG</component>
          <version>Safari 14</version>
          <rep_platform>Mac (Intel)</rep_platform>
          <op_sys>macOS 11</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=260152</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=265465</see_also>
          <bug_file_loc>https://codepen.io/xiaolong-li/pen/YzNMZpM</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>260152</blocked>
    
    <blocked>262180</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Xiaolong Li">lxlstudent</reporter>
          <assigned_to name="Kiet Ho">kiet.ho</assigned_to>
          <cc>dino</cc>
    
    <cc>kiet.ho</cc>
    
    <cc>sabouhallawa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1754757</commentid>
    <comment_count>0</comment_count>
    <who name="Xiaolong Li">lxlstudent</who>
    <bug_when>2021-04-27 13:19:51 -0700</bug_when>
    <thetext>The issue happens when defining a filter inside an &lt;svg&gt; element and directly reference/apply it on the &lt;svg&gt; element itself. In this case, Safari seems to &quot;over-apply&quot; the effect, and one guess is that it may have applied the effect twice.

This issue doesn&apos;t appear in Chrome or Firefox. I also checked SVG spec and this is a legal structure.

If I move the filter attribute to a sub-element of the &lt;svg&gt;, then it works correctly.

Here is an example in CodePen demonstrating this. Opening it in Safari/Firefox/Chrome to see the difference: https://codepen.io/xiaolong-li/pen/YzNMZpM

I found an existing bug (https://bugs.webkit.org/show_bug.cgi?id=139281) that may be related to this, but not sure.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1756644</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-05-04 13:20:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/77522728&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1960114</commentid>
    <comment_count>2</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2023-06-06 13:21:08 -0700</bug_when>
    <thetext>This is correct. When the SVGFilter is applied to the &lt;svg&gt; root element, it is applied as an SVGFilter and it is also applied as CSSFilter referencing this SVGFilter.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1960118</commentid>
    <comment_count>3</comment_count>
      <attachid>466605</attachid>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2023-06-06 13:22:04 -0700</bug_when>
    <thetext>Created attachment 466605
reduced test case</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1960582</commentid>
    <comment_count>4</comment_count>
    <who name="Kiet Ho">kiet.ho</who>
    <bug_when>2023-06-08 11:22:18 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/14780</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1961408</commentid>
    <comment_count>5</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-06-13 14:26:57 -0700</bug_when>
    <thetext>Committed 265135@main (0dac14ca10cb): &lt;https://commits.webkit.org/265135@main&gt;

Reviewed commits have been landed. Closing PR #14780 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1961502</commentid>
    <comment_count>6</comment_count>
    <who name="Kiet Ho">kiet.ho</who>
    <bug_when>2023-06-13 23:42:09 -0700</bug_when>
    <thetext>*** Bug 139281 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>466605</attachid>
            <date>2023-06-06 13:22:04 -0700</date>
            <delta_ts>2023-06-06 13:22:04 -0700</delta_ts>
            <desc>reduced test case</desc>
            <filename>test-filter-svg.html</filename>
            <type>text/html</type>
            <size>537</size>
            <attacher name="Said Abou-Hallawa">sabouhallawa</attacher>
            
              <data encoding="base64">PGRpdj4KICAgVGhpcyB3b3JrcyBjb3JyZWN0bHkuCjwvZGl2Pgo8c3ZnPgogICA8ZmlsdGVyIGlk
PSJmYWRlIj4KICAgICAgPGZlQ29tcG9uZW50VHJhbnNmZXI+CiAgICAgICAgIDxmZUZ1bmNBIHR5
cGU9InRhYmxlIiB0YWJsZVZhbHVlcz0iMCAwLjYiLz4KICAgICAgPC9mZUNvbXBvbmVudFRyYW5z
ZmVyPgogICA8L2ZpbHRlcj4KICAgPHJlY3Qgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9
ImdyZWVuIiBmaWx0ZXI9InVybCgjZmFkZSkiPgo8L3N2Zz4KCjxkaXY+CiAgIFRoaXMgZG9lcyBu
b3Qgd29yayBjb3JyZWN0bHkuCjwvZGl2Pgo8c3ZnIGZpbHRlcj0idXJsKCNmYWRlKSI+CiAgIDxm
aWx0ZXIgaWQ9ImZhZGUiPgogICAgICA8ZmVDb21wb25lbnRUcmFuc2Zlcj4KICAgICAgICAgPGZl
RnVuY0EgdHlwZT0idGFibGUiIHRhYmxlVmFsdWVzPSIwIDAuNiIvPgogICAgICA8L2ZlQ29tcG9u
ZW50VHJhbnNmZXI+CiAgIDwvZmlsdGVyPgogICA8cmVjdCB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEw
MCIgZmlsbD0iZ3JlZW4iPgo8L3N2Zz4K
</data>

          </attachment>
      

    </bug>

</bugzilla>