From 9c982693e1f912f20f5063c33ae5c66eb79ba923 Mon Sep 17 00:00:00 2001 From: "Brian J. Burg" Date: Fri, 12 Oct 2012 18:09:28 -0700 Subject: [PATCH] Replace Node's broken impl of cmp:Eq with a generic implementation for cow::Handle. --- src/servo/dom/cow.rs | 5 +++++ src/servo/dom/node.rs | 14 -------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/servo/dom/cow.rs b/src/servo/dom/cow.rs index 627d9d225f8..826ab371759 100644 --- a/src/servo/dom/cow.rs +++ b/src/servo/dom/cow.rs @@ -133,6 +133,11 @@ impl Handle { } } +impl Handle : cmp::Eq { + pure fn eq(other: &Handle) -> bool { *self == **other } + pure fn ne(other: &Handle) -> bool { *self != **other } +} + // Private methods impl Scope { fn clone(v: *T) -> *T unsafe { diff --git a/src/servo/dom/node.rs b/src/servo/dom/node.rs index 5b48c1501cc..e286217ad12 100644 --- a/src/servo/dom/node.rs +++ b/src/servo/dom/node.rs @@ -48,20 +48,6 @@ impl Node { } } -/* TODO: LayoutData is just a pointer, but we must circumvent the type - system to actually compare the pointers. This should be fixed in - with a generic implementation of cow::Handle */ -impl Node : cmp::Eq { - pure fn eq(other : &Node) -> bool unsafe { - let my_data : @LayoutData = @self.aux(|a| copy *a); - let ot_data : @LayoutData = @other.aux(|a| copy *a); - core::box::ptr_eq(my_data, ot_data) - } - pure fn ne(other : &Node) -> bool unsafe { - !self.eq(other) - } -} - impl Node : DebugMethods { /* Dumps the subtree rooted at this node, for debugging. */ fn dump(&self) {