aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/element.rs
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@mozilla.com>2014-09-30 20:36:38 -0700
committerCameron Zwarich <zwarich@mozilla.com>2014-09-30 21:22:24 -0700
commite894499c17b920494c008c30566fc1465aab4671 (patch)
treeed497a62f666bf4ab90dd23b2b9c144682fc7c50 /components/script/dom/element.rs
parentbe9618d55bd48be45e55b2c49d0df12f953f1fe5 (diff)
downloadservo-e894499c17b920494c008c30566fc1465aab4671.tar.gz
servo-e894499c17b920494c008c30566fc1465aab4671.zip
Disambiguate methods without using trait objects
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r--components/script/dom/element.rs24
1 files changed, 21 insertions, 3 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index 821ac1f9909..a0d843a4dba 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -966,10 +966,22 @@ impl<'a> style::TElement<'a> for JSRef<'a, Element> {
}
}
fn get_local_name<'b>(&'b self) -> &'b Atom {
- (self as &ElementHelpers).get_local_name()
+ // FIXME(zwarich): Remove this when UFCS lands and there is a better way
+ // of disambiguating methods.
+ fn get_local_name<'a, T: ElementHelpers<'a>>(this: T) -> &'a Atom {
+ this.get_local_name()
+ }
+
+ get_local_name(*self)
}
fn get_namespace<'b>(&'b self) -> &'b Namespace {
- (self as &ElementHelpers).get_namespace()
+ // FIXME(zwarich): Remove this when UFCS lands and there is a better way
+ // of disambiguating methods.
+ fn get_namespace<'a, T: ElementHelpers<'a>>(this: T) -> &'a Namespace {
+ this.get_namespace()
+ }
+
+ get_namespace(*self)
}
fn get_hover_state(&self) -> bool {
let node: JSRef<Node> = NodeCast::from_ref(*self);
@@ -993,6 +1005,12 @@ impl<'a> style::TElement<'a> for JSRef<'a, Element> {
node.get_enabled_state()
}
fn has_class(&self, name: &str) -> bool {
- (self as &AttributeHandlers).has_class(name)
+ // FIXME(zwarich): Remove this when UFCS lands and there is a better way
+ // of disambiguating methods.
+ fn has_class<T: AttributeHandlers>(this: T, name: &str) -> bool {
+ this.has_class(name)
+ }
+
+ has_class(*self, name)
}
}