diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-06-13 20:28:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-13 20:28:18 -0700 |
commit | 5b3fb62b0914e81a161fcefbf1cf5230661af73e (patch) | |
tree | 789840c9ee4b8a12e379a99598d841ec0a457d1e /components | |
parent | d28324d9eb1dd484c322698d2acb64831637c7ee (diff) | |
parent | 8d519011d88a310acd9177c920f06d9a94c793de (diff) | |
download | servo-5b3fb62b0914e81a161fcefbf1cf5230661af73e.tar.gz servo-5b3fb62b0914e81a161fcefbf1cf5230661af73e.zip |
Auto merge of #17305 - hiikezoe:restyle-kind-fix, r=emilio
Don't process RestyleKind::MatchAndCascade during animation-only rest…
…yle.
<!-- Please describe your changes on the following line: -->
https://bugzilla.mozilla.org/show_bug.cgi?id=1372335
---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes do not require tests because it's for stylo
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17305)
<!-- Reviewable:end -->
Diffstat (limited to 'components')
-rw-r--r-- | components/style/data.rs | 21 | ||||
-rw-r--r-- | components/style/traversal.rs | 7 |
2 files changed, 25 insertions, 3 deletions
diff --git a/components/style/data.rs b/components/style/data.rs index 677b4d78567..d96cfafa9fe 100644 --- a/components/style/data.rs +++ b/components/style/data.rs @@ -509,6 +509,7 @@ pub struct ElementData { } /// The kind of restyle that a single element should do. +#[derive(Debug)] pub enum RestyleKind { /// We need to run selector matching plus re-cascade, that is, a full /// restyle. @@ -573,22 +574,38 @@ impl ElementData { /// Returns the kind of restyling that we're going to need to do on this /// element, based of the stored restyle hint. - pub fn restyle_kind(&self) -> RestyleKind { + pub fn restyle_kind(&self, + shared_context: &SharedStyleContext) + -> RestyleKind { debug_assert!(!self.has_styles() || self.has_invalidations(), "Should've stopped earlier"); if !self.has_styles() { + debug_assert!(!shared_context.traversal_flags.for_animation_only(), + "Unstyled element shouldn't be traversed during \ + animation-only traversal"); return RestyleKind::MatchAndCascade; } debug_assert!(self.restyle.is_some()); let restyle_data = self.restyle.as_ref().unwrap(); - let hint = restyle_data.hint.0; + + if shared_context.traversal_flags.for_animation_only() { + // return either CascadeWithReplacements or CascadeOnly in case of + // animation-only restyle. + if hint.has_animation_hint() { + return RestyleKind::CascadeWithReplacements(hint & RestyleHint::for_animations()); + } + return RestyleKind::CascadeOnly; + } + if hint.match_self() { return RestyleKind::MatchAndCascade; } if hint.has_replacements() { + debug_assert!(!hint.has_animation_hint(), + "Animation only restyle hint should have already processed"); return RestyleKind::CascadeWithReplacements(hint & RestyleHint::replacements()); } diff --git a/components/style/traversal.rs b/components/style/traversal.rs index 1aa6415a1a2..53e0dc38281 100644 --- a/components/style/traversal.rs +++ b/components/style/traversal.rs @@ -786,10 +786,15 @@ fn compute_style<E, D>(_traversal: &D, use sharing::StyleSharingResult::*; context.thread_local.statistics.elements_styled += 1; - let kind = data.restyle_kind(); + let kind = data.restyle_kind(context.shared); + + debug!("compute_style: {:?} (kind={:?})", element, kind); match kind { MatchAndCascade => { + debug_assert!(!context.shared.traversal_flags.for_animation_only(), + "MatchAndCascade shouldn't be processed during \ + animation-only traversal"); // Ensure the bloom filter is up to date. context.thread_local.bloom_filter .insert_parents_recovering(element, |