[webkit-help] Get src and element from render object in dump tree

Julien Chaffraix julien.chaffraix at gmail.com
Tue Apr 13 08:46:07 PDT 2010


On Sat, Apr 10, 2010 at 1:44 PM, Lihuan Xie <asuratse at hotmail.com> wrote:
> Is the question too stupid...?

No. Please refrain yourself from pinging the mailing list after one
day. Our involvement on the mailing list is on a volunteer basis and
as such there will be a delay in the answer.

[snipped DRT dump]
> I would like to know how could I inspect and access the element member in
> each of the render object?

The render tree is a tree so you can traverse it using the method in

If you are asking about how to do that in DRT, you will want to have a
look at WebCore/rendering/RenderTreeAsText.cpp and override the
behaviour there.

> Like, how can I get the image object and the src from RenderImage?

You will use the node() method from the RenderObject and get back your
Node (an HTMLImageElement in this case). You need to cast it back to
the right type so that you can query its src() method (have a look
around the code). Untested code to do the casting in case of a

Node* img = renderImage->node();
if (!img || !img->hasTagName(HTMLNames::imgTag ||
HTMLImageElement* imageElement = static_cast<HTMLImageElement>(img);


More information about the webkit-help mailing list