mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Preserve restyle hints other than animation hints in propagate() during animation-only restyle.
This commit is contained in:
parent
9d5dde2604
commit
69efaa09c9
2 changed files with 13 additions and 7 deletions
|
@ -19,6 +19,7 @@ use std::ops::Deref;
|
|||
use std::sync::Arc;
|
||||
use stylist::Stylist;
|
||||
use thread_state;
|
||||
use traversal::TraversalFlags;
|
||||
|
||||
/// The structure that represents the result of style computation. This is
|
||||
/// effectively a tuple of rules and computed values, that is, the rule node,
|
||||
|
@ -192,17 +193,22 @@ pub struct StoredRestyleHint(RestyleHint);
|
|||
|
||||
impl StoredRestyleHint {
|
||||
/// Propagates this restyle hint to a child element.
|
||||
pub fn propagate(&mut self) -> Self {
|
||||
pub fn propagate(&mut self, traversal_flags: &TraversalFlags) -> Self {
|
||||
use std::mem;
|
||||
|
||||
// If we have RESTYLE_CSS_ANIMATIONS restyle hint, it means we are in
|
||||
// the middle of an animation only restyle. In that case, we don't need
|
||||
// to propagate any restyle hints, and we need to remove ourselves.
|
||||
if self.0.contains(RESTYLE_CSS_ANIMATIONS) {
|
||||
self.0.remove(RESTYLE_CSS_ANIMATIONS);
|
||||
// In the middle of an animation only restyle, we don't need to
|
||||
// propagate any restyle hints, and we need to remove ourselves.
|
||||
if traversal_flags.for_animation_only() {
|
||||
if self.0.contains(RESTYLE_CSS_ANIMATIONS) {
|
||||
self.0.remove(RESTYLE_CSS_ANIMATIONS);
|
||||
}
|
||||
return Self::empty();
|
||||
}
|
||||
|
||||
debug_assert!(!self.0.contains(RESTYLE_CSS_ANIMATIONS),
|
||||
"There should not be any animation restyle hints \
|
||||
during normal traversal");
|
||||
|
||||
// Else we should clear ourselves, and return the propagated hint.
|
||||
let hint = mem::replace(&mut self.0, RestyleHint::empty());
|
||||
StoredRestyleHint(if hint.contains(RESTYLE_DESCENDANTS) {
|
||||
|
|
|
@ -601,7 +601,7 @@ pub fn recalc_style_at<E, D>(traversal: &D,
|
|||
"animation restyle hint should be handled during \
|
||||
animation-only restyles");
|
||||
r.recascade = false;
|
||||
r.hint.propagate()
|
||||
r.hint.propagate(&context.shared.traversal_flags)
|
||||
},
|
||||
};
|
||||
debug_assert!(data.has_current_styles() ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue