Try this:
IntRect rect = static_cast<Element*>(node)->screenRect();
IntPoint p = m_page->chrome()->client()->screenToWindow(rect.x(), rect.y());

Which could return a coordinate relative viewport and has included scroll
offset.


>Message: 1
>Date: Mon, 05 Mar 2012 09:01:19 -0800
>From: Sam White <samuel_wh...@apple.com>
>To: webkit-help@lists.webkit.org
>Subject: [webkit-help] Computing clientX & clientY for a Node.
>Message-ID: <46ca0658-edec-4f37-9ce9-02008b8d9...@apple.com>
>Content-Type: text/plain; CHARSET=US-ASCII

>Hey WebKit,

>I'm trying to compute clientX & clientY for a Node in a way that is
relative to the viewport. So far I've only found the absoluteBoundingBoxRect
function on renderObject but the rect it returns is relative to the
>document. Any help with this would be great.

>Thanks
>Sam


_______________________________________________
webkit-help mailing list
webkit-help@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-help

Reply via email to