[webkit-dev] How to get the background image of a node?

Ryosuke Niwa rniwa at google.com
Wed Aug 12 22:19:11 PDT 2009


2009/8/12 TianShijun <tiansjun at hotmail.com>

>  Hi Simon,
> I cannot find this method in either Node.h or RenderStyle.h.
> I wonder that why we cannot get the attribute of an element node just by
> invoking some member function of the node?
>

Line 440 of Node.h
virtual RenderStyle* computedStyle();

This gives you renderStyle.  If you do position.computedStyle(), you'll
obtain CSSComputedStyleDeclaration.

A node could be anything, so you need to first check whether it's an HTML
element or not.  You can do so by calling node->isElementNode().

Once node->isElementNode() returned, true, you cast the node into Element
and call getAttribute there as in:
static_cast<Element*>(node)->getAttribute(qualifiedName)

*Please post the questions like this on webkit-help.*

Ryosuke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090812/27c340f5/attachment.html>


More information about the webkit-dev mailing list