diff options
author | Josh Matthews <josh@joshmatthews.net> | 2014-09-18 09:20:19 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2014-09-18 09:20:19 -0400 |
commit | 9607b468bc50496c0de3706d22efaa6fdc68b089 (patch) | |
tree | 85615a722eb65681ebccee8d98dc47c7895573c9 /components/layout/wrapper.rs | |
parent | 7158cac2dcaabacede36924f52167b8e7b402e7a (diff) | |
download | servo-9607b468bc50496c0de3706d22efaa6fdc68b089.tar.gz servo-9607b468bc50496c0de3706d22efaa6fdc68b089.zip |
Revert "script: Use atom comparison in more places, especially for attributes." for persistent test failures.
This reverts commit 874db261046d6155b1942efa106d2e0014295d6d.
Diffstat (limited to 'components/layout/wrapper.rs')
-rw-r--r-- | components/layout/wrapper.rs | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 01fcc4f2f43..bdabc3b5840 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -273,14 +273,15 @@ impl<'ln> TNode<LayoutElement<'ln>> for LayoutNode<'ln> { fn match_attr(&self, attr: &AttrSelector, test: |&str| -> bool) -> bool { assert!(self.is_element()) let name = if self.is_html_element_in_html_document() { - &attr.lower_name + attr.lower_name.as_slice() } else { - &attr.name + attr.name.as_slice() }; match attr.namespace { SpecificNamespace(ref ns) => { let element = self.as_element(); - element.get_attr(ns, name).map_or(false, |attr| test(attr)) + element.get_attr(ns, name) + .map_or(false, |attr| test(attr)) }, // FIXME: https://github.com/mozilla/servo/issues/1558 AnyNamespace => false, @@ -382,7 +383,7 @@ impl<'le> TElement for LayoutElement<'le> { } #[inline] - fn get_attr(&self, namespace: &Namespace, name: &Atom) -> Option<&'static str> { + fn get_attr(&self, namespace: &Namespace, name: &str) -> Option<&'static str> { unsafe { self.element.get_attr_val_for_layout(namespace, name) } } @@ -394,9 +395,7 @@ impl<'le> TElement for LayoutElement<'le> { ElementNodeTypeId(HTMLAnchorElementTypeId) | ElementNodeTypeId(HTMLAreaElementTypeId) | ElementNodeTypeId(HTMLLinkElementTypeId) => { - unsafe { - self.element.get_attr_val_for_layout(&namespace::Null, &satom!("href")) - } + unsafe { self.element.get_attr_val_for_layout(&namespace::Null, "href") } } _ => None, } @@ -410,9 +409,7 @@ impl<'le> TElement for LayoutElement<'le> { #[inline] fn get_id(&self) -> Option<Atom> { - unsafe { - self.element.get_attr_atom_for_layout(&namespace::Null, &satom!("id")) - } + unsafe { self.element.get_attr_atom_for_layout(&namespace::Null, "id") } } fn get_disabled_state(&self) -> bool { @@ -427,24 +424,11 @@ impl<'le> TElement for LayoutElement<'le> { } } - fn has_class(&self, name: &Atom) -> bool { + fn has_class(&self, name: &str) -> bool { unsafe { self.element.has_class_for_layout(name) } } - - fn each_class(&self, callback: |&Atom|) { - unsafe { - match self.element.get_classes_for_layout() { - None => {} - Some(ref classes) => { - for class in classes.iter() { - callback(class) - } - } - } - } - } } fn get_content(content_list: &content::T) -> String { @@ -774,10 +758,8 @@ pub struct ThreadSafeLayoutElement<'le> { impl<'le> ThreadSafeLayoutElement<'le> { #[inline] - pub fn get_attr(&self, namespace: &Namespace, name: &Atom) -> Option<&'static str> { - unsafe { - self.element.get_attr_val_for_layout(namespace, name) - } + pub fn get_attr(&self, namespace: &Namespace, name: &str) -> Option<&'static str> { + unsafe { self.element.get_attr_val_for_layout(namespace, name) } } } |