aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2015-06-18 01:04:20 +0200
committerSimon Sapin <simon.sapin@exyr.org>2015-06-20 07:05:43 +0200
commitfc25397c91538eb2bd263170feb79cc97fcfd4de (patch)
treeec43c9d03e01a3634c089c3e9eaa37a7da0eaa40 /components/script/dom
parent72ead882c08fbd66d59457efd1ebf86ee4ee97f2 (diff)
downloadservo-fc25397c91538eb2bd263170feb79cc97fcfd4de.tar.gz
servo-fc25397c91538eb2bd263170feb79cc97fcfd4de.zip
Update rust-selectors
https://github.com/servo/rust-selectors/pull/30
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/element.rs54
-rw-r--r--components/script/dom/node.rs44
2 files changed, 41 insertions, 57 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index a84773dd195..a4818c817e3 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -1622,10 +1622,10 @@ impl<'a> VirtualMethods for &'a Element {
}
}
-impl<'a> style::node::TElement<'a> for &'a Element {
- fn is_link(self) -> bool {
+impl<'a> style::node::TElement for &'a Element {
+ fn is_link(&self) -> bool {
// FIXME: This is HTML only.
- let node = NodeCast::from_ref(self);
+ let node = NodeCast::from_ref(*self);
match node.type_id() {
// https://html.spec.whatwg.org/multipage/#selector-link
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) |
@@ -1638,45 +1638,45 @@ impl<'a> style::node::TElement<'a> for &'a Element {
}
#[inline]
- fn is_unvisited_link(self) -> bool {
+ fn is_unvisited_link(&self) -> bool {
self.is_link()
}
#[inline]
- fn is_visited_link(self) -> bool {
+ fn is_visited_link(&self) -> bool {
false
}
- fn get_local_name(self) -> &'a Atom {
+ fn get_local_name<'b>(&'b self) -> &'b Atom {
// 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.local_name()
}
- get_local_name(self)
+ get_local_name(*self)
}
- fn get_namespace(self) -> &'a Namespace {
+ fn get_namespace<'b>(&'b self) -> &'b 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.namespace()
}
- get_namespace(self)
+ get_namespace(*self)
}
- fn get_hover_state(self) -> bool {
- let node = NodeCast::from_ref(self);
+ fn get_hover_state(&self) -> bool {
+ let node = NodeCast::from_ref(*self);
node.get_hover_state()
}
- fn get_focus_state(self) -> bool {
+ fn get_focus_state(&self) -> bool {
// TODO: Also check whether the top-level browsing context has the system focus,
// and whether this element is a browsing context container.
// https://html.spec.whatwg.org/multipage/#selector-focus
- let node = NodeCast::from_ref(self);
+ let node = NodeCast::from_ref(*self);
node.get_focus_state()
}
- fn get_id(self) -> Option<Atom> {
+ fn get_id(&self) -> Option<Atom> {
self.get_attribute(&ns!(""), &atom!("id")).map(|attr| {
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let attr = attr.r();
@@ -1687,38 +1687,38 @@ impl<'a> style::node::TElement<'a> for &'a Element {
}
})
}
- fn get_disabled_state(self) -> bool {
- let node = NodeCast::from_ref(self);
+ fn get_disabled_state(&self) -> bool {
+ let node = NodeCast::from_ref(*self);
node.get_disabled_state()
}
- fn get_enabled_state(self) -> bool {
- let node = NodeCast::from_ref(self);
+ fn get_enabled_state(&self) -> bool {
+ let node = NodeCast::from_ref(*self);
node.get_enabled_state()
}
- fn get_checked_state(self) -> bool {
- let input_element: Option<&HTMLInputElement> = HTMLInputElementCast::to_ref(self);
+ fn get_checked_state(&self) -> bool {
+ let input_element: Option<&HTMLInputElement> = HTMLInputElementCast::to_ref(*self);
match input_element {
Some(input) => input.Checked(),
None => false,
}
}
- fn get_indeterminate_state(self) -> bool {
- let input_element: Option<&HTMLInputElement> = HTMLInputElementCast::to_ref(self);
+ fn get_indeterminate_state(&self) -> bool {
+ let input_element: Option<&HTMLInputElement> = HTMLInputElementCast::to_ref(*self);
match input_element {
Some(input) => input.get_indeterminate_state(),
None => false,
}
}
- fn has_class(self, name: &Atom) -> bool {
+ fn has_class(&self, name: &Atom) -> bool {
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
// of disambiguating methods.
fn has_class<T: AttributeHandlers>(this: T, name: &Atom) -> bool {
this.has_class(name)
}
- has_class(self, name)
+ has_class(*self, name)
}
- fn each_class<F>(self, mut callback: F)
+ fn each_class<F>(&self, mut callback: F)
where F: FnMut(&Atom)
{
if let Some(ref attr) = self.get_attribute(&ns!(""), &atom!("class")) {
@@ -1729,8 +1729,8 @@ impl<'a> style::node::TElement<'a> for &'a Element {
}
}
}
- fn has_nonzero_border(self) -> bool {
- let table_element: Option<&HTMLTableElement> = HTMLTableElementCast::to_ref(self);
+ fn has_servo_nonzero_border(&self) -> bool {
+ let table_element: Option<&HTMLTableElement> = HTMLTableElementCast::to_ref(*self);
match table_element {
None => false,
Some(this) => {
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 9e2c56c8d22..851140e3929 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -2492,59 +2492,59 @@ impl<'a> VirtualMethods for &'a Node {
}
}
-impl<'a> style::node::TNode<'a> for &'a Node {
+impl<'a> style::node::TNode for &'a Node {
type Element = &'a Element;
- fn parent_node(self) -> Option<&'a Node> {
+ fn parent_node(&self) -> Option<&'a Node> {
(*self).parent_node.get()
.map(|node| node.root().get_unsound_ref_forever())
}
- fn first_child(self) -> Option<&'a Node> {
+ fn first_child(&self) -> Option<&'a Node> {
(*self).first_child.get()
.map(|node| node.root().get_unsound_ref_forever())
}
- fn last_child(self) -> Option<&'a Node> {
+ fn last_child(&self) -> Option<&'a Node> {
(*self).last_child.get()
.map(|node| node.root().get_unsound_ref_forever())
}
- fn prev_sibling(self) -> Option<&'a Node> {
+ fn prev_sibling(&self) -> Option<&'a Node> {
(*self).prev_sibling.get()
.map(|node| node.root().get_unsound_ref_forever())
}
- fn next_sibling(self) -> Option<&'a Node> {
+ fn next_sibling(&self) -> Option<&'a Node> {
(*self).next_sibling.get()
.map(|node| node.root().get_unsound_ref_forever())
}
- fn is_document(self) -> bool {
+ fn is_document(&self) -> bool {
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
// of disambiguating methods.
fn is_document<'a, T: DocumentDerived>(this: &T) -> bool {
this.is_document()
}
- is_document(self)
+ is_document(*self)
}
- fn is_element(self) -> bool {
+ fn is_element(&self) -> bool {
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
// of disambiguating methods.
fn is_element<'a, T: ElementDerived>(this: &T) -> bool {
this.is_element()
}
- is_element(self)
+ is_element(*self)
}
- fn as_element(self) -> &'a Element {
- ElementCast::to_ref(self).unwrap()
+ fn as_element(&self) -> &'a Element {
+ ElementCast::to_ref(*self).unwrap()
}
- fn match_attr<F>(self, attr: &AttrSelector, test: F) -> bool
+ fn match_attr<F>(&self, attr: &AttrSelector, test: F) -> bool
where F: Fn(&str) -> bool
{
let local_name = {
@@ -2577,25 +2577,9 @@ impl<'a> style::node::TNode<'a> for &'a Node {
}
}
- fn is_html_element_in_html_document(self) -> bool {
+ fn is_html_element_in_html_document(&self) -> bool {
self.as_element().html_element_in_html_document()
}
-
- fn has_changed(self) -> bool { self.get_has_changed() }
- #[allow(unsafe_code)]
- unsafe fn set_changed(self, value: bool) { self.set_has_changed(value) }
-
- fn is_dirty(self) -> bool { self.get_is_dirty() }
- #[allow(unsafe_code)]
- unsafe fn set_dirty(self, value: bool) { self.set_is_dirty(value) }
-
- fn has_dirty_siblings(self) -> bool { self.get_has_dirty_siblings() }
- #[allow(unsafe_code)]
- unsafe fn set_dirty_siblings(self, value: bool) { self.set_has_dirty_siblings(value) }
-
- fn has_dirty_descendants(self) -> bool { self.get_has_dirty_descendants() }
- #[allow(unsafe_code)]
- unsafe fn set_dirty_descendants(self, value: bool) { self.set_has_dirty_descendants(value) }
}
pub trait DisabledStateHelpers {