Hello Eric,
To get the style you can use RenderStyle object :
RefPtr<RenderStyle> style = pNode->styleForRenderer();
RenderStyle* displayStyle = style.get();
Now with the help of displayStyle you can get the things you want.
Regards,
Umesh
On Mon, Nov 8, 2010 at 2:03 PM, Eric Zhou <[email protected]> wrote:
> Hi all,
>
> Safari provides a function "Inspect element". We could get the style
> information from "computed Style" section.
>
> Could someone show me some code to get this "computed style"?
>
> I tried to get the style information from an element's RenderObject like
> this
>
> int width = render->style()->width().rawValue();
> int height = render->style()->height().rawValue();
> int left = render->style()->left().rawValue();
> int top = render->style()->top().rawValue();
>
> But most integers I got are zero. For example,
>
> <div id="d1" width=100>
> <div id="d2" >
> </div>
>
> From my code, the width of d1 is 100, but the width of d2 is zero.
> From safari's "Inspect element"-->"computed Style", the width of d2 is 100.
>
> How can I get the Computed Style?
>
> Thanks!
>
> _______________________________________________
> webkit-help mailing list
> [email protected]
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-help
>
>
_______________________________________________
webkit-help mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-help