[webkit-dev] Question about return values of RenderObject:localToAbsolute()

Lucius Fox lucius.fox08 at gmail.com
Tue Jun 9 23:57:30 PDT 2009


On Tue, Jun 9, 2009 at 11:38 PM, xunxin<wanxunxin at gmail.com> wrote:
>
>
> On Wed, Jun 10, 2009 at 1:47 PM, Lucius Fox <lucius.fox08 at gmail.com> wrote:
>>
>> Hi,
>>
>> I use the dumpRenderTree to dump out the absolute co-ordinates of the
>> Render Tree of www.google.com. I put the absolute x, y result at the
>> end marked by "{" and "}".
>> And www.google.com, the first text is 'Web" followed by "Images"
>> followed by "Video" followed by "Maps".
>>
>> But what I don't understand is (from the output below), all the
>> absolute coordinates of those text are x = 8.0 and y = 3.0.  But
>> visually, they are next to each other horizontally. So the y values
>> should be the same but the x values should be different.  Can someone
>>
>> please help me understand the result?
>
> You need add renderText's relative x. such as:
>
>         IntRect linesBox = text->linesBoundingBox();
>         FloatPoint absPos = text->localToAbsolute();
>         int posX = lineBox.x() + absPos.x();
>         int posY = lineBox.y() + absPos.y();
>
>
Thank you. But why all the RenderText's parent (which is RenderInline)
all have absolute x = 8 and absolute y = 3?

Thank you for any explanation.

>


More information about the webkit-dev mailing list