mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Disambiguate methods without using trait objects
This commit is contained in:
parent
be9618d55b
commit
e894499c17
2 changed files with 63 additions and 9 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue