Remove get_attrs from TElement.

This should just be a helper.
This commit is contained in:
Bobby Holley 2016-06-23 14:06:19 -07:00
parent a0c425fbef
commit 7947afc699
3 changed files with 7 additions and 15 deletions

View file

@ -392,13 +392,6 @@ impl<'le> TElement for ServoLayoutElement<'le> {
(*self.element.unsafe_get()).get_attr_val_for_layout(namespace, name) (*self.element.unsafe_get()).get_attr_val_for_layout(namespace, name)
} }
} }
#[inline]
fn get_attrs(&self, name: &Atom) -> Vec<&str> {
unsafe {
(*self.element.unsafe_get()).get_attr_vals_for_layout(name)
}
}
} }
@ -561,7 +554,10 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
self.get_attr(ns, name).map_or(false, |attr| test(attr)) self.get_attr(ns, name).map_or(false, |attr| test(attr))
}, },
NamespaceConstraint::Any => { NamespaceConstraint::Any => {
self.get_attrs(name).iter().any(|attr| test(*attr)) let attrs = unsafe {
(*self.element.unsafe_get()).get_attr_vals_for_layout(name)
};
attrs.iter().any(|attr| test(*attr))
} }
} }
} }

View file

@ -208,7 +208,6 @@ pub trait TElement : Sized + Copy + Clone + ElementExt + PresentationalHintsSynt
fn get_state(&self) -> ElementState; fn get_state(&self) -> ElementState;
fn get_attr<'a>(&'a self, namespace: &Namespace, attr: &Atom) -> Option<&'a str>; fn get_attr<'a>(&'a self, namespace: &Namespace, attr: &Atom) -> Option<&'a str>;
fn get_attrs<'a>(&'a self, attr: &Atom) -> Vec<&'a str>;
/// Properly marks nodes as dirty in response to restyle hints. /// Properly marks nodes as dirty in response to restyle hints.
fn note_restyle_hint(&self, mut hint: RestyleHint) { fn note_restyle_hint(&self, mut hint: RestyleHint) {

View file

@ -369,11 +369,6 @@ impl<'le> TElement for GeckoElement<'le> {
reinterpret_string(ptr, length) reinterpret_string(ptr, length)
} }
} }
#[inline]
fn get_attrs<'a>(&'a self, _name: &Atom) -> Vec<&'a str> {
unimplemented!()
}
} }
impl<'le> PresentationalHintsSynthetizer for GeckoElement<'le> { impl<'le> PresentationalHintsSynthetizer for GeckoElement<'le> {
@ -519,7 +514,9 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
self.get_attr(ns, name).map_or(false, |attr| test(attr)) self.get_attr(ns, name).map_or(false, |attr| test(attr))
}, },
NamespaceConstraint::Any => { NamespaceConstraint::Any => {
self.get_attrs(name).iter().any(|attr| test(*attr)) // We should probably pass the atom into gecko and let it match
// against attributes across namespaces.
unimplemented!()
} }
} }
} }