mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +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
|
@ -2036,27 +2036,63 @@ impl<'a> VirtualMethods for JSRef<'a, Node> {
|
|||
|
||||
impl<'a> style::TNode<'a, JSRef<'a, Element>> for JSRef<'a, Node> {
|
||||
fn parent_node(&self) -> Option<JSRef<'a, Node>> {
|
||||
(self as &NodeHelpers).parent_node().map(|node| *node.root())
|
||||
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
|
||||
// of disambiguating methods.
|
||||
fn parent_node<'a, 'b, T: NodeHelpers<'a, 'b>>(this: T) -> Option<Temporary<Node>> {
|
||||
this.parent_node()
|
||||
}
|
||||
|
||||
parent_node(*self).map(|node| *node.root())
|
||||
}
|
||||
|
||||
fn first_child(&self) -> Option<JSRef<'a, Node>> {
|
||||
(self as &NodeHelpers).first_child().map(|node| *node.root())
|
||||
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
|
||||
// of disambiguating methods.
|
||||
fn first_child<'a, 'b, T: NodeHelpers<'a, 'b>>(this: T) -> Option<Temporary<Node>> {
|
||||
this.first_child()
|
||||
}
|
||||
|
||||
first_child(*self).map(|node| *node.root())
|
||||
}
|
||||
|
||||
fn prev_sibling(&self) -> Option<JSRef<'a, Node>> {
|
||||
(self as &NodeHelpers).prev_sibling().map(|node| *node.root())
|
||||
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
|
||||
// of disambiguating methods.
|
||||
fn prev_sibling<'a, 'b, T: NodeHelpers<'a, 'b>>(this: T) -> Option<Temporary<Node>> {
|
||||
this.prev_sibling()
|
||||
}
|
||||
|
||||
prev_sibling(*self).map(|node| *node.root())
|
||||
}
|
||||
|
||||
fn next_sibling(&self) -> Option<JSRef<'a, Node>> {
|
||||
(self as &NodeHelpers).next_sibling().map(|node| *node.root())
|
||||
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
|
||||
// of disambiguating methods.
|
||||
fn next_sibling<'a, 'b, T: NodeHelpers<'a, 'b>>(this: T) -> Option<Temporary<Node>> {
|
||||
this.next_sibling()
|
||||
}
|
||||
|
||||
next_sibling(*self).map(|node| *node.root())
|
||||
}
|
||||
|
||||
fn is_document(&self) -> bool {
|
||||
(self as &NodeHelpers).is_document()
|
||||
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
|
||||
// of disambiguating methods.
|
||||
fn is_document<'a, 'b, T: NodeHelpers<'a, 'b>>(this: T) -> bool {
|
||||
this.is_document()
|
||||
}
|
||||
|
||||
is_document(*self)
|
||||
}
|
||||
|
||||
fn is_element(&self) -> bool {
|
||||
(self as &NodeHelpers).is_element()
|
||||
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
|
||||
// of disambiguating methods.
|
||||
fn is_element<'a, 'b, T: NodeHelpers<'a, 'b>>(this: T) -> bool {
|
||||
this.is_element()
|
||||
}
|
||||
|
||||
is_element(*self)
|
||||
}
|
||||
|
||||
fn as_element(&self) -> JSRef<'a, Element> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue