[webkit-dev] How to interrupt Webkit Dump Render Tree output

Lucius Fox lucius.fox08 at gmail.com
Thu Jun 11 09:07:22 PDT 2009


On Wed, Jun 10, 2009 at 1:58 PM, tonikitoo (Antonio
Gomes)<tonikitoo at gmail.com> wrote:
> On Mon, Jun 1, 2009 at 1:31 PM, Simon Fraser<simon.fraser at apple.com> wrote:
>> There is a method on RenderObject to get the correct absolute coordinates of
>> the renderer, which correctly takes transforms, scrolling etc into account:
>> RenderObject::localToAbsolute(). This is not a trivial problem.
>
> localToAbsolute() is only "fragile" because if you are querying for
> the position of a renderobject inside an iframe, it is not relative to
> mainFrame but to the currentFrame. I've done it like below:
>
> static inline IntRect absoluteRenderRect(RenderObject* render)
> {
>    ASSERT(render);
>    // FIXME: This function is flawed because it doesn't consider the
> effects of CSS or SVG transforms.
>
>    IntRect rect(render->absoluteClippedOverflowRect());
>
>    // handle nested frames.
>    for (Frame* frame = render->document()->frame(); frame; frame =
> frame->tree()->parent())
>        if(HTMLFrameOwnerElement* ownerElement = frame->ownerElement())
>            rect.move(ownerElement->renderer()->offsetLeft(),
> ownerElement->renderer()->offsetTop());
>
>    return rect;
> }
>
>
> maybe there is a better way , but ...
>

Hi, I have tried using 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) is 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 you
please help me understand the result? And there is no iframe problem
the like you described.

Thank you.

Here is the output:

RenderInline {B} at (0,0) size 27x15 {8.00,3.00}
           RenderText {#text} at (0,1) size 27x15 {8.00,3.00}
             text run at (0,1) width 27: "Web"
         RenderText {#text} at (33,1) size 4x15 {8.00,3.00}
           text run at (33,1) width 4: " "
         RenderInline {A} at (0,0) size 43x15 [color=#0000CC] {8.00,3.00}
           RenderText {#text} at (37,1) size 43x15 {8.00,3.00}
             text run at (37,1) width 43: "Images"
         RenderText {#text} at (86,1) size 4x15 {8.00,3.00}
           text run at (86,1) width 4: " "
         RenderInline {A} at (0,0) size 33x15 [color=#0000CC] {8.00,3.00}
           RenderText {#text} at (90,1) size 33x15 {8.00,3.00}
             text run at (90,1) width 33: "Video"
         RenderText {#text} at (129,1) size 4x15 {8.00,3.00}
           text run at (129,1) width 4: " "
         RenderInline {A} at (0,0) size 32x15 [color=#0000CC] {8.00,3.00}
           RenderText {#text} at (133,1) size 32x15 {8.00,3.00}
             text run at (133,1) width 32: "Maps"
         RenderText {#text} at (171,1) size 4x15 {8.00,3.00}
           text run at (171,1) width 4: " "
         RenderInline {A} at (0,0) size 32x15 [color=#0000CC] {8.00,3.00}
           RenderText {#text} at (175,1) size 32x15 {8.00,3.00}
             text run at (175,1) width 32: "News"
         RenderText {#text} at (213,1) size 4x15 {8.00,3.00}
           text run at (213,1) width 4: " "
         RenderInline {A} at (0,0) size 54x15 [color=#0000CC] {8.00,3.00}
           RenderText {#text} at (217,1) size 54x15 {8.00,3.00}
             text run at (217,1) width 54: "Shopping"
         RenderText {#text} at (277,1) size 4x15 {8.00,3.00}
           text run at (277,1) width 4: " "
         RenderInline {A} at (0,0) size 34x15 [color=#0000CC] {8.00,3.00}
           RenderText {#text} at (281,1) size 34x15 {8.00,3.00}
             text run at (281,1) width 34: "Gmail"
         RenderText {#text} at (321,1) size 4x15 {8.00,3.00}
           text run at (321,1) width 4: " "
         RenderInline {A} at (0,0) size 44x15 [color=#0000CC] {8.00,3.00}
           RenderInline {U} at (0,0) size 29x15 {8.00,3.00}
             RenderText {#text} at (325,1) size 29x15 {8.00,3.00}
               text run at (325,1) width 29: "more"





> --
> --Antonio Gomes
>


More information about the webkit-dev mailing list