Bug 51795

Summary: @transform not updated after changes are made to SVGTransformList
Product: WebKit Reporter: Andrew VanderVeen <avanderveen>
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: avanderveen, krit, zimmermann
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
SVGRectElement with setAttribute("transform", matrix) none

Andrew VanderVeen
Reported 2011-01-01 21:02:40 PST
This code doesn't seem to work in WebKit. someSVGElement.setAttribute("transform", "matrix(a,b,c,d,e,f)"); // a-f being matrix values See http://code.google.com/p/svg-edit/wiki/BrowserBugs#@transform_value_is_unreliable The shim they mention is here: http://www.google.com/codesearch/p?hl=en#daBrs4Do4Ko/trunk/editor/svgtransformlist.js
Attachments
SVGRectElement with setAttribute("transform", matrix) (545 bytes, image/svg+xml)
2011-05-22 08:25 PDT, Dirk Schulze
no flags
Andrew VanderVeen
Comment 1 2011-01-01 21:04:25 PST
This might be related to this bug: https://bugs.webkit.org/show_bug.cgi?id=31119
Dirk Schulze
Comment 2 2011-01-02 03:16:40 PST
Do you have a test case? According to the links you mentioned it should be fixed.
Andrew VanderVeen
Comment 3 2011-01-02 13:39:28 PST
Hmm, my example seems to use SVGAnimatedTransformList. The code where I originally ran into the problem yesterday is here: https://github.com/avanderveen/jSVG just download that and fire up i.html, try scrolling in the svg and nothing happens. There will be SVGAnimatedTransformLists logged to the console each time you scroll, but the 'g' element's transform property does not update. Here's the code (lines 26-30 in jsvg.js) where it fails: ... transMatrix = svgG.getCTM().multiply(transMatrix); var mtxStr = "matrix(" + transMatrix.a + "," + transMatrix.b + "," + transMatrix.c + "," + transMatrix.d + "," + transMatrix.e + "," + transMatrix.f + ")"; svgG.setAttribute("transform", mtxStr); // doesn't work in WebKit console.log($(svgG).attr("transform")); ... You'll see the SVGAnimatedTransformList logged in the console, but the update isn't reflected. I'm running Chromium 8.0.552.224 .. not sure which v. of WebKit that is, but it's up-to-date. I hope it's not just me doing something wrong here... if it is, my bad for reporting it as a bug.
Dirk Schulze
Comment 4 2011-05-22 08:24:30 PDT
You may misinterpret the results: <svg xmlns="http://www.w3.org/2000/svg" onload="run()"> <rect width="100" height="100" fill="red"/> <rect id="transform" width="50" height="50" fill="green"/> <script type="text/ecmascript"><![CDATA[ function run() { // Scale the second rect by factor 2 var rect = document.getElementById("transform"); rect.setAttribute("transform", "matrix(2,0,0,2,0,0)"); // Check if setAttribute influences SVGAnimatedTransformList var matrix = rect.transform.baseVal.getItem(0).matrix; console.log("matrix("+matrix.a+","+matrix.b+","+matrix.c+","+ matrix.d+","+matrix.e+","+matrix.f+")"); } ]]></script> </svg> If it would not work, you'd see some red on the SVG and the output on the console wouldn't be 'matrix(2,0,0,2,0,0)'. But it works on all versions of webkit.
Dirk Schulze
Comment 5 2011-05-22 08:25:40 PDT
Created attachment 94343 [details] SVGRectElement with setAttribute("transform", matrix) Attache example of previous comment to the bug.
Dirk Schulze
Comment 6 2011-05-22 09:12:54 PDT
I added var g = document.getElementsByTagName("g")[0]; in your 'reframe' function and took g instead of svgG and this affects the visual output. I guess you made a wrong assumption. Nevertheless you seem to have more failures in your script. Right after scrolling all values turned to NaN. You should make sure that something like that never occurs before passing it to DOM.
Note You need to log in before you can comment on or make changes to this bug.