style: Don't go through all the part names if not there.

This uses the bit added for tracking part attributes in order to avoid doing
wasted work.

Differential Revision: https://phabricator.services.mozilla.com/D32644
This commit is contained in:
Emilio Cobos Álvarez 2019-06-11 17:42:09 +00:00
parent f0bf7d6481
commit 96594be65d
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A

View file

@ -590,6 +590,9 @@ impl<'le> GeckoElement<'le> {
#[inline(always)] #[inline(always)]
fn get_part_attr(&self) -> Option<&structs::nsAttrValue> { fn get_part_attr(&self) -> Option<&structs::nsAttrValue> {
if !self.has_part_attr() {
return None;
}
snapshot_helpers::find_attr(self.attrs(), &atom!("part")) snapshot_helpers::find_attr(self.attrs(), &atom!("part"))
} }
@ -623,6 +626,11 @@ impl<'le> GeckoElement<'le> {
} }
} }
#[inline]
fn has_part_attr(&self) -> bool {
self.as_node().get_bool_flag(nsINode_BooleanFlag::ElementHasPart)
}
#[inline] #[inline]
fn may_have_anonymous_children(&self) -> bool { fn may_have_anonymous_children(&self) -> bool {
self.as_node() self.as_node()