mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Preserve restyle hints after ForThrottledAnimationFlush restyle.
Those remaining restyle hints are needed for normal traversal later.
This commit is contained in:
parent
b688353c82
commit
e700a66e9f
2 changed files with 27 additions and 2 deletions
|
@ -61,6 +61,12 @@ impl RestyleData {
|
|||
*self = Self::new();
|
||||
}
|
||||
|
||||
/// Clear restyle flags and damage.
|
||||
fn clear_flags_and_damage(&mut self) {
|
||||
self.damage = RestyleDamage::empty();
|
||||
self.flags = RestyleFlags::empty();
|
||||
}
|
||||
|
||||
/// Returns whether this element or any ancestor is going to be
|
||||
/// reconstructed.
|
||||
pub fn reconstructed_self_or_ancestor(&self) -> bool {
|
||||
|
@ -331,4 +337,9 @@ impl ElementData {
|
|||
pub fn clear_restyle_state(&mut self) {
|
||||
self.restyle.clear();
|
||||
}
|
||||
|
||||
/// Drops restyle flags and damage from the element.
|
||||
pub fn clear_restyle_flags_and_damage(&mut self) {
|
||||
self.restyle.clear_flags_and_damage();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2729,13 +2729,27 @@ pub extern "C" fn Servo_NoteExplicitHints(element: RawGeckoElementBorrowed,
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_TakeChangeHint(element: RawGeckoElementBorrowed) -> nsChangeHint
|
||||
pub extern "C" fn Servo_TakeChangeHint(element: RawGeckoElementBorrowed,
|
||||
restyle_behavior: structs::TraversalRestyleBehavior) -> nsChangeHint
|
||||
{
|
||||
let element = GeckoElement(element);
|
||||
let damage = match element.mutate_data() {
|
||||
Some(mut data) => {
|
||||
let damage = data.restyle.damage;
|
||||
data.clear_restyle_state();
|
||||
if restyle_behavior == structs::TraversalRestyleBehavior::ForThrottledAnimationFlush {
|
||||
debug_assert!(data.restyle.is_restyle() || damage.is_empty(),
|
||||
"Restyle damage should be empty if the element was not restyled");
|
||||
// In the case where we call this function for post traversal for
|
||||
// flusing throttled animations (i.e. without normal restyle
|
||||
// traversal), we need to preserve restyle hints for normal restyle
|
||||
// traversal. Restyle hints for animations have been already
|
||||
// removed during animation-only traversal.
|
||||
debug_assert!(!data.restyle.hint.has_animation_hint(),
|
||||
"Animation restyle hints should have been already removed");
|
||||
data.clear_restyle_flags_and_damage();
|
||||
} else {
|
||||
data.clear_restyle_state();
|
||||
}
|
||||
damage
|
||||
}
|
||||
None => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue