[Project_owners] getting the visible range of an html doc?

Matthew Wilson matthew at mjwilson.demon.co.uk
Wed Oct 20 22:31:01 EDT 2004

Shawn Betts wrote:
> "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?

I think you want

"3) How do I use interface methods with 'out' parameters from JavaScript?"

Summary: pass "new Object()" and check the "value" field in the result.


More information about the Project_owners mailing list