Open Bug 756985 Opened 12 years ago Updated 2 years ago

getCTM() always returns null for parsed SVG before drawing

Categories

(Core :: SVG, defect)

10 Branch
x86
Linux
defect

Tracking

()

UNCONFIRMED

People

(Reporter: eweitnauer, Unassigned)

Details

Attachments

(2 files)

Attached file test4.html
User Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Ubuntu/10.04 Chromium/12.0.742.91 Chrome/12.0.742.91 Safari/534.30

Steps to reproduce:

I use DOMParser to parse an SVG image from a string. In the resulting DOM tree, I select a circle element and call getCTM() on it.


Actual results:

It returns null.


Expected results:

It should return an SVGMatrix.

Only after I display the parsed SVG, the getCTM() method returns an SVGMatrix. It should be possible to use the method without / before displaying the SVG.
Component: Untriaged → SVG
Product: Firefox → Core
QA Contact: untriaged → general
Attachment #625580 - Attachment mime type: text/plain → text/html
If you don't want the SVG to be visible then make it visibility="hidden" that will work for you unlike display="none".

If the SVG is not attached then the outer SVG element has a width and height of 100% which is 100% of zero since there's nothing to size it against.
(In reply to Robert Longson from comment #1)
> If you don't want the SVG to be visible then make it visibility="hidden"
> that will work for you unlike display="none".
> 
> If the SVG is not attached then the outer SVG element has a width and height
> of 100% which is 100% of zero since there's nothing to size it against.

For me, both visibility=hidden and display=none (either on the svg element itself or on a container div) keep Firefox 10 from showing the SVG. However, in both cases, calling getCTM() will return null instead of an SVGMatrix. If this is different for you could you please attach an example file?
It works for me, too. I mixed things up in my last post, sorry. This is a valid and simple workaround for the problem.

Still, shouldn't it be possible to use getCTM() on the parsed SVG without attaching it to the main document? (Setting the width and height of the unattached SVG to a fixed number of pixels makes no difference)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: