Commit 039e6fcc authored by Manuel Rego Casasnovas's avatar Manuel Rego Casasnovas Committed by Commit Bot

Add early return to NGOutOfFlowLayoutPart::Run()

Similar to what we have in NGOutOfFlowLayoutPart constructor
we should have an early return in NGOutOfFlowLayoutPart::Run()
when we have no positioned descendants.

We already have it a few lines later, but we can move it
to the beginning of the method to avoid any extra operation.

We also add a check for fragmentainer descendants to avoid
doing extra work if we don't have any.

BUG=1098231

Change-Id: I2d233c1c79a903d1696099c26029c2d09d59a728
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2279759Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarAlison Maher <almaher@microsoft.com>
Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Commit-Queue: Manuel Rego <rego@igalia.com>
Cr-Commit-Position: refs/heads/master@{#788556}
parent 1115abee
......@@ -126,7 +126,8 @@ NGOutOfFlowLayoutPart::NGOutOfFlowLayoutPart(
}
void NGOutOfFlowLayoutPart::Run(const LayoutBox* only_layout) {
if (container_builder_->IsBlockFragmentationContextRoot()) {
if (container_builder_->IsBlockFragmentationContextRoot() &&
container_builder_->HasOutOfFlowFragmentainerDescendants()) {
Vector<NGLogicalOutOfFlowPositionedNode> fragmentainer_descendants;
container_builder_->SwapOutOfFlowFragmentainerDescendants(
&fragmentainer_descendants);
......@@ -135,20 +136,20 @@ void NGOutOfFlowLayoutPart::Run(const LayoutBox* only_layout) {
LayoutFragmentainerDescendants(&fragmentainer_descendants);
}
Vector<NGLogicalOutOfFlowPositionedNode> candidates;
const LayoutObject* current_container = container_builder_->GetLayoutObject();
if (!container_builder_->HasOutOfFlowPositionedCandidates() &&
!To<LayoutBlock>(current_container)->HasPositionedObjects())
return;
// If the container is display-locked, then we skip the layout of descendants,
// so we can early out immediately.
if (current_container->LayoutBlockedByDisplayLock(
DisplayLockLifecycleTarget::kChildren))
return;
Vector<NGLogicalOutOfFlowPositionedNode> candidates;
container_builder_->SwapOutOfFlowPositionedCandidates(&candidates);
if (candidates.IsEmpty() &&
!To<LayoutBlock>(current_container)->HasPositionedObjects())
return;
// Special case: containing block is a split inline.
// If current container was generated by a split inline, do not position
// OOF-positioned nodes inside this container. Let its non-anonymous parent
......
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