<?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>112717</bug_id>
          
          <creation_ts>2013-03-19 10:53:53 -0700</creation_ts>
          <short_desc>CSS reference (SVG) filters aren&apos;t rendered at the correct resolution with device scale, page scale or zooming</short_desc>
          <delta_ts>2022-10-05 12:35:23 -0700</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>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>68469</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter>sugoi</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>aigner.erik</cc>
    
    <cc>dino</cc>
    
    <cc>krit</cc>
    
    <cc>sabouhallawa</cc>
    
    <cc>senorblanco</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>steffen.weber</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>858469</commentid>
    <comment_count>0</comment_count>
    <who name="">sugoi</who>
    <bug_when>2013-03-19 10:53:53 -0700</bug_when>
    <thetext>SVG filters aren&apos;t zoomed properly when used within CSS. Here are 3 cases to illustrate the problem, the first 2 cases work and the 3rd one fails.

Case 1 - CSS :

HTML code :
&lt;img style=&quot;-webkit-filter:blur(10px)&quot; src=&quot;resources/reference.png&quot;&gt;

What happens:
We create a BlurFilterOperation object and scale its values in StyleResolver::createFilterOperations() using the zoomFactor which is applied when calling convertToFloatLength(). The behavior is good.

Case 2 - SVG :

HTML code :
&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; version=&quot;1.1&quot; width=160 height=300&gt;
  &lt;defs&gt;
    &lt;filter id=&quot;f1&quot;&gt;
      &lt;feGaussianBlur in=&quot;SourceGraphic&quot; stdDeviation=&quot;10&quot;/&gt;
    &lt;/filter&gt;
  &lt;/defs&gt;
  &lt;image x=&quot;0&quot; y=&quot;0&quot; width=&quot;160px&quot; height=&quot;90px&quot; xlink:href=&quot;resources/reference.png&quot; filter=&quot;url(#f1)&quot;/&gt;
&lt;/svg&gt;

What happens :
We create a SVGFilter object and use SVGFilter::applyHorizontalScale() and SVGFilter::applyVerticalScale() to apply the zoom factor. The behavior is good.

Case 3 - SVG within CSS :

HTML code :
&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; version=&quot;1.1&quot; width=&quot;0&quot; height=&quot;0&quot;&gt;
  &lt;defs&gt;
    &lt;filter id=&quot;f1&quot;&gt;
      &lt;feGaussianBlur stdDeviation=&quot;10&quot;/&gt;
    &lt;/filter&gt;
  &lt;/defs&gt;
&lt;/svg&gt;
&lt;img style=&quot;-webkit-filter: url(#f1); filter: url(#f1);&quot; src=&quot;resources/reference.png&quot;&gt;

What happens :
We create a SVG Filter inside a CSS. This does not create a SVGFilter object, but creates the base class Filter object instead (It creates a REFERENCE filter operation within FilterEffectRenderer::build()). Since the base class functions Filter::applyHorizontalScale() and Filter::applyVerticalScale() have no information about the zoom, the blur kernel size is not scaled and the behavior is wrong.

Blur is just an example. All filters that require an adjustment for the zoom factor are most likely also wrong.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>858501</commentid>
    <comment_count>1</comment_count>
    <who name="Dirk Schulze">krit</who>
    <bug_when>2013-03-19 11:13:09 -0700</bug_when>
    <thetext>Your observation is correct. Authors can define the resolution of the SVG Filter according to the spec. But this is not the only reason for setting m_filterResolution in Filter.h


Filtered elements can have transforms on it, which could increase the element size (transform=&quot;scale(2)&quot;). The image for this element must be bigger to cover the bigger resolution. Both things, filter resolution and element resolution are set with:

    // Set the scale level in SVGFilter.
    filterData-&gt;filter-&gt;setFilterResolution(scale);

in RenderSVGResourceFilter (scale is  a FloatSize here).

Since CSS does not use RenderSVGResourceFilter, the CSS code must do this step on it&apos;s own. I assume that this is not the case at the moment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>859631</commentid>
    <comment_count>2</comment_count>
    <who name="Dirk Schulze">krit</who>
    <bug_when>2013-03-20 13:04:12 -0700</bug_when>
    <thetext>*** Bug 93471 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>859642</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2013-03-20 13:20:01 -0700</bug_when>
    <thetext>Tried to improve the title. Please fix if it&apos;s inaccurate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>859657</commentid>
    <comment_count>4</comment_count>
    <who name="Stephen White">senorblanco</who>
    <bug_when>2013-03-20 13:31:43 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; *** Bug 93471 has been marked as a duplicate of this bug. ***

I don&apos;t think this is exactly the same problem as 93471, since this problem applies only to SVG filters within CSS, not the CSS shorthand filters.

CSS (shorthand) filters don&apos;t exhibit the offset problems Alexis describes.  They are Case 1 above.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1903498</commentid>
    <comment_count>5</comment_count>
      <attachid>462815</attachid>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2022-10-05 12:31:09 -0700</bug_when>
    <thetext>Created attachment 462815
test case (open and zoom in)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1903503</commentid>
    <comment_count>6</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2022-10-05 12:35:23 -0700</bug_when>
    <thetext>I think this bug has been fixed a while ago.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>462815</attachid>
            <date>2022-10-05 12:31:09 -0700</date>
            <delta_ts>2022-10-05 12:31:09 -0700</delta_ts>
            <desc>test case (open and zoom in)</desc>
            <filename>test-svg-zoom.html</filename>
            <type>text/html</type>
            <size>345</size>
            <attacher name="Said Abou-Hallawa">sabouhallawa</attacher>
            
              <data encoding="base64">PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lk
dGg9IjAiIGhlaWdodD0iMCI+CiAgPGRlZnM+CiAgICA8ZmlsdGVyIGlkPSJmMSI+CiAgICAgIDxm
ZURyb3BTaGFkb3cgZHg9IjE2IiBkeT0iMTYiIHN0ZERldmlhdGlvbj0iMCIgZmxvb2QtY29sb3I9
ImJsYWNrIi8+CiAgICA8L2ZpbHRlcj4KICA8L2RlZnM+Cjwvc3ZnPgo8ZGl2IHN0eWxlPSJwb3Np
dGlvbjogZml4ZWQ7IHRvcDogMTAwcHg7IGxlZnQ6IDEwMHB4OyB3aWR0aDogMTAwcHg7IGhlaWdo
dDogMTAwcHg7IGJhY2tncm91bmQtY29sb3I6IGdyZWVuOyBmaWx0ZXI6IHVybCgjZjEpOyI+PC9k
aXY+
</data>

          </attachment>
      

    </bug>

</bugzilla>