[webkit-dev] Fwd: hasStaticBlockPosition in RenderBlock::layoutPositionedObjects(bool relayoutChildren)

Sravan sra1sandela at gmail.com
Fri May 18 19:20:14 PDT 2012


Can some one please tell me who can clarify my doubts on Layout of
Positioned Objects, please?


---------- Forwarded message ----------
From: Sravan <sra1sandela at gmail.com>
Date: Fri, May 18, 2012 at 4:20 PM
Subject: hasStaticBlockPosition in
RenderBlock::layoutPositionedObjects(bool relayoutChildren)
To: webkit-help at lists.webkit.org

Hello WebKittens,


RenderBlock::layoutPositionedObjects(bool relayoutChildren)

following code is actually supposed to setChildNeedsLayout to only those
positioned objects. When a non-positioned block element moves, and might
have positioned children that are implicitly positioned relative to
the non-positioned block.

        // When a non-positioned block element moves, it may have
positioned children that are implicitly positioned relative to the
        // non-positioned block.  Rather than trying to detect all of these
movement cases, we just always lay out positioned
        // objects that are positioned implicitly like this.  Such objects
are rare, and so in typical DHTML menu usage (where everything is
        // positioned explicitly) this should not incur a performance
        if (relayoutChildren ||
(r->style()->hasStaticBlockPosition(isHorizontalWritingMode()) &&
r->parent() != this))
            r->setChildNeedsLayout(true, MarkOnlyThis);

But, it looks like it is accidentally calling setChildNeedsLayout even on
those objects which has Absolute position mentioned exclusively through css.
And as


checks for hasAutoTopAndBottom() in horizontalMode, when we provide
"top/bottom" attributes to any Absolute Positioned element through css,
then setChildNeedsLayout wont be called and hence we are seeing incorrect

I am able to fix this by editing hasAutoTopAndBottom() as follows

bool hasAutoTopAndBottom() const { return (top().isAuto() ||
top().isFixed()) && (bottom().isAuto() || bottom().isFixed()); }

but the implementation does'nt really comply with the name, so either my
fix has to get a different function with a fix something similar as above,
or have a separate if block in RenderBlock::layoutPositionedObjects with an
entirely different implementation .

So, i do not want to submit a patch which will surely get a r-, and waste
reviewers time, also i would like to clarify on the bigger issue of
accidentally laying out positioned elements which the comment does'nt
really reflect.

*P.S: If by any chance i have successfully managed to confuse the reader,
please go through https://bugs.webkit.org/show_bug.cgi?id=80808 for the
use-case and relevant discussion.*
*I am not able to find a relevant person to discuss about this on IRC. so,
please CC yourself on that bug, and please comment there to continue the

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20120519/de3ab8e6/attachment.html>

More information about the webkit-dev mailing list