User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:18.104.22.168) Gecko/20061205 Iceweasel/22.214.171.124 (Debian-126.96.36.199+dfsg-1)
Build Identifier: Mozilla XULRunner 1.9a1
Setting currentScale apparently only has effect on svg documents.
If the svg fragment is embedded in another document (xhtml / xul), setting currentScale doesn't have any effect.
Steps to Reproduce:
Created attachment 250447 [details]
currentScale working on a svg document
currentScale working on a svg document
Created attachment 250448 [details]
Svg fragment in a xul document. Doesn't work...
*** Bug 371490 has been marked as a duplicate of this bug. ***
Still not fixed as of this date.
This problem also exists for the currentTranslate
Attempting work around using transform="matrix(...);"
as hinted by http://www.w3.org/TR/2004/WD-SVG12-20040318/svgudom.html using
2x3 matrix [a b c d e f] = [currentScale 0 0 currentScale currentTranslate.x currentTranslate.y].
*** Bug 487822 has been marked as a duplicate of this bug. ***
Fixing this requires that also SVGZoom event implementation is changed a bit.
Currently nsDOMSVGZoomEvent initializes its member variables in constructor using document's root element, but IMO
it would be better to have initSVGZoomEvent method.
So for that it might be good to add a new interface which nsDOMSVGZoomEvent implements.
interface nsIDOMNSSVGZoomEvent : nsIDOMSVGZoomEvent
void initSVGZoomEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in nsIDOMAbstractView viewArg,
in long detailArg,
in nsIDOMSVGRect zoomRectScreen,
in float previousScale,
in nsIDOMSVGPoint previousTranslate,
in float newScale,
in nsIDOMSVGPoint newTranslate);
Then SVGZoom event would be initialized using that method before dispatching.
And dispatching shouldn't depend on whether <svg> is the root element.
Though, I'm not quite sure why there is this
Btw, SVG1.1 definition for SVGZoom is pretty terrible.
What does this actually mean: "The zoom event handler occurs before the zoom event is processed."? I guess it should be more like: zoom is done before the event is dispatched.
And the context info for the event mentions clientX/Y, screenX/Y etc which are properties of MouseEvent, not UIEvent. Clearly something to fix in
SVG 1.1 errata. I'll write a mail to SVG WG.
(In reply to comment #6)
> Clearly something to fix in
> SVG 1.1 errata. I'll write a mail to SVG WG.
Ah, jwatt reported this to wg already long ago.
If we don't want to expose initSVGZoomEvent() to scripts,
nsIDOMNSSVGZoomEvent could be a non-scriptable interface.
My only concern is that in order for this zoom to work it's going to require a target. If the initSVGZoomEvent is not scriptable we have no way to specify a target. Currently svg zoom does not need a target node because it acts upon the root node however if we are going to change this then we need it to be able to be zoomable on any node. In order for that to happen we cannot have initSVGZoomEvent because we could not give it a target through create event. Having said that we would have to give it a target through dispatch and in order to capture that we need to have the listener.
That is what my comments are on the svg zoom situation.
(In reply to comment #9)
> My only concern is that in order for this zoom to work it's going to require a
You know the target when you dispatch the event to the <svg> element.
> If the initSVGZoomEvent is not scriptable we have no way to specify a
Being scriptable or not has nothing to do with target.
> Currently svg zoom does not need a target node because it acts upon the
> root node
No. The event is currently dispatched to <svg> element.
However, there is currently the
limitation, that it is dispatched only when <svg> is the root element.
That limitation is the thing you should remove.
> however if we are going to change this then we need it to be able to
> be zoomable on any node. In order for that to happen we cannot have
> initSVGZoomEvent because we could not give it a target through create event.
.initXXXEvent never sets the target. It happens when dispatchEvent is called.
And you know what the target is, because you call dispatchEvent.
> Having said that we would have to give it a target through dispatch and in
> order to capture that we need to have the listener.
You don't need to capture SVGZoom. It is web pages or similar which adds
listeners for the event. SVGZoom is dispatched after <svg> element is actually
Btw, SVG 1.1 has this:
"The zoom event occurs when the user initiates an action
which causes the current view of the SVG document fragment to be rescaled."
So the current, dispatch-svgzoom-always isn't quite right.