Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make labelable element .labels a live list in tree order #25424

Merged
merged 1 commit into from Jan 6, 2020

Conversation

@pshaughn
Copy link
Member

pshaughn commented Jan 3, 2020

This is not the highest-performance solution possible but it's visibly spec-aligned in a way a faster-performing implementation would be harder to verify, and I don't expect label-getting to deal with more than a few nodes at once in practice.
I added a macro by analogy with some of the existing make_XXX_getter! macros; I will change it if it doesn't seem right.
Remaining test failures are because keygen, shadow DOM, and ElementInternals are unimplemented. Shadow DOM should already be handled by the existing code when it is implemented, and keygen should just be able to add a labels_node_list and use the macro like the other labelable elements. ElementInternals labels are slightly different and might need another NodeList case.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #25391
@highfive
Copy link

highfive commented Jan 3, 2020

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/htmltextareaelement.rs, components/script/dom/htmloutputelement.rs, components/script/dom/htmlbuttonelement.rs, components/script/dom/macros.rs, components/script/dom/webidls/HTMLInputElement.webidl and 7 more
  • @KiChjang: components/script/dom/htmltextareaelement.rs, components/script/dom/htmloutputelement.rs, components/script/dom/htmlbuttonelement.rs, components/script/dom/macros.rs, components/script/dom/webidls/HTMLInputElement.webidl and 7 more
@pshaughn
Copy link
Member Author

pshaughn commented Jan 3, 2020

@bors-servo try=wpt

bors-servo added a commit that referenced this pull request Jan 3, 2020
Make labelable element .labels a live list in tree order

This is not the highest-performance solution possible but it's visibly spec-aligned in a way a faster-performing implementation would be harder to verify, and I don't expect label-getting to deal with more than a few nodes at once in practice.
I added a macro by analogy with some of the existing make_XXX_getter! macros; I will change it if it doesn't seem right.
Remaining test failures are because keygen, shadow DOM, and ElementInternals are unimplemented. Shadow DOM should already be handled by the existing code when it is implemented, and keygen should just be able to add a labels_node_list and use the macro like the other labelable elements. ElementInternals labels are slightly different and might need another NodeList case.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #25391

<!-- Either: -->
- [X] There are tests for these changes, although there's room for more (see web-platform-tests/wpt#21028)

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 3, 2020

Trying commit 75a4cca with merge f1dc08b...

@bors-servo
Copy link
Contributor

bors-servo commented Jan 3, 2020

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented Jan 3, 2020

The only failures are three separate instances of #24726.

@pshaughn pshaughn mentioned this pull request Jan 3, 2020
4 of 4 tasks complete
bors-servo added a commit that referenced this pull request Jan 4, 2020
make Document.getElementsByName a live collection

Another new case for NodeList; this and the labels live collection in #25424 are in the pipeline simultaneously, so one of them will need a merge resolution when the other one lands.

Iterating over many same-named elements is potentially slower than it has to be, since getting the nth element from the live view always starts from the start of the tree.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #25147

<!-- Either: -->
- [X] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Copy link
Member

Manishearth left a comment

Seems like Firefox uses a mutation observer to make the live list work efficiently. We do support them (I think), so this should be possible, but perhaps not necessary in this first pass.

components/script/dom/nodelist.rs Outdated Show resolved Hide resolved
@pshaughn pshaughn mentioned this pull request Jan 6, 2020
4 of 4 tasks complete
@highfive highfive removed the S-tests-failed label Jan 6, 2020
@pshaughn pshaughn force-pushed the pshaughn:labelfixes branch from 76aba58 to cdc66ec Jan 6, 2020
@Manishearth
Copy link
Member

Manishearth commented Jan 6, 2020

@bors-servo
Copy link
Contributor

bors-servo commented Jan 6, 2020

📌 Commit cdc66ec has been approved by Manishearth

@bors-servo
Copy link
Contributor

bors-servo commented Jan 6, 2020

Testing commit cdc66ec with merge 98b964d...

bors-servo added a commit that referenced this pull request Jan 6, 2020
Make labelable element .labels a live list in tree order

