From 3fd8a534d7f657b4b9df026297834dee0a091534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 23 Aug 2017 14:06:44 +0200 Subject: [PATCH] style: Rename SheetRebuildKind::rebuild_invalidation to should_rebuild_invalidation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Emilio Cobos Álvarez --- components/style/stylesheet_set.rs | 2 +- components/style/stylist.rs | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/components/style/stylesheet_set.rs b/components/style/stylesheet_set.rs index 98abfbbb1c7..eb444b556f5 100644 --- a/components/style/stylesheet_set.rs +++ b/components/style/stylesheet_set.rs @@ -94,7 +94,7 @@ pub enum SheetRebuildKind { impl SheetRebuildKind { /// Whether the stylesheet invalidation data should be rebuilt. - pub fn rebuild_invalidation(&self) -> bool { + pub fn should_rebuild_invalidation(&self) -> bool { matches!(*self, SheetRebuildKind::Full) } } diff --git a/components/style/stylist.rs b/components/style/stylist.rs index 4496e6bb465..bd3c30cce05 100644 --- a/components/style/stylist.rs +++ b/components/style/stylist.rs @@ -216,7 +216,7 @@ impl DocumentCascadeData { let origin_cascade_data = self.per_origin.borrow_mut_for_origin(&origin); - if rebuild_kind.rebuild_invalidation() { + if rebuild_kind.should_rebuild_invalidation() { origin_cascade_data .effective_media_query_results .saw_effective(stylesheet); @@ -274,7 +274,7 @@ impl DocumentCascadeData { map.insert(rule, quirks_mode); - if rebuild_kind.rebuild_invalidation() { + if rebuild_kind.should_rebuild_invalidation() { origin_cascade_data .invalidation_map .note_selector(selector, quirks_mode); @@ -299,20 +299,24 @@ impl DocumentCascadeData { } origin_cascade_data.rules_source_order += 1; } - CssRule::Import(ref lock) if rebuild_kind.rebuild_invalidation() => { - let import_rule = lock.read_with(guard); - origin_cascade_data - .effective_media_query_results - .saw_effective(import_rule); + CssRule::Import(ref lock) => { + if rebuild_kind.should_rebuild_invalidation() { + let import_rule = lock.read_with(guard); + origin_cascade_data + .effective_media_query_results + .saw_effective(import_rule); + } // NOTE: effective_rules visits the inner stylesheet if // appropriate. } - CssRule::Media(ref lock) if rebuild_kind.rebuild_invalidation() => { - let media_rule = lock.read_with(guard); - origin_cascade_data - .effective_media_query_results - .saw_effective(media_rule); + CssRule::Media(ref lock) => { + if rebuild_kind.should_rebuild_invalidation() { + let media_rule = lock.read_with(guard); + origin_cascade_data + .effective_media_query_results + .saw_effective(media_rule); + } } CssRule::Keyframes(ref keyframes_rule) => { let keyframes_rule = keyframes_rule.read_with(guard);