Commit b235a3a7 authored by cbiesinger's avatar cbiesinger Committed by Commit bot

[layoutng] Better abspos support in legacy interop

In legacy layout, abspos differs from regular blocks in that abspos blocks
position themselves in their own layout, instead of getting positioned by
their parent. So it we are a positioned block in a legacy-layout containing
block, we have to emulate this positioning, which is what this change does.

Fixes this testcase:
<div style="height: 200px; background: yellow; position: relative;">
  XXX
  <div style="position: absolute; bottom: 0;">
    <div>Bottom</div>
  </div>
</div>

R=atotic@chromium.org,ikilpatrick@chromium.org
BUG=635619

Review-Url: https://codereview.chromium.org/2591273002
Cr-Commit-Position: refs/heads/master@{#440975}
parent 88940145
...@@ -30,6 +30,21 @@ void LayoutNGBlockFlow::layoutBlock(bool relayoutChildren) { ...@@ -30,6 +30,21 @@ void LayoutNGBlockFlow::layoutBlock(bool relayoutChildren) {
while (!m_box->Layout(constraint_space, &fragment)) while (!m_box->Layout(constraint_space, &fragment))
; ;
if (isOutOfFlowPositioned()) {
// In legacy layout, abspos differs from regular blocks in that abspos
// blocks position themselves in their own layout, instead of getting
// positioned by their parent. So it we are a positioned block in a legacy-
// layout containing block, we have to emulate this positioning.
// Additionally, until we natively support abspos in LayoutNG, this code
// will also be reached though the layoutPositionedObjects call in
// NGBlockNode::CopyFragmentDataToLayoutBox.
LogicalExtentComputedValues computedValues;
computeLogicalWidth(computedValues);
setLogicalLeft(computedValues.m_position);
computeLogicalHeight(logicalHeight(), logicalTop(), computedValues);
setLogicalTop(computedValues.m_position);
}
for (auto& descendant : fragment->PhysicalFragment()->OutOfFlowDescendants()) for (auto& descendant : fragment->PhysicalFragment()->OutOfFlowDescendants())
descendant->UseOldOutOfFlowPositioning(); descendant->UseOldOutOfFlowPositioning();
clearNeedsLayout(); clearNeedsLayout();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment