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

Jason Keirstead jason at keirstead.org
Tue Jan 11 20:55:49 GMT 2005


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?

-- 
If you wait by the river long enough, eventually
you will see the bodies of all your enemies float by.
    - Sun Tzu
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<




More information about the kfm-devel mailing list