Commit b1852b1c authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[LayoutNG] Remove unnecessary call to ContainingBlock.

This is the same as the container builder's layout object, so use that
instead.

Also moves where we set the margins to the "post-layout" site along
with other copy-back calls.

There should be no behaviour change.

Change-Id: I198dc1548592ccb26553438cab6a2488d395b144
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1554792Reviewed-by: default avatarAleks Totic <atotic@chromium.org>
Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#648367}
parent 972ba48a
......@@ -119,8 +119,7 @@ void NGOutOfFlowLayoutPart::Run(const LayoutBox* only_layout) {
&descendant_candidates, current_container);
if (descendant_candidates.IsEmpty() &&
!ToLayoutBlock(container_builder_->GetLayoutObject())
->HasPositionedObjects())
!ToLayoutBlock(current_container)->HasPositionedObjects())
return;
// Special case: containing block is a split inline.
......@@ -531,10 +530,17 @@ scoped_refptr<const NGLayoutResult> NGOutOfFlowLayoutPart::LayoutDescendant(
layout_result =
GenerateFragment(node, container_info, block_estimate, node_position);
}
if (node.GetLayoutBox()->IsLayoutNGObject()) {
ToLayoutBlock(node.GetLayoutBox())
->SetIsLegacyInitiatedOutOfFlowLayout(false);
}
// Legacy grid and flexbox handle OOF-positioned margins on their own, and
// break if we set them here.
if (!container_builder_->GetLayoutObject()
->Style()
->IsDisplayFlexibleOrGridBox())
node.GetLayoutBox()->SetMargin(node_position.margins);
NGBoxStrut inset = node_position.inset.ConvertToLogical(
container_writing_mode, default_containing_block_.style->Direction());
......@@ -665,17 +671,7 @@ scoped_refptr<const NGLayoutResult> NGOutOfFlowLayoutPart::GenerateFragment(
builder.SetIsFixedSizeBlock(true);
NGConstraintSpace space = builder.ToConstraintSpace();
scoped_refptr<const NGLayoutResult> result = descendant.Layout(space);
// Legacy Grid and Flexbox seem to handle oof margins correctly
// on their own, and break if we set them here.
if (!descendant.GetLayoutBox()
->ContainingBlock()
->Style()
->IsDisplayFlexibleOrGridBox())
descendant.GetLayoutBox()->SetMargin(node_position.margins);
return result;
return descendant.Layout(space);
}
} // namespace blink
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