From 4ef0f39c7877ee98c0d7fe826badd63e2bb97d6d Mon Sep 17 00:00:00 2001 From: Cameron Zwarich Date: Tue, 30 Sep 2014 20:29:10 -0700 Subject: [PATCH] Remove a prefix from a method name by manually resolving methods --- components/layout/wrapper.rs | 10 ++++++++-- components/script/dom/node.rs | 2 +- components/style/node.rs | 3 +-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 4fdec61230c..fe60532f306 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -213,8 +213,14 @@ impl<'ln> LayoutNode<'ln> { /// Returns an iterator over this node's children. pub fn children(&self) -> LayoutNodeChildrenIterator<'ln> { + // FIXME(zwarich): Remove this when UFCS lands and there is a better way + // of disambiguating methods. + fn first_child(this: &T) -> Option { + this.first_child() + } + LayoutNodeChildrenIterator { - current_node: self.first_child(), + current_node: first_child(self), } } @@ -247,7 +253,7 @@ impl<'ln> TNode<'ln, LayoutElement<'ln>> for LayoutNode<'ln> { } } - fn tnode_first_child(&self) -> Option> { + fn first_child(&self) -> Option> { unsafe { self.node.first_child_ref().map(|node| self.new_with_this_lifetime(&node)) } diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 85f7f27bc1c..554f3686e03 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -2039,7 +2039,7 @@ impl<'a> style::TNode<'a, JSRef<'a, Element>> for JSRef<'a, Node> { (self as &NodeHelpers).parent_node().map(|node| *node.root()) } - fn tnode_first_child(&self) -> Option> { + fn first_child(&self) -> Option> { (self as &NodeHelpers).first_child().map(|node| *node.root()) } diff --git a/components/style/node.rs b/components/style/node.rs index 749e9fbe6ea..d2624c241fe 100644 --- a/components/style/node.rs +++ b/components/style/node.rs @@ -11,8 +11,7 @@ use string_cache::{Atom, Namespace}; pub trait TNode<'a, E: TElement<'a>> : Clone { fn parent_node(&self) -> Option; - /// Name is prefixed to avoid a conflict with TLayoutNode. - fn tnode_first_child(&self) -> Option; + fn first_child(&self) -> Option; fn prev_sibling(&self) -> Option; fn next_sibling(&self) -> Option; fn is_document(&self) -> bool;