mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #6660 - nox:children-changed, r=jdm
Introduce VirtualMethods::children_changed() This virtual method mimics the behaviour of mutation observers and make it more viable than the older child_inserted(), which didn't cover removed nodes and was called as many times as there were inserted nodes. A few other shortcomings where remove_child() was called directly instead of Node::remove() were also fixed while at it. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6660) <!-- Reviewable:end -->
This commit is contained in:
commit
705c95dedb
11 changed files with 218 additions and 200 deletions
|
@ -70,6 +70,7 @@ use std::collections::hash_state::HashState;
|
|||
use std::ffi::CString;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::intrinsics::return_address;
|
||||
use std::mem;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
@ -482,6 +483,13 @@ impl<T: JSTraceable + Reflectable> RootedVec<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: JSTraceable + Reflectable> RootedVec<JS<T>> {
|
||||
/// Obtain a safe slice of references that can't outlive that RootedVec.
|
||||
pub fn r(&self) -> &[&T] {
|
||||
unsafe { mem::transmute(&*self.v) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: JSTraceable + Reflectable> Drop for RootedVec<T> {
|
||||
fn drop(&mut self) {
|
||||
RootedTraceableSet::remove(self);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue