Skip to content

Conversation

xiaochengh
Copy link
Contributor

@xiaochengh xiaochengh commented Mar 17, 2025

Per spec, adoption of new node should be done while inserting the node. This patch moves the call site of adopt to inside insert to match it.

It also rewrites some existing code to better match the spec without any behavioral changes.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #___ (GitHub issue number if applicable)
  • There are tests for these changes OR
  • These changes do not require tests because ___

@servo-wpt-sync
Copy link
Collaborator

🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#51993) with upstreamable changes.

@servo-wpt-sync
Copy link
Collaborator

🤖 This change no longer contains upstreamable changes to WPT; closed existing upstream pull request (web-platform-tests/wpt#51993).

@servo-wpt-sync
Copy link
Collaborator

🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#51997) with upstreamable changes.

@servo-wpt-sync
Copy link
Collaborator

🤖 This change no longer contains upstreamable changes to WPT; closed existing upstream pull request (web-platform-tests/wpt#51997).

@xiaochengh xiaochengh force-pushed the fix-node-insert branch 3 times, most recently from 7f9848f to 0ac6dc7 Compare April 17, 2025 05:32
@servo-wpt-sync
Copy link
Collaborator

🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#52040) with upstreamable changes.

@servo-wpt-sync
Copy link
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#52040).

@mrobinson
Copy link
Member

@xiaochengh Is this one ready to review?

@xiaochengh
Copy link
Contributor Author

@mrobinson yes

Copy link
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just some nits about the specification text and naming above. Thanks!

if let Some(child) = child {
if !parent.ranges_is_empty() {
let index = child.index();
// Steps 2.1-2.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this step number is inaccurate now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Let me remove this step number since the two steps are merged into the same utility function.

Comment on lines 2393 to 2395

// Step 8. If suppress observers flag is unset, then queue a tree mutation record for parent
// with nodes, « », previousSibling, and child.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm. Is this actually happening? It might be worth a comment explaining why if not or a TODO if we are missing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's done after the children_changed call. I moved it to right next to the lines.

What confused me is that children_changed is called only when observers are unsuppressed, which is different from the spec.

@servo-wpt-sync
Copy link
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#52040).

Copy link
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay in reviewing and thank you for the changes! This is a lot easier to follow now and has made reviewing it much easier.

@xiaochengh xiaochengh enabled auto-merge April 28, 2025 10:20
Signed-off-by: Xiaocheng Hu <[email protected]>
@servo-wpt-sync
Copy link
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#52040).

@xiaochengh xiaochengh added this pull request to the merge queue Apr 28, 2025
Merged via the queue into servo:main with commit 02b38ad Apr 28, 2025
21 checks passed
@xiaochengh xiaochengh deleted the fix-node-insert branch April 28, 2025 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants