Add has_attr method to TElement.

If this is all the information the caller needs, we can get it from gecko without
worrying about atomization and string conversions.
This commit is contained in:
Bobby Holley 2016-06-23 14:13:50 -07:00
parent 7947afc699
commit 96af00fbb9
4 changed files with 20 additions and 4 deletions

View file

@ -386,6 +386,11 @@ impl<'le> TElement for ServoLayoutElement<'le> {
self.element.get_state_for_layout()
}
#[inline]
fn has_attr(&self, namespace: &Namespace, attr: &Atom) -> bool {
self.get_attr(namespace, attr).is_some()
}
#[inline]
fn get_attr(&self, namespace: &Namespace, name: &Atom) -> Option<&str> {
unsafe {