mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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);
|
debug!("Servo_TraverseSubtree: {:?}", element);
|
||||||
|
|
||||||
let traversal_flags = match (root_behavior, restyle_behavior) {
|
let traversal_flags = match (root_behavior, restyle_behavior) {
|
||||||
(Root::Normal, Restyle::Normal) => TraversalFlags::empty(),
|
(Root::Normal, Restyle::Normal) |
|
||||||
(Root::UnstyledChildrenOnly, Restyle::Normal) => UNSTYLED_CHILDREN_ONLY,
|
(Root::Normal, Restyle::ForAnimationOnly)
|
||||||
|
=> TraversalFlags::empty(),
|
||||||
|
(Root::UnstyledChildrenOnly, Restyle::Normal) |
|
||||||
|
(Root::UnstyledChildrenOnly, Restyle::ForAnimationOnly)
|
||||||
|
=> UNSTYLED_CHILDREN_ONLY,
|
||||||
(Root::Normal, Restyle::ForReconstruct) => FOR_RECONSTRUCT,
|
(Root::Normal, Restyle::ForReconstruct) => FOR_RECONSTRUCT,
|
||||||
_ => panic!("invalid combination of TraversalRootBehavior and TraversalRestyleBehavior"),
|
_ => panic!("invalid combination of TraversalRootBehavior and TraversalRestyleBehavior"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if element.has_animation_only_dirty_descendants() ||
|
let needs_animation_only_restyle = element.has_animation_only_dirty_descendants() ||
|
||||||
element.has_animation_restyle_hints() {
|
element.has_animation_restyle_hints();
|
||||||
|
if needs_animation_only_restyle {
|
||||||
traverse_subtree(element,
|
traverse_subtree(element,
|
||||||
raw_data,
|
raw_data,
|
||||||
traversal_flags | ANIMATION_ONLY,
|
traversal_flags | ANIMATION_ONLY,
|
||||||
unsafe { &*snapshots });
|
unsafe { &*snapshots });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if restyle_behavior == Restyle::ForAnimationOnly {
|
||||||
|
return needs_animation_only_restyle;
|
||||||
|
}
|
||||||
|
|
||||||
traverse_subtree(element,
|
traverse_subtree(element,
|
||||||
raw_data,
|
raw_data,
|
||||||
traversal_flags,
|
traversal_flags,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue