Fix cloning of templates with DOM Parts, and improve testing #41168
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This CL improves the testing of template cloning with Parts, testing
these four cases:
This CL fixes the behavior for #3 above, but leaves #4 broken. The
following changes in behavior are made:
to set it to nullptr. This happens when a Node tree is removed
from the DOM, and it contains Parts that refer to the old root.
the root() for a Part can be made nullptr even when it's a
ChildNodePart.
Part has been disconnected, since root() can now be nullptr.
the new sibling node wasn't having its Part registered with
NodeRareData, which caused a CHECK failure when trying to
subsequently clone that Part. This is caught in the new test
which clones declaratively-built templates containing Parts.
Bug: 1453291
Change-Id: Ic1c1475431cf6bd658f191db78003204412ef78f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4713668
Reviewed-by: David Baron <[email protected]>
Auto-Submit: Mason Freed <[email protected]>
Commit-Queue: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1175782}