diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-05-26 22:16:14 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-05-29 20:27:41 +0200 |
commit | ebd6f47be34729c66af9024d96e82f907cc270c6 (patch) | |
tree | bc1d591848411ae661e30bc2bc4b76241834dcf8 | |
parent | f569274cca74efa20a9fc6d4a47b48fd50e29b17 (diff) | |
download | servo-ebd6f47be34729c66af9024d96e82f907cc270c6.tar.gz servo-ebd6f47be34729c66af9024d96e82f907cc270c6.zip |
Bug 1357583: style: Recurse into @import rules when looking at the added rules. r=heycam
Apparently my whole conception of how the list of sheets in the styleset looked
like was flawled, and we only ever get one append_sheet for the topmost
stylesheet, instead of one for each.
MozReview-Commit-ID: FMClygMJkTc
-rw-r--r-- | components/style/invalidation/mod.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/components/style/invalidation/mod.rs b/components/style/invalidation/mod.rs index b720126b405..864f53db93b 100644 --- a/components/style/invalidation/mod.rs +++ b/components/style/invalidation/mod.rs @@ -182,6 +182,9 @@ impl StylesheetInvalidationSet { } /// Collects invalidations for a given list of CSS rules. + /// + /// TODO(emilio): Convert stylesheet.effective_rules into an iterator to + /// share code. This needs the ability to stop ASAP. fn collect_invalidations_for_rule_list( &mut self, rules: &CssRules, @@ -294,8 +297,20 @@ impl StylesheetInvalidationSet { Namespace(..) => { // Irrelevant to which selector scopes match. } - Import(..) => { - // We'll visit the appropriate stylesheet if/when it matters. + // NB: We need to do it here, we won't visit the appropriate sheet + // otherwise! + Import(ref lock) => { + let import_rule = lock.read_with(guard); + + let mq = import_rule.stylesheet.media.read_with(guard); + if !mq.evaluate(stylist.device(), stylist.quirks_mode()) { + return true; + } + + self.collect_invalidations_for_rule_list( + import_rule.stylesheet.rules.read_with(guard), + stylist, + guard); } Media(ref lock) => { let media_rule = lock.read_with(guard); |