How to find rendered position of an HTMLElement (in C++, not JS)?

David Faure faure at kde.org
Tue Jan 11 21:41:46 GMT 2005


On Tuesday 11 January 2005 21:55, Jason Keirstead wrote:
> What I am looking for is a programmatic implimentation of offsetTop and 
> offsetLeft.
> 
> By browsing the KJS sources, I have discovered that it is getting these 
> properties through private KHTML API that I don't have access to:
> 
> khtml::RenderObject *rend = node.handle()->renderer();
> 
> switch (token) {
>     case OffsetLeft:
>       return rend ? static_cast<Value>( Number( rend->offsetLeft() ) ) : 
> Undefined();
>     case OffsetTop:
>       return rend ? static_cast<Value>(  Number( rend->offsetTop() ) ) : 
> 
> Is there any (non-javascript) way to get the rendered position of an HTML 
> element using public KHTML API? If not - why are these offset(*) properties 
> not added as public attributes of the HTMLElement class?

I guess they should. IMHO a patch that adds this to the DOM API (with a warning
that this isn't part of the DOM standard) should be accepted.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kfm-devel mailing list