mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Trigger animation-only restyle without normal restyle.
In some cases, e.g. mouse event, we need to request an animation-only restyle to force flush all throttled animations when we handle an event with coordinates. This restyle shouldn't trigger a normal restyle, and add a different traversal flag, TraversalRestyleBehavior::ForAnimationOnly, to check.
This commit is contained in:
parent
fe028e045a
commit
10a1b8281d
3 changed files with 1321 additions and 1232 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -250,20 +250,29 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed,
|
|||
debug!("Servo_TraverseSubtree: {:?}", element);
|
||||
|
||||
let traversal_flags = match (root_behavior, restyle_behavior) {
|
||||
(Root::Normal, Restyle::Normal) => TraversalFlags::empty(),
|
||||
(Root::UnstyledChildrenOnly, Restyle::Normal) => UNSTYLED_CHILDREN_ONLY,
|
||||
(Root::Normal, Restyle::Normal) |
|
||||
(Root::Normal, Restyle::ForAnimationOnly)
|
||||
=> TraversalFlags::empty(),
|
||||
(Root::UnstyledChildrenOnly, Restyle::Normal) |
|
||||
(Root::UnstyledChildrenOnly, Restyle::ForAnimationOnly)
|
||||
=> UNSTYLED_CHILDREN_ONLY,
|
||||
(Root::Normal, Restyle::ForReconstruct) => FOR_RECONSTRUCT,
|
||||
_ => panic!("invalid combination of TraversalRootBehavior and TraversalRestyleBehavior"),
|
||||
};
|
||||
|
||||
if element.has_animation_only_dirty_descendants() ||
|
||||
element.has_animation_restyle_hints() {
|
||||
let needs_animation_only_restyle = element.has_animation_only_dirty_descendants() ||
|
||||
element.has_animation_restyle_hints();
|
||||
if needs_animation_only_restyle {
|
||||
traverse_subtree(element,
|
||||
raw_data,
|
||||
traversal_flags | ANIMATION_ONLY,
|
||||
unsafe { &*snapshots });
|
||||
}
|
||||
|
||||
if restyle_behavior == Restyle::ForAnimationOnly {
|
||||
return needs_animation_only_restyle;
|
||||
}
|
||||
|
||||
traverse_subtree(element,
|
||||
raw_data,
|
||||
traversal_flags,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue