From 96594be65d131fed2aad55187fa291ab8a1d8934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 11 Jun 2019 17:42:09 +0000 Subject: [PATCH] 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 --- components/style/gecko/wrapper.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index aa59df56bde..70eaa552ed5 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -590,6 +590,9 @@ impl<'le> GeckoElement<'le> { #[inline(always)] fn get_part_attr(&self) -> Option<&structs::nsAttrValue> { + if !self.has_part_attr() { + return None; + } 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] fn may_have_anonymous_children(&self) -> bool { self.as_node()