Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up[WIP] Implement live NodeList #22264
Conversation
highfive
commented
Nov 24, 2018
|
Heads up! This PR modifies the following files:
|
highfive
commented
Nov 24, 2018
|
@bors-servo try=wpt |
[WIP] Implement live NodeList Creating this PR just to see what WPT says for now. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22264) <!-- Reviewable:end -->
|
|
|
@bors-servo try=wpt |
[WIP] Implement live NodeList Creating this PR just to see what WPT says for now. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22264) <!-- Reviewable:end -->
|
|
| @@ -372,6 +373,7 @@ unsafe impl<A: JSTraceable, B: JSTraceable, C: JSTraceable> JSTraceable for (A, | |||
|
|
|||
| unsafe_no_jsmanaged_fields!(ActiveAttribInfo); | |||
| unsafe_no_jsmanaged_fields!(ActiveUniformInfo); | |||
| unsafe_no_jsmanaged_fields!(Box<dyn Fn(&Node) -> Box<dyn Iterator<Item = DomRoot<Node>>> + 'static>); | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
KiChjang
Nov 26, 2018
Author
Member
I had my huge doubts as well, and eventually I created a trait to encapsulate this idea instead.
| .get_attribute(&ns!(), &local_name!("name")) | ||
| .map_or(false, |attr| &**attr.value() == &*name) | ||
| }) | ||
| let doc = self.GetDocumentElement(); |
This comment has been minimized.
This comment has been minimized.
emilio
Nov 25, 2018
Member
Why using the document element instead of self? A document is a node as well.
This comment has been minimized.
This comment has been minimized.
KiChjang
Nov 26, 2018
Author
Member
Yeah, I think there wasn't any reason why the document element needs to be used. Let's update this.
|
I think we need to come up with something a bit better perf wise... What gecko does is using |
| Some(doc_node) => NodeList::new_live_list(&self.window, doc_node, move |root| { | ||
| let name = name.clone(); | ||
| Box::new( | ||
| root.traverse_preorder() |
This comment has been minimized.
This comment has been minimized.
emilio
Nov 25, 2018
Member
Calling this function every time you access an element or the length of the collection is going to be terrible for performance.
This comment has been minimized.
This comment has been minimized.
1ba54dc
to
e8e6d57
|
@bors-servo try=wpt |
[WIP] Implement live NodeList Creating this PR just to see what WPT says for now. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22264) <!-- Reviewable:end -->
|
@bors-servo try=wpt |
[WIP] Implement live NodeList Creating this PR just to see what WPT says for now. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22264) <!-- Reviewable:end -->
|
|
|
|
|
@bors-servo try=wpt |
[WIP] Implement live NodeList Creating this PR just to see what WPT says for now. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22264) <!-- Reviewable:end -->
|
|
|
|
|
I apologize for not noticing this PR when I started working on my own solutions to node list liveness issues. I hope you're not upset that I've been duplicating some of your work. If you want to be the one who continues taking this forward, maybe some of what I've written will help you with the subcases you haven't already solved. |
|
Fixed by #25435. |
|
@pshaughn No worries! I was asking just to see if anything from this PR was useful to yours. Thanks for picking this up! |
KiChjang commentedNov 24, 2018
•
edited by SimonSapin
Creating this PR just to see what WPT says for now.
This change is