[webkit-help] Function to know if an element is inline/Block/replaced/inlineblock/

Julien Chaffraix julien.chaffraix at gmail.com
Sat Mar 3 07:53:47 PST 2012


> I think style->display() might be the one you are looking for.

That would give part of the answer. replaced is not a valid value for
style for example but depends on the RenderObject's type.

> I am not sure if there is such a function, but if you are looking for
> something to help you in debugging, have a look at
> RenderObject::showRenderTree, which can easily be called from gdb.  It shows
> the object type of each node in the render tree.  I hope this is of some
> help to you,

Yes they are as we need those information internally. I concur that
showRenderTree is super useful to dig into the render tree.

>> I am trying to learn webkit, and i am little lost in trying to figure out
>> which element is inline/Block/replaced/inlineblock.
>>
>> Is there any function which will help to figure out what element it is?

You can know the type of renderer by calling renderName() on it. This
will give you the class name and (maybe) some information about
whether it's anonymous, generated...

Now the information about how you should behave (inline/block...) are
attached to RenderObject. Look for the isInline() / isRenderBlock() /
isReplaced() / ... methods.

Hope it helps,
Julien


More information about the webkit-help mailing list