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()