diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/layout/layout_object_child_list.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/layout/layout_object_child_list.cc | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/chromium/third_party/blink/renderer/core/layout/layout_object_child_list.cc b/chromium/third_party/blink/renderer/core/layout/layout_object_child_list.cc index fb9db0a519e..8a71bc3a13b 100644 --- a/chromium/third_party/blink/renderer/core/layout/layout_object_child_list.cc +++ b/chromium/third_party/blink/renderer/core/layout/layout_object_child_list.cc @@ -58,7 +58,11 @@ void InvalidateInlineItems(LayoutObject* object) { } } - if (NGPaintFragment* fragment = object->FirstInlineFragment()) { + if (RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled()) { + // TODO(yosin): Tells |NGFragmentItem| about they become not to associate + // to layout object. + object->ClearFirstInlineFragmentItemIndex(); + } else if (NGPaintFragment* fragment = object->FirstInlineFragment()) { // This LayoutObject is not technically destroyed, but further access should // be prohibited when moved to different parent as if it were destroyed. fragment->LayoutObjectWillBeDestroyed(); @@ -70,20 +74,13 @@ void InvalidateInlineItems(LayoutObject* object) { } // namespace void LayoutObjectChildList::DestroyLeftoverChildren() { - while (FirstChild()) { - // List markers are owned by their enclosing list and so don't get destroyed - // by this container. - if (FirstChild()->IsListMarkerIncludingNG()) { - FirstChild()->Remove(); - continue; - } - - // Destroy any anonymous children remaining in the layout tree, as well as - // implicit (shadow) DOM elements like those used in the engine-based text - // fields. - if (FirstChild()->GetNode()) - FirstChild()->GetNode()->SetLayoutObject(nullptr); - FirstChild()->Destroy(); + // Destroy any anonymous children remaining in the layout tree, as well as + // implicit (shadow) DOM elements like those used in the engine-based text + // fields. + while (LayoutObject* child = FirstChild()) { + if (Node* child_node = child->GetNode()) + child_node->SetLayoutObject(nullptr); + child->Destroy(); } } @@ -103,7 +100,7 @@ LayoutObject* LayoutObjectChildList::RemoveChildNode( // issue paint invalidations, so that the area exposed when the child // disappears gets paint invalidated properly. if (notify_layout_object && old_child->EverHadLayout()) { - old_child->SetNeedsLayoutAndPrefWidthsRecalc( + old_child->SetNeedsLayoutAndIntrinsicWidthsRecalc( layout_invalidation_reason::kRemovedFromLayout); if (old_child->IsOutOfFlowPositioned() && RuntimeEnabledFeatures::LayoutNGEnabled()) @@ -129,6 +126,8 @@ LayoutObject* LayoutObjectChildList::RemoveChildNode( if (old_child->IsInLayoutNGInlineFormattingContext()) { owner->SetChildNeedsCollectInlines(); + if (RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled()) + InvalidateInlineItems(old_child); } } @@ -184,6 +183,12 @@ void LayoutObjectChildList::InsertChildNode(LayoutObject* owner, return; } + if (RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled() && + !owner->DocumentBeingDestroyed() && + new_child->IsInLayoutNGInlineFormattingContext()) { + InvalidateInlineItems(new_child); + } + new_child->SetParent(owner); if (FirstChild() == before_child) @@ -239,7 +244,7 @@ void LayoutObjectChildList::InsertChildNode(LayoutObject* owner, // actually happens. } - new_child->SetNeedsLayoutAndPrefWidthsRecalc( + new_child->SetNeedsLayoutAndIntrinsicWidthsRecalc( layout_invalidation_reason::kAddedToLayout); if (new_child->IsOutOfFlowPositioned() && RuntimeEnabledFeatures::LayoutNGEnabled()) |