style: Add a missing fast-path in GeckoElement::each_class. draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 01 Dec 2017 20:36:29 +0100
changeset 706635 679bc0250123c5e696c94109666b035a33b10a1b
parent 706634 55a4d79187e839bcc2a1b0b018866ff955b400cf
child 706636 320ff19f0e905a05e9f2240ff9954c73257ba498
child 706638 b7ce8e798aea16f55b89e8cb5392bd9c010b97de
child 706640 cefb8b5df15d463cbbef413fd54c57d1a25cd52b
child 706642 ee1009c5b8ec09345871e4bdfd37306ec850eaad
push id91862
push userbmo:emilio@crisal.io
push dateSat, 02 Dec 2017 23:34:31 +0000
milestone59.0a1
style: Add a missing fast-path in GeckoElement::each_class. This shows up when inserting elements in the bloom filter. Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
servo/components/style/gecko/wrapper.rs
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -1119,16 +1119,20 @@ impl<'le> TElement for GeckoElement<'le>
             Some(Atom::from(ptr))
         }
     }
 
     fn each_class<F>(&self, callback: F)
     where
         F: FnMut(&Atom),
     {
+        if !self.may_have_class() {
+            return;
+        }
+
         snapshot_helpers::each_class(self.0, callback, Gecko_ClassOrClassList)
     }
 
     #[inline]
     fn has_snapshot(&self) -> bool {
         self.flags() & (ELEMENT_HAS_SNAPSHOT as u32) != 0
     }