[webkit-dev] How to interrupt Webkit Dump Render Tree output
tonikitoo (Antonio Gomes)
tonikitoo at gmail.com
Wed Jun 10 13:58:35 PDT 2009
On Mon, Jun 1, 2009 at 1:31 PM, Simon Fraser<simon.fraser at apple.com> wrote:
> There is a method on RenderObject to get the correct absolute coordinates of
> the renderer, which correctly takes transforms, scrolling etc into account:
> RenderObject::localToAbsolute(). This is not a trivial problem.
localToAbsolute() is only "fragile" because if you are querying for
the position of a renderobject inside an iframe, it is not relative to
mainFrame but to the currentFrame. I've done it like below:
static inline IntRect absoluteRenderRect(RenderObject* render)
{
ASSERT(render);
// FIXME: This function is flawed because it doesn't consider the
effects of CSS or SVG transforms.
IntRect rect(render->absoluteClippedOverflowRect());
// handle nested frames.
for (Frame* frame = render->document()->frame(); frame; frame =
frame->tree()->parent())
if(HTMLFrameOwnerElement* ownerElement = frame->ownerElement())
rect.move(ownerElement->renderer()->offsetLeft(),
ownerElement->renderer()->offsetTop());
return rect;
}
maybe there is a better way , but ...
--
--Antonio Gomes
More information about the webkit-dev
mailing list