mark kaplun wrote:
"Benjamin D. Smedberg" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
mark kaplun wrote: > Benjamin Smedberg wrote:
QI the object to nsISVGValue. That is a pseudo-interface implemented by nsSVGMatrix that a JS object can't implement.
Please don't do it this way. IIRC when xpconnect wrap the JS object it
first
ensures that the JS object implements all of the reqired interfaces, so
QI
What "required interfaces"? The only thing that xpconnect ensures is that the JS object implements nsIDOMSVGMatrix, which is not enough... we want to ensure that we are passed *our implementation* of nsIDOMSVGMatrix.
will probably not help you to know if the object is a C++ or JS object.
In
JS objects cannot implement nsISVGValue, because that pseudo-interface is declared in a C++ .h file, not in an .idl file, so there is no typelib information for xpconnect to use to proxy the interface.
any case I think that you should not limit the ability to call setMatrix from JS unless you redefine the function as a nonscript one in the IDL
file.
It's part of the DOM, it can't be [noscript]. The goal is not to limit who can call setMatrix, but to sanity-check the parameters.
--BDS
I think that I get what you are trying to do, but I still have a question. How do I create a new matrix in JS? (I failed to find a way in LXR but maybe it is just me).
To create a new SVGMatrix use createSVGMatrix() on an SVGSVGElement. See: http://lxr.mozilla.org/seamonkey/source/content/svg/content/src/nsSVGSVGElement.cpp#715
Side note: looking at the matrix IDL I don't see why it should be created only at C++ as there is no aperent link to a DOM node or attribute.
It is to prevent things like SVGTransform.setMatrix({}) etc.
Side note two: There are places in the code http://lxr.mozilla.org/seamonkey/source/content/svg/content/src/nsSVGPoint.cpp#104 that currently check only that the matrix being passed is not null.
Yes, the checks will have to be extended to all these locations, not just for SetMatrix().
Sorry for being annoying, Mark.
heh, well it was useful for me. That has cleared up some terminology and how things work.
Thanks guys,
Jonathan _______________________________________________ Mozilla-xpcom mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-xpcom
