servo: Merge #18214 - Try to update running CSS animations when CSS rules are changed (from hiikezoe:animation-name-change-in-css-rule); r=birtles

In the case where values in CSS rules changed directly by CSSOM, the old
value in the CSS rule block is immediately replaced by the new one. So if
the element, which is applied to the CSS rule, has running animations, the
new value is used during cascading process in animation-only restyle. Thus
in a subsequent normal restyle, we can't tell whether the value in the CSS
rule has changed or not. As a result, transitions may not be triggered
(bug 1393323) and CSS animations may not be cancelled if the updated
animation-name is 'none' (bug 1392851).

For the latter case of CSS animations where animation-name has been updated to
'none', this patch introduces a workaround whereby we trigger an update of
running animations whenever the traversal is triggered by changes to CSS rules
and we have existing CSS animations.

<!-- Please describe your changes on the following line: -->
https://bugzilla.mozilla.org/show_bug.cgi?id=1392851

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

Source-Repo: https://github.com/servo/servo
Source-Revision: 270d445f27631ee6388f837545a5440f50e0cafb

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 277586cd3f305facb70eb0faec9f731eec5ed1d3
This commit is contained in:
Hiroyuki Ikezoe 2017-08-24 06:48:53 -05:00
Родитель 875538a46b
Коммит b8d7e483e4
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -170,12 +170,12 @@ trait PrivateMatchMethods: TElement {
// If 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.
// has or will have 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 those @keyframes.
(context.shared.traversal_flags.contains(traversal_flags::ForCSSRuleChanges) &&
has_new_animation_style) ||
(has_new_animation_style || has_animations)) ||
!old_box_style.animations_equals(new_box_style) ||
(old_display_style == display::T::none &&
new_display_style != display::T::none &&