Skip to content

Commit

Permalink
Revert "Cherry-pick 980a1d5. rdar://121612950"
Browse files Browse the repository at this point in the history
This reverts commit e9ee22d.

Identifier: 272448.557@safari-7618.1.15.10-branch
  • Loading branch information
Dan Robson committed Feb 13, 2024
1 parent 32a23f7 commit 2c60ae4
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 26 deletions.
12 changes: 6 additions & 6 deletions Source/WebCore/dom/ContainerNodeAlgorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,27 @@ static void notifyNodeInsertedIntoDocument(ContainerNode& parentOfInsertedTree,
}
}

static void notifyNodeInsertedIntoTree(ContainerNode& parentOfInsertedTree, Node& node, TreeScopeChange treeScopeChange)
static void notifyNodeInsertedIntoTree(ContainerNode& parentOfInsertedTree, Node& node, TreeScopeChange treeScopeChange, NodeVector& postInsertionNotificationTargets)
{
ASSERT(!parentOfInsertedTree.isConnected());
ASSERT(!node.isConnected());

auto result = node.insertedIntoAncestor(Node::InsertionType { /* connectedToDocument */ false, treeScopeChange == TreeScopeChange::Changed }, parentOfInsertedTree);
ASSERT_UNUSED(result, result == Node::InsertedIntoAncestorResult::Done);
if (node.insertedIntoAncestor(Node::InsertionType { /* connectedToDocument */ false, treeScopeChange == TreeScopeChange::Changed }, parentOfInsertedTree) == Node::InsertedIntoAncestorResult::NeedsPostInsertionCallback)
postInsertionNotificationTargets.append(node);

auto* containerNode = dynamicDowncast<ContainerNode>(node);
if (!containerNode)
return;

for (RefPtr child = containerNode->firstChild(); child; child = child->nextSibling())
notifyNodeInsertedIntoTree(parentOfInsertedTree, *child, treeScopeChange);
notifyNodeInsertedIntoTree(parentOfInsertedTree, *child, treeScopeChange, postInsertionNotificationTargets);

auto* element = dynamicDowncast<Element>(*containerNode);
if (!element)
return;

if (RefPtr root = element->shadowRoot())
notifyNodeInsertedIntoTree(parentOfInsertedTree, *root, TreeScopeChange::DidNotChange);
notifyNodeInsertedIntoTree(parentOfInsertedTree, *root, TreeScopeChange::DidNotChange, postInsertionNotificationTargets);
}

// We intentionally use an out-parameter for postInsertionNotificationTargets instead of returning the vector. This is because
Expand All @@ -108,7 +108,7 @@ void notifyChildNodeInserted(ContainerNode& parentOfInsertedTree, Node& node, No
if (parentOfInsertedTree.isConnected())
notifyNodeInsertedIntoDocument(parentOfInsertedTree, node, treeScopeChange, postInsertionNotificationTargets);
else
notifyNodeInsertedIntoTree(parentOfInsertedTree, node, treeScopeChange);
notifyNodeInsertedIntoTree(parentOfInsertedTree, node, treeScopeChange, postInsertionNotificationTargets);
}

inline RemovedSubtreeObservability observabilityOfRemovedNode(Node& node)
Expand Down
2 changes: 0 additions & 2 deletions Source/WebCore/html/HTMLFormControlElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ Node::InsertedIntoAncestorResult HTMLFormControlElement::insertedIntoAncestor(In
HTMLElement::insertedIntoAncestor(insertionType, parentOfInsertedTree);
ValidatedFormListedElement::insertedIntoAncestor(insertionType, parentOfInsertedTree);

if (!insertionType.connectedToDocument)
return InsertedIntoAncestorResult::Done;
return InsertedIntoAncestorResult::NeedsPostInsertionCallback;
}

Expand Down
4 changes: 1 addition & 3 deletions Source/WebCore/html/HTMLInputElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1699,7 +1699,7 @@ void HTMLInputElement::didChangeForm()

