Address review comment and add fixmes.

This commit is contained in:
Ms2ger 2013-10-09 16:58:18 +02:00
parent 04319fdb68
commit 40106841f8

View file

@ -394,6 +394,7 @@ impl<'self, View> AbstractNode<View> {
} }
} }
// Issue #1030: should not walk the tree
pub fn is_in_doc(&self) -> bool { pub fn is_in_doc(&self) -> bool {
do self.with_base |node| { do self.with_base |node| {
do node.owner_doc.with_base |document| { do node.owner_doc.with_base |document| {
@ -408,6 +409,7 @@ impl<'self, View> AbstractNode<View> {
node = parent; node = parent;
}, },
None => { None => {
// Issue #1029: this is horrible.
in_doc = unsafe { node.raw_object() as uint == root.raw_object() as uint }; in_doc = unsafe { node.raw_object() as uint == root.raw_object() as uint };
break; break;
} }
@ -465,13 +467,6 @@ impl Node<ScriptView> {
} }
} }
pub fn remove_from_doc(&self) {
// Signal the document that it needs to update its display.
do self.owner_doc.with_base |doc| {
doc.content_changed();
}
}
pub fn new(type_id: NodeTypeId, doc: AbstractDocument) -> Node<ScriptView> { pub fn new(type_id: NodeTypeId, doc: AbstractDocument) -> Node<ScriptView> {
Node { Node {
reflector_: Reflector::new(), reflector_: Reflector::new(),
@ -722,7 +717,10 @@ impl Node<ScriptView> {
self.wait_until_safe_to_modify_dom(); self.wait_until_safe_to_modify_dom();
abstract_self.remove_child(node); abstract_self.remove_child(node);
self.remove_from_doc(); // Signal the document that it needs to update its display.
do self.owner_doc.with_base |document| {
document.content_changed();
}
Ok(node) Ok(node)
} }