Closed Bug 1375787 Opened 7 years ago Closed 7 years ago

stylo: Need to check has_new_animation_style flag along with traversal_flags.for_css_rule_changes() in needs_animations_update()

Categories

(Core :: CSS Parsing and Computation, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: hiro, Assigned: hiro)

References

Details

Attachments

(1 file)

If there is no CSS animation on the element in the case the traversal is invoked by FOR_CSS_RULE_CHANGES, we don't need to call update_animations() at all.
The title was not quite right. We need to check has_new_animation_style instead.  For example, an element has an animation style but there is no @keyframes rules corresponding to the animation style.  In this case the element has no running animation, jut has the animation style.
Summary: stylo :Need to check has_animations flag along with traversal_flags.for_css_rule_changes() in needs_animations_update() → stylo :Need to check has_new_animation_style flag along with traversal_flags.for_css_rule_changes() in needs_animations_update()
Assignee: nobody → hikezoe
Priority: -- → P1
Summary: stylo :Need to check has_new_animation_style flag along with traversal_flags.for_css_rule_changes() in needs_animations_update() → stylo: Need to check has_new_animation_style flag along with traversal_flags.for_css_rule_changes() in needs_animations_update()
Comment on attachment 8880977 [details]
Bug 1375787 - Check has_new_animation_style along with for_css_rule_changes() in needs_animations_update().

https://reviewboard.mozilla.org/r/152336/#review157588

::: servo/components/style/matching.rs:656
(Diff revision 1)
>          old_values.map_or(has_new_animation_style, |old| {
>              let old_box_style = old.get_box();
>              let old_display_style = old_box_style.clone_display();
>              let new_display_style = new_box_style.clone_display();
>  
> -            // If the traverse is triggered by CSS rule changes,
> +            // In case the traverse is triggered by CSS rule changes,

"If the traverse..." is fine

::: servo/components/style/matching.rs:661
(Diff revision 1)
> -            // If the traverse is triggered by CSS rule changes,
> -            // we need to try to update all CSS animations.
> -            context.shared.traversal_flags.for_css_rule_changes() ||
> +            // In case the traverse is triggered by CSS rule changes,
> +            // we need to try to update all CSS animations on the element
> +            // if the element has CSS animation style regardless of whether
> +            // the animation is running or not.
> +            // TODO: We should check which @keyframes changed/added/deleted
> +            // and update only animations corresponding to the @keyframes.

Nit: ...corresponding to those @keyframes.

::: servo/components/style/matching.rs:663
(Diff revision 1)
> -            context.shared.traversal_flags.for_css_rule_changes() ||
> +            // if the element has CSS animation style regardless of whether
> +            // the animation is running or not.
> +            // TODO: We should check which @keyframes changed/added/deleted
> +            // and update only animations corresponding to the @keyframes.
> +            (context.shared.traversal_flags.for_css_rule_changes() &&
> +             (has_new_animation_style)) ||

I don't think we need the () around has_new_animation_style here
Attachment #8880977 - Flags: review?(bbirtles) → review+
https://hg.mozilla.org/integration/autoland/rev/ab348cba6c56cf0dfb4acaccee1bfa262ef3b2d8
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
No longer depends on: 1377128
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: