Bug 1372068: Don't try to go through the whole subtree if there aren't actually any invalidations. r?heycam draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 12 Jun 2017 04:51:00 +0200
changeset 592329 9522873f7f709d8badc2681927a0589433327a2b
parent 592298 438421f5767b8e034897e51184d6eaff7bb404cf
child 592330 e169eae51f8dde42f777191e44fb3c2a2ea59144
push id63341
push userbmo:emilio+bugs@crisal.io
push dateMon, 12 Jun 2017 03:00:20 +0000
reviewersheycam
bugs1372068
milestone55.0a1
Bug 1372068: Don't try to go through the whole subtree if there aren't actually any invalidations. r?heycam MozReview-Commit-ID: Jtm4eJBWjEA
servo/components/style/invalidation/stylesheets.rs
--- a/servo/components/style/invalidation/stylesheets.rs
+++ b/servo/components/style/invalidation/stylesheets.rs
@@ -149,16 +149,21 @@ impl StylesheetInvalidationSet {
 
         if self.fully_invalid {
             debug!("process_invalidations_in_subtree: fully_invalid({:?})",
                    element);
             data.ensure_restyle().hint.insert(StoredRestyleHint::subtree());
             return true;
         }
 
+        if self.invalid_scopes.is_empty() {
+            debug!("process_invalidations_in_subtree: empty invalidation set");
+            return false;
+        }
+
         for scope in &self.invalid_scopes {
             if scope.matches(element) {
                 debug!("process_invalidations_in_subtree: {:?} matched {:?}",
                        element, scope);
                 data.ensure_restyle().hint.insert(StoredRestyleHint::subtree());
                 return true;
             }
         }