aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHiroyuki Ikezoe <hikezoe@mozilla.com>2017-07-18 19:13:22 +0900
committerHiroyuki Ikezoe <hikezoe@mozilla.com>2017-07-18 19:13:24 +0900
commitae55e51aaf65613a06d52bd9e27dae3802844e27 (patch)
tree1e42c37a7f856902e441203633845b1a82e9b70e
parent7b134440fc736450cc87470a78e94f80b9161679 (diff)
downloadservo-ae55e51aaf65613a06d52bd9e27dae3802844e27.tar.gz
servo-ae55e51aaf65613a06d52bd9e27dae3802844e27.zip
Factor out restyle_kind_for_animation.
-rw-r--r--components/style/data.rs36
1 files changed, 24 insertions, 12 deletions
diff --git a/components/style/data.rs b/components/style/data.rs
index 2478f9761c3..5d2771121a1 100644
--- a/components/style/data.rs
+++ b/components/style/data.rs
@@ -278,25 +278,17 @@ impl ElementData {
pub fn restyle_kind(&self,
shared_context: &SharedStyleContext)
-> RestyleKind {
+ if shared_context.traversal_flags.for_animation_only() {
+ return self.restyle_kind_for_animation(shared_context);
+ }
+
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;
}
let hint = self.restyle.hint;
- 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;
}
@@ -312,6 +304,26 @@ impl ElementData {
return RestyleKind::CascadeOnly;
}
+ /// Returns the kind of restyling for animation-only restyle.
+ pub fn restyle_kind_for_animation(&self,
+ shared_context: &SharedStyleContext)
+ -> RestyleKind {
+ debug_assert!(shared_context.traversal_flags.for_animation_only());
+ debug_assert!(self.has_styles(),
+ "Unstyled element shouldn't be traversed during \
+ animation-only traversal");
+
+ // return either CascadeWithReplacements or CascadeOnly in case of
+ // animation-only restyle. I.e. animation-only restyle never does
+ // selector matching.
+ let hint = self.restyle.hint;
+ if hint.has_animation_hint() {
+ return RestyleKind::CascadeWithReplacements(hint & RestyleHint::for_animations());
+ }
+ return RestyleKind::CascadeOnly;
+
+ }
+
/// Return true if important rules are different.
/// We use this to make sure the cascade of off-main thread animations is correct.
/// Note: Ignore custom properties for now because we only support opacity and transform