<?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>264752</bug_id>
          
          <creation_ts>2023-11-13 10:03:53 -0800</creation_ts>
          <short_desc>Negative SVGTransform scale values should be correctly stringified</short_desc>
          <delta_ts>2024-01-29 19:51:10 -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>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=267401</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BrowserCompat, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ahmad Saleem">ahmad.saleem792</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>karlcow</cc>
    
    <cc>sabouhallawa</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1992152</commentid>
    <comment_count>0</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-11-13 10:03:53 -0800</bug_when>
    <thetext>Hi Team,

While going through Blink&apos;s commit, I came across another failing test case:

Test Case: https://jsfiddle.net/7nqg2L01/show

^ Firefox Nightly 121:

FAIL g.getAttribute(&apos;transform&apos;) should be scale(-2 -4). Was scale(-2, -4).

^ Chrome Canary 121:

PASS g.getAttribute(&apos;transform&apos;) is &quot;scale(-2 -4)&quot;

^ Safari Technology Preview 182 (Don&apos;t show negative):

FAIL g.getAttribute(&apos;transform&apos;) should be scale(-2 -4). Was scale(2 4).

___

Blink Commit: https://chromium.googlesource.com/chromium/blink/+/8a7252a2602bd8067c83d48c8fd525ef322708c2

Just wanted to raise, so we can fix it.

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1993945</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-11-20 10:04:14 -0800</bug_when>
    <thetext>&lt;rdar://problem/118656892&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1994038</commentid>
    <comment_count>2</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2023-11-20 18:08:04 -0800</bug_when>
    <thetext>There are potentially two different issues 
* negative to positive number
* serialization with/without comma
as the 3 browsers return something different. 



         IN             OUT
Safari:  scale(-2, -4)  scale(2 4).   No comma, positive numbers
Firefox: scale(-2, -4)  scale(-2, -4) Comma, negative numbers
Chrome:  scale(-2, -4)  scale(-2 -4)  No comma, negative numbers

I have the feeling that Firefox is right here for the comma.
https://drafts.csswg.org/css-transforms/#funcdef-transform-scale
I didn&apos;t find a reference why it should be serialize differently, aka without the comma. 


But WebKit definitely needs to return negative numbers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1994039</commentid>
    <comment_count>3</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2023-11-20 18:09:47 -0800</bug_when>
    <thetext>The test:

var svg = document.createElementNS(&apos;http://www.w3.org/2000/svg&apos;, &apos;svg&apos;);
var g = document.createElementNS(&apos;http://www.w3.org/2000/svg&apos;, &apos;g&apos;);
var transform = svg.createSVGTransform();
transform.setScale(-2, -4);
g.transform.baseVal.appendItem(transform)
g.getAttribute(&apos;transform&apos;)


​</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2003427</commentid>
    <comment_count>4</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-01-06 17:51:27 -0800</bug_when>
    <thetext>We need to update this:

https://searchfox.org/wubkat/rev/c22ca98693565713efde37e8311190dd00e165ef/Source/WebCore/svg/SVGTransformValue.h#267

void appendScale(StringBuilder&amp; builder) const
    {
        appendFixedPrecisionNumbers(builder, m_matrix-&gt;value().xScale(), m_matrix-&gt;value().yScale());
    }

TO:

void appendScale(StringBuilder&amp; builder) const
    {
        appendFixedPrecisionNumbers(builder, m_matrix-&gt;a(), m_matrix-&gt;d());
    }

__

Compiles and make us pass but match &apos;Chrome&apos;.

As for &apos;,&apos; issue highlighted in Comment 02. I think it might be &apos;Parser&apos; issue? I am happy to fix this and then have separate bug to discuss &apos;,&apos; issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2003428</commentid>
    <comment_count>5</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-01-06 18:03:16 -0800</bug_when>
    <thetext>Draft PR - https://github.com/WebKit/WebKit/pull/22475

To see if it fails anything else on EWS. :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2004324</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-01-10 21:17:24 -0800</bug_when>
    <thetext>Committed 272885@main (2efdea0ba354): &lt;https://commits.webkit.org/272885@main&gt;

Reviewed commits have been landed. Closing PR #22475 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>