This is not the highest-performance solution possible but it's visibly spec-aligned in a way a faster-performing implementation would be harder to verify, and I don't expect label-getting to deal with more than a few nodes at once in practice.
I added a macro by analogy with some of the existing make_XXX_getter! macros; I will change it if it doesn't seem right.
Remaining test failures are because keygen, shadow DOM, and ElementInternals are unimplemented. Shadow DOM should already be handled by the existing code when it is implemented, and keygen should just be able to add a labels_node_list and use the macro like the other labelable elements. ElementInternals labels are slightly different and might need another NodeList case.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [X] These changes fix #25391

<!-- Either: -->
- [X] There are tests for these changes, although there's room for more (see web-platform-tests/wpt#21028)

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@pshaughn pshaughn force-pushed the pshaughn:labelfixes branch from cdc66ec to 036e8da Jan 6, 2020
@pshaughn
Copy link
Member Author

pshaughn commented Jan 6, 2020

(sorry about the double-force-push, I forgot test-tidy the first time and I had tabs)

@jdm
Copy link
Member

jdm commented Jan 6, 2020

@bors-servo r=Manishearth

@bors-servo
Copy link
Contributor

bors-servo commented Jan 6, 2020

📌 Commit 036e8da has been approved by Manishearth

@bors-servo
Copy link
Contributor

bors-servo commented Jan 6, 2020

Testing commit 036e8da with merge a3f3fef...

bors-servo added a commit that referenced this pull request Jan 6, 2020
Make labelable element .labels a live list in tree order

This is not the highest-performance solution possible but it's visibly spec-aligned in a way a faster-performing implementation would be harder to verify, and I don't expect label-getting to deal with more than a few nodes at once in practice.
I added a macro by analogy with some of the existing make_XXX_getter! macros; I will change it if it doesn't seem right.
Remaining test failures are because keygen, shadow DOM, and ElementInternals are unimplemented. Shadow DOM should already be handled by the existing code when it is implemented, and keygen should just be able to add a labels_node_list and use the macro like the other labelable elements. ElementInternals labels are slightly different and might need another NodeList case.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [X] These changes fix #25391

<!-- Either: -->
- [X] There are tests for these changes, although there's room for more (see web-platform-tests/wpt#21028)

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 6, 2020

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented Jan 6, 2020

@bors-servo
Copy link
Contributor

bors-servo commented Jan 6, 2020

Testing commit 036e8da with merge fd2950e...

bors-servo added a commit that referenced this pull request Jan 6, 2020
Make labelable element .labels a live list in tree order

This is not the highest-performance solution possible but it's visibly spec-aligned in a way a faster-performing implementation would be harder to verify, and I don't expect label-getting to deal with more than a few nodes at once in practice.
I added a macro by analogy with some of the existing make_XXX_getter! macros; I will change it if it doesn't seem right.
Remaining test failures are because keygen, shadow DOM, and ElementInternals are unimplemented. Shadow DOM should already be handled by the existing code when it is implemented, and keygen should just be able to add a labels_node_list and use the macro like the other labelable elements. ElementInternals labels are slightly different and might need another NodeList case.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [X] These changes fix #25391

<!-- Either: -->
- [X] There are tests for these changes, although there's room for more (see web-platform-tests/wpt#21028)

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 6, 2020

☀️ Test successful - status-taskcluster
Approved by: Manishearth
Pushing fd2950e to master...

@bors-servo bors-servo merged commit 036e8da into servo:master Jan 6, 2020
2 checks passed
2 checks passed
Community-TC (pull_request) TaskGroup: success
Details
homu Test successful
Details
bors-servo added a commit that referenced this pull request Feb 28, 2020
make Document.getElementsByName a live collection

Another new case for NodeList; this and the labels live collection in #25424 are in the pipeline simultaneously, so one of them will need a merge resolution when the other one lands.

Iterating over many same-named elements is potentially slower than it has to be, since getting the nth element from the live view always starts from the start of the tree.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #25147

<!-- Either: -->
- [X] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
bors-servo added a commit that referenced this pull request Feb 28, 2020
make Document.getElementsByName a live collection

Another new case for NodeList; this and the labels live collection in #25424 are in the pipeline simultaneously, so one of them will need a merge resolution when the other one lands.

Iterating over many same-named elements is potentially slower than it has to be, since getting the nth element from the live view always starts from the start of the tree.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #25147

<!-- Either: -->
- [X] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.