<?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>133150</bug_id>
          
          <creation_ts>2014-05-21 01:58:59 -0700</creation_ts>
          <short_desc>REGRESSION transform-origin doesn&apos;t take zoom into account correctly for SVG content</short_desc>
          <delta_ts>2024-09-17 06:39:50 -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>DUPLICATE</resolution>
          <dup_id>194903</dup_id>
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=258615</see_also>
          <bug_file_loc>http://jsfiddle.net/cpkSp/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Dirk Schulze">krit</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>fotis.papadogeorgopoulos</cc>
    
    <cc>fujii</cc>
    
    <cc>govett</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1010723</commentid>
    <comment_count>0</comment_count>
    <who name="Dirk Schulze">krit</who>
    <bug_when>2014-05-21 01:58:59 -0700</bug_when>
    <thetext>In the following fiddle, the transform-origin doesn&apos;t apply the value of the zoom property (or CMD+/CMD-) correctly. It seems that the origin stays at the same position as without zoom.

Note: it works correctly in Safari 7. I don&apos;t know the regression window yet. Must be a problem in 2013 or earlier though.

http://jsfiddle.net/cpkSp/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1010724</commentid>
    <comment_count>1</comment_count>
    <who name="Dirk Schulze">krit</who>
    <bug_when>2014-05-21 02:02:17 -0700</bug_when>
    <thetext>Additional information: This problem just occurs for percentage values. Pixel values are scaled correctly. Which, on the other hand, doesn&apos;t work correctly in Safari 7.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1923857</commentid>
    <comment_count>2</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-01-07 15:26:25 -0800</bug_when>
    <thetext>It is still happening in Safari 16.2 &amp; STP160 using JSFiddle from Comment 0 and it is fixed in following commit by Blink:

Commit - https://src.chromium.org/viewvc/blink?view=revision&amp;revision=174907

WebKit Source - https://searchfox.org/wubkat/source/Source/WebCore/svg/SVGGraphicsElement.cpp#98

There are fixes in LBSE so I don&apos;t know whether it is already fixed in LBSE or not? Appreciate if @Nikolaz can confirm. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1955294</commentid>
    <comment_count>3</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-05-14 03:32:44 -0700</bug_when>
    <thetext>(In reply to Ahmad Saleem from comment #2)
&gt; It is still happening in Safari 16.2 &amp; STP160 using JSFiddle from Comment 0
&gt; and it is fixed in following commit by Blink:
&gt; 
&gt; Commit - https://src.chromium.org/viewvc/blink?view=revision&amp;revision=174907
&gt; 
&gt; WebKit Source -
&gt; https://searchfox.org/wubkat/source/Source/WebCore/svg/SVGGraphicsElement.
&gt; cpp#98
&gt; 
&gt; There are fixes in LBSE so I don&apos;t know whether it is already fixed in LBSE
&gt; or not? Appreciate if @Nikolaz can confirm. Thanks!

I applied this locally and this does fix the attached test case but the attached testcase with the commit does not work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2035588</commentid>
    <comment_count>4</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-05-15 11:34:26 -0700</bug_when>
    <thetext>Blink Commit (from GitHub Repo - Chromium) - https://github.com/chromium/chromium/commit/56ca23de0ae12871406e53753d71c2237551ac24</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2035659</commentid>
    <comment_count>5</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-05-15 16:11:14 -0700</bug_when>
    <thetext>// Honor any of the transform-related CSS properties if set.
    if (hasSpecifiedTransform || (style &amp;&amp; (style-&gt;translate() || style-&gt;scale() || style-&gt;rotate()))) {
        TransformationMatrix transform;
        float zoom = style-&gt;usedZoom();

        // CSS transforms operate with pre-scaled lengths. To make this work with SVG
        // (which applies the zoom factor globally, at the root level) we
        //
        //   * pre-scale the bounding box (to bring it into the same space as the other CSS values)
        //   * invert the zoom factor (to effectively compute the CSS transform under a 1.0 zoom)
        //
        
        // Note: objectBoundingBox is an emptyRect for elements like pattern or clipPath.
        // See the &quot;Object bounding box units&quot; section of http://dev.w3.org/csswg/css3-transforms/
        if (zoom != 1) {
            FloatRect scaledBBox = renderer-&gt;transformReferenceBoxRect();
            scaledBBox.scale(zoom);
            transform.scale(1 / zoom);
            style-&gt;applyTransform(transform, TransformOperationData(scaledBBox, renderer.get()));
            transform.scale(zoom);
        } else
            style-&gt;applyTransform(transform, TransformOperationData(renderer-&gt;transformReferenceBoxRect(), renderer.get()));

___

This compiles and fix attach test case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2060587</commentid>
    <comment_count>6</comment_count>
    <who name="Devon Govett">govett</who>
    <bug_when>2024-09-16 16:13:33 -0700</bug_when>
    <thetext>Just ran into this too. Ahmad, did you submit a PR with your patch?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2060592</commentid>
    <comment_count>7</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2024-09-16 16:40:03 -0700</bug_when>
    <thetext>281265@main fixed the problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2060597</commentid>
    <comment_count>8</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2024-09-16 16:47:41 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 194903 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2060621</commentid>
    <comment_count>9</comment_count>
    <who name="Devon Govett">govett</who>
    <bug_when>2024-09-16 17:35:47 -0700</bug_when>
    <thetext>Oh thanks! I can verify that it is fixed in the latest Safari tech preview.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2060758</commentid>
    <comment_count>10</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-09-17 06:39:50 -0700</bug_when>
    <thetext>(In reply to Devon Govett from comment #9)
&gt; Oh thanks! I can verify that it is fixed in the latest Safari tech preview.

I think Fuji fixed it and you should test on Safari Technology Preview. Only bit missing would be SVG text but I haven&apos;t test it yet.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>