diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-02-02 12:15:59 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-02-05 11:54:01 +0100 |
commit | 1804f135ec1cde280b6e18f04513308c72b8ef92 (patch) | |
tree | b9578bed1c5c405178b7d2bb3283448dcd5e6428 /components/style/invalidation/stylesheets.rs | |
parent | 9c66b07b6728626b8bdddf24313c96579a7ad4b5 (diff) | |
download | servo-1804f135ec1cde280b6e18f04513308c72b8ef92.tar.gz servo-1804f135ec1cde280b6e18f04513308c72b8ef92.zip |
style: Optimize @keyframes rule insertions.
Bug: 1435214
Reviewed-by: xidorn,hiro
MozReview-Commit-ID: AHwhZynLBv
Diffstat (limited to 'components/style/invalidation/stylesheets.rs')
-rw-r--r-- | components/style/invalidation/stylesheets.rs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/components/style/invalidation/stylesheets.rs b/components/style/invalidation/stylesheets.rs index 0747bdaa6b1..5569628dc24 100644 --- a/components/style/invalidation/stylesheets.rs +++ b/components/style/invalidation/stylesheets.rs @@ -151,7 +151,7 @@ impl StylesheetInvalidationSet { } for rule in stylesheet.effective_rules(device, guard) { - self.collect_invalidations_for_rule(rule, guard); + self.collect_invalidations_for_rule(rule, guard, device); if self.fully_invalid { self.invalid_scopes.clear(); self.invalid_elements.clear(); @@ -393,8 +393,9 @@ impl StylesheetInvalidationSet { fn collect_invalidations_for_rule( &mut self, rule: &CssRule, - guard: &SharedRwLockReadGuard) - { + guard: &SharedRwLockReadGuard, + device: &Device, + ) { use stylesheets::CssRule::*; debug!("StylesheetInvalidationSet::collect_invalidations_for_rule"); debug_assert!(!self.fully_invalid, "Not worth to be here!"); @@ -422,7 +423,17 @@ impl StylesheetInvalidationSet { // information. We'll restyle when the font face loads, if // needed. } - Keyframes(..) | + Keyframes(ref lock) => { + let keyframes_rule = lock.read_with(guard); + if device.animation_name_may_be_referenced(&keyframes_rule.name) { + debug!(" > Found @keyframes rule potentially referenced \ + from the page, marking the whole tree invalid."); + self.fully_invalid = true; + } else { + // Do nothing, this animation can't affect the style of + // existing elements. + } + } CounterStyle(..) | Page(..) | Viewport(..) | |