[Project_owners] getting the visible range of an html doc?
sabetts at vcn.bc.ca
Wed Oct 20 20:00:07 EDT 2004
"Todd Ross" <todd at brainsick.com> writes:
> > Shawn Betts <sabetts at vcn.bc.ca> writes:
> > So, instead I could perform the search and get the rectangle
> > containing startContainer endContainer and see if either is visible
> > (compare rect coords with the window's scrollX, scrollY). I KNOW a
> > node's bounding rectangle can be found because the DOM Inspector
> > flashes it. But it seems the inspector uses it's own flasher module
> > that's written in C++.
> > Is there a way to get this bounding rectangle from XUL? Or will I
> > have to hack C++ to do it?
> Adblock also flashes the elements in the window. It might be worth
> checking out how they do it. Just a thought.
I maybe found a way to do it.
nsIAccessible has a function getBounds:
void getBounds ( out PRInt32 x , out PRInt32 y , out PRInt32 width , out PRInt32 height )
But the problem is this 'out' thing. I thot JS can't do pass by
reference. How do I call getBounds? All I've been able to do is get an
error saying it expects an object as arguments:
var acc_serv = Components.classes["@mozilla.org/accessibilityService;1"]
var acc = acc_serv.getAccessibleFor(node);
alert(x + " " + y + " " + w + " " + h);
I tried passing in arrays instead:
but the array doesn't get filled with anything. Is 'out' some kind of
More information about the Project_owners