From 0d984c302bec74170ab120962f0af59ef04f6aac 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] Bug 1505489 - Don't go through all the part names if not there. r=jwatt This uses the bit added for tracking part attributes in order to avoid doing wasted work. Depends on D32643 Differential Revision: https://phabricator.services.mozilla.com/D32644 --HG-- extra : moz-landing-system : lando --- servo/components/style/gecko/wrapper.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/servo/components/style/gecko/wrapper.rs b/servo/components/style/gecko/wrapper.rs index aa59df56bde0..70eaa552ed5e 100644 --- a/servo/components/style/gecko/wrapper.rs +++ b/servo/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()