RESOLVED FIXED 157455
Absolute positioned element is not placed properly when parent becomes the containing block.
https://bugs.webkit.org/show_bug.cgi?id=157455
Summary Absolute positioned element is not placed properly when parent becomes the co...
zalan
Reported 2016-05-07 15:49:32 PDT
Created attachment 278345 [details] Test case When the parent becomes the containing block by setting transform on it. (-by using timeout) -see test case
Attachments
Test case (742 bytes, text/html)
2016-05-07 15:49 PDT, zalan
no flags
Patch (11.51 KB, patch)
2016-05-10 21:24 PDT, zalan
simon.fraser: review+
zalan
Comment 1 2016-05-10 19:14:48 PDT
zalan
Comment 2 2016-05-10 21:24:30 PDT
Simon Fraser (smfr)
Comment 3 2016-05-11 09:53:13 PDT
Comment on attachment 278576 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=278576&action=review > Source/WebCore/ChangeLog:10 > + When a container becomes a containing block, we need to check if there's any positioned box in its subtree > + in order to "re-parent" them. It basically means that we remove them from RenderBlock::positionedDescendants map "...if there is ... to reparent it", or "if there are...to reparent them". Don't mix singular and plural! > Source/WebCore/rendering/RenderBlock.cpp:243 > + if (oldStyle.position() == newStyle.position() && hadTransform == willHaveTransform) This is OK but I would prefer we add RenderStyle::containingBlockForPositioned(), or positionedOrTransformed() or something. I bet we need the same logic elsewhere. > Source/WebCore/rendering/RenderBlock.cpp:260 > + && (containingBlock->style().position() == StaticPosition || (containingBlock->isInline() && !containingBlock->isReplaced()))) { Would be nice to wrap this conditional in a function so I know what you're checking. Why inline and not replaced! I think this pattern exists in multiple places. Could be done separately.
zalan
Comment 4 2016-05-11 19:04:01 PDT
(In reply to comment #3) > Comment on attachment 278576 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=278576&action=review > > > Source/WebCore/ChangeLog:10 > > + When a container becomes a containing block, we need to check if there's any positioned box in its subtree > > + in order to "re-parent" them. It basically means that we remove them from RenderBlock::positionedDescendants map > > "...if there is ... to reparent it", or "if there are...to reparent them". > Don't mix singular and plural! > > > Source/WebCore/rendering/RenderBlock.cpp:243 > > + if (oldStyle.position() == newStyle.position() && hadTransform == willHaveTransform) > > This is OK but I would prefer we add > RenderStyle::containingBlockForPositioned(), or positionedOrTransformed() or > something. I bet we need the same logic elsewhere. There are a couple of places where we use similar logic (requiresLayer and canContainAbsolutelyPositionedObjects) but it seems like we explicitly write out all the requires properties there. > > > Source/WebCore/rendering/RenderBlock.cpp:260 > > + && (containingBlock->style().position() == StaticPosition || (containingBlock->isInline() && !containingBlock->isReplaced()))) { > > Would be nice to wrap this conditional in a function so I know what you're > checking. Why inline and not replaced! I think this pattern exists in > multiple places. > > Could be done separately. Ok. I'll do it in a follow-up patch.
zalan
Comment 5 2016-05-11 19:09:12 PDT
Note You need to log in before you can comment on or make changes to this bug.