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

TianShijun tiansjun at hotmail.com
Wed Aug 12 20:26:44 PDT 2009

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?

CC: webkit-dev at lists.webkit.org
From: simon.fraser at apple.com
To: tiansjun at hotmail.com
Subject: Re: [webkit-dev] How to get the background image of a node?
Date: Wed, 12 Aug 2009 08:55:53 -0700

This is really a question for the webkit-help list.
The solution is to call getComputedStyle().
On Aug 12, 2009, at 8:52 AM, TianShijun wrote:How can i get the background-image url of an  element node? 

Usually, I can read the "background-image" attribute of the node. But if it is written 
in the style sheet, there is no explicit "background-image" attribute in the element's 
attributes list. Instead, there is a "class" attribute.

I have also tried to get some information from RenderStyle. But it can only provide an
interface hasBackgroundImage() .  

How can I get it? It seems not to be an elegant way that we firstly read the style class
abtribute and then parse the style sheet file. Could WebKit provides an expandedAttributes()
interface which can return all the attributes by simply expanding the class attribute with 
those written in the style sheet?

您可以借助 Windows Live 整理、编辑和共享您的照片。
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090813/acc80099/attachment.html>

More information about the webkit-dev mailing list