Bug 1372068: Don't try to go through the whole subtree if there aren't actually any invalidations. r?heycam
MozReview-Commit-ID: Jtm4eJBWjEA
--- 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;
}
}