Defer dir=auto adjustment on when slot assignment needs recalc
This defers calls to CalculateAndAdjustAutoDirectionality()
when slot assignment needs recalculation, since:
(1) it might not be a safe time to recalculate slot assignment, and
(2) we're going to do the work over again when we do recalculate slot
assignment, so we may as well wait.
Without this change, we will fail a DCHECK() at the following stack (or
the equivalent for removal) in the added test:
blink::ShadowRoot::setInnerHTML () at shadow_root.cc:163
blink::ReplaceChildrenWithFragment () at serialization.cc:827
blink::ContainerNode::AppendChild () at container_node.cc:970
blink::ContainerNode::InsertNodeVector<> () at container_node.cc:352
blink::ContainerNode::NotifyNodeInsertedInternal () at container_node.cc:1139
blink::HTMLSlotElement::InsertedInto () at html_slot_element.cc:394
blink::HTMLSlotElement::UpdateDirAutoAncestorsForSupportsAssignmentChange () at html_slot_element.cc:387
blink::Element::UpdateAncestorWithDirAuto () at element.cc:4833
blink::HTMLElement::CalculateAndAdjustAutoDirectionality () at html_element.cc:2670
blink::Element::ResolveAutoDirectionality () at element.cc:4717
blink::HTMLSlotElement::AssignedNodes () at html_slot_element.cc:88
blink::SlotAssignment::RecalcAssignment () at slot_assignment.cc:243
logging::CheckError::~CheckError () at check.cc:334
Bug: 576815, 352191350
Change-Id: Iea8498a298a0a85d073fda03f19e7fc6f26720e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5798069
Reviewed-by: Dominic Farolino dom@chromium.org
Commit-Queue: David Baron dbaron@chromium.org
Cr-Commit-Position: refs/heads/main@{#1345464}