Node::InsertedIntoAncestorResult HTMLInputElement::insertedIntoAncestor(InsertionType insertionType, ContainerNode& parentOfInsertedTree)
{
auto result = HTMLTextFormControlElement::insertedIntoAncestor(insertionType, parentOfInsertedTree);
HTMLTextFormControlElement::insertedIntoAncestor(insertionType, parentOfInsertedTree);
#if ENABLE(DATALIST_ELEMENT)
resetListAttributeTargetObserver();
#endif
Expand All @@ -1709,8 +1709,6 @@ Node::InsertedIntoAncestorResult HTMLInputElement::insertedIntoAncestor(Insertio
document().addElementWithPendingUserAgentShadowTreeUpdate(*this);
m_hasPendingUserAgentShadowTreeUpdate = true;
}
if (!insertionType.connectedToDocument)
return result;
return InsertedIntoAncestorResult::NeedsPostInsertionCallback;
}

Expand Down
3 changes: 1 addition & 2 deletions Source/WebCore/html/HTMLMaybeFormAssociatedCustomElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ Node::InsertedIntoAncestorResult HTMLMaybeFormAssociatedCustomElement::insertedI
HTMLElement::insertedIntoAncestor(insertionType, parentOfInsertedTree);
if (isFormAssociatedCustomElement())
formAssociatedCustomElementUnsafe().insertedIntoAncestor(insertionType, parentOfInsertedTree);
if (!insertionType.connectedToDocument)
return InsertedIntoAncestorResult::Done;

return InsertedIntoAncestorResult::NeedsPostInsertionCallback;
}

Expand Down
2 changes: 0 additions & 2 deletions Source/WebCore/html/HTMLMediaElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,8 +880,6 @@ Node::InsertedIntoAncestorResult HTMLMediaElement::insertedIntoAncestor(Insertio
if (insertionType.connectedToDocument)
setInActiveDocument(true);

if (!insertionType.connectedToDocument)
return InsertedIntoAncestorResult::Done;
return InsertedIntoAncestorResult::NeedsPostInsertionCallback;
}

Expand Down
2 changes: 0 additions & 2 deletions Source/WebCore/html/HTMLObjectElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,6 @@ Node::InsertedIntoAncestorResult HTMLObjectElement::insertedIntoAncestor(Inserti
{
HTMLPlugInImageElement::insertedIntoAncestor(insertionType, parentOfInsertedTree);
FormListedElement::elementInsertedIntoAncestor(*this, insertionType);
if (!insertionType.connectedToDocument)
return InsertedIntoAncestorResult::Done;
return InsertedIntoAncestorResult::NeedsPostInsertionCallback;
}

Expand Down
5 changes: 0 additions & 5 deletions Source/WebCore/html/ValidatedFormListedElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,6 @@ void ValidatedFormListedElement::insertedIntoAncestor(Node::InsertionType insert
syncWithFieldsetAncestors(&parentOfInsertedTree);

FormListedElement::elementInsertedIntoAncestor(asHTMLElement(), insertionType);

if (!insertionType.connectedToDocument)
resetFormOwner();
// Need to wait for didFinishInsertingNode to reset form when this element is inserted into a document
// because we rely on TreeScope::getElementById to return the right element.
}

void ValidatedFormListedElement::setDataListAncestorState(TriState isInsideDataList)
Expand Down
2 changes: 0 additions & 2 deletions Source/WebCore/svg/SVGFEImageElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ void SVGFEImageElement::svgAttributeChanged(const QualifiedName& attrName)
Node::InsertedIntoAncestorResult SVGFEImageElement::insertedIntoAncestor(InsertionType insertionType, ContainerNode& parentOfInsertedTree)
{
SVGFilterPrimitiveStandardAttributes::insertedIntoAncestor(insertionType, parentOfInsertedTree);
if (!insertionType.connectedToDocument)
return InsertedIntoAncestorResult::Done;
return InsertedIntoAncestorResult::NeedsPostInsertionCallback;
}

Expand Down
2 changes: 0 additions & 2 deletions Source/WebCore/svg/SVGTextPathElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ void SVGTextPathElement::buildPendingResource()
Node::InsertedIntoAncestorResult SVGTextPathElement::insertedIntoAncestor(InsertionType insertionType, ContainerNode& parentOfInsertedTree)
{
SVGTextContentElement::insertedIntoAncestor(insertionType, parentOfInsertedTree);
if (!insertionType.connectedToDocument)
return InsertedIntoAncestorResult::Done;
return InsertedIntoAncestorResult::NeedsPostInsertionCallback;
}

Expand Down

0 comments on commit 2c60ae4

Please sign in to comment.