Commit graph

318 commits

Author SHA1 Message Date
Boris Chiou
bf583442cc Bug 1888317 - Use AnimatedPropertyIDSet for EffectSet::mPropertiesForAnimationsLevel. r=layout-reviewers,zrhoffman,emilio
We keep a set of properties which are running on the
`CascadeLevel::Animations`, to make sure we compose the correct properties
for the rule on Animations/Transitions cascade level.

In other words, without this patch, we may accidentally compose an
animation rule for `CascadeLevel::Animations` (from the KeyframeEffect of
the existing transition), even if we don't have any running animations,
if this transition property is a custom property.

The resolution is to use `AnimatedPropertyIDSet`, for
`mPropertiesForAnimationsLevel`, so we can skip the custom properties which
shouldn't belong to Animations cascade level when composing them.

Note that we don't change the logic, and we are still using
`nsCSSPropertyIDSet` for `EffectSet::mPropertiesWithImportantRules`
because compositor animations don't allow custom properties now.
(This could be a future work I guess, if we are using custom property
values for opacity, translate, rotate, scale, etc.)

Also, I noticed the subtest, "No transition when removing @property rule",
is similar to the testcase in this bug, and so it got passed as well.

Differential Revision: https://phabricator.services.mozilla.com/D210589
2024-05-21 16:55:00 +00:00
Emilio Cobos Álvarez
683eb4d360 Bug 1888748 - Ensure animations started on the same tick share ready time. r=birtles
Even if they're not painted.

Differential Revision: https://phabricator.services.mozilla.com/D207346
2024-04-17 06:07:17 +00:00
Olli Pettay
672dda40c9 Bug 1890002 - Don't create DOM event for those animation events which don't need to be dispatched, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D206819
2024-04-06 08:04:29 +00:00
Emilio Cobos Álvarez
47bd61fc35 Bug 1865955 - Make sure that the compositor and the main thread start time match. r=birtles
The regressing bug made a crucial mistake which is setting the
compositor animation ready time to the _current_ refresh driver time,
even though the main thread will use the _next_ refresh driver time to
do that.

That means that the compositor and main thread can be desynchronized by
one frame, which depending on the main thread workload can be a lot.

Differential Revision: https://phabricator.services.mozilla.com/D199614
2024-01-28 11:33:46 +00:00
Sandor Molnar
b1364f7256 Backed out changeset 70bea8910bc5 (bug 1865955) for causing mochitest failures at dt / mochitest failures at animation. CLOSED TREE 2024-01-27 03:58:31 +02:00
Emilio Cobos Álvarez
ee970b1fe9 Bug 1865955 - Make sure that the compositor and the main thread start time match. r=birtles
The regressing bug made a crucial mistake which is setting the
compositor animation ready time to the _current_ refresh driver time,
even though the main thread will use the _next_ refresh driver time to
do that.

That means that the compositor and main thread can be desynchronized by
one frame, which depending on the main thread workload can be a lot.

Depends on D199613

Differential Revision: https://phabricator.services.mozilla.com/D199614
2024-01-26 21:00:23 +00:00
Sandor Molnar
6b30ec46d0 Backed out changeset 345c20147d40 (bug 1865955) for causing dt/mochitest animation related failures. CLOSED TREE 2024-01-26 21:03:19 +02:00
Emilio Cobos Álvarez
81450a18ce Bug 1865955 - Make sure that the compositor and the main thread start time match. r=birtles
The regressing bug made a crucial mistake which is setting the
compositor animation ready time to the _current_ refresh driver time,
even though the main thread will use the _next_ refresh driver time to
do that.

That means that the compositor and main thread can be desynchronized by
one frame, which depending on the main thread workload can be a lot.

Depends on D199613

Differential Revision: https://phabricator.services.mozilla.com/D199614
2024-01-26 13:39:42 +00:00
Emilio Cobos Álvarez
5ceaedb992 Bug 1876321 - Remove mainthread sync with geometric animations pref. r=boris
Off-by-default since 121, let's remove the code to make stuff simpler.

Differential Revision: https://phabricator.services.mozilla.com/D199507
2024-01-24 20:10:45 +00:00
Zach Hoffman
7653a4f1c2 Bug 1846516 - [css-properties-values-api] Use AnimatedPropertyID to communicate between Gecko and Servo. r=emilio,layout-reviewers,firefox-style-system-reviewers
Co-authored-by: Frederic Wang <fred.wang@free.fr>
Co-authored-by: Emilio Cobos Álvarez <emilio@crisal.io>

Depends on D191059

Differential Revision: https://phabricator.services.mozilla.com/D191322
2023-12-18 09:24:08 +00:00
Zach Hoffman
cd5747dfbf Bug 1846516 - [css-properties-values-api] Introduce AnimatedPropertyID/AnimatedPropertIDSet. r=firefox-animation-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio,hiro
This will make possible to animate custom properties on Gecko side. For now, the
animation code keeps only dealing with nsCSSPropertyID, so behavior is unchanged.

Co-authored-by: Frederic Wang <fred.wang@free.fr>

Depends on D190816

Differential Revision: https://phabricator.services.mozilla.com/D191059
2023-12-18 09:24:08 +00:00
Cathie Chen
6e8972fb17 Bug 1866566 - When CSS animaiton is not associated with an owning element, content-visibility does not hide it, r=hiro
Differential Revision: https://phabricator.services.mozilla.com/D195560
2023-12-08 15:10:30 +00:00
Cathie Chen
e88b28e248 Bug 1866566 - If there is change in over-all relevancy, update HiddenByContentVisibility for animations, r=emilio,hiro
Differential Revision: https://phabricator.services.mozilla.com/D195009
2023-12-06 13:36:59 +00:00
Cosmin Sabou
5c95548994 Backed out changeset d9e8e468a2f2 (bug 1866566) for wpt failures on content-visibility-animation-with-scroll-timeline-in-hidden-subtree.html. 2023-12-05 18:59:19 +02:00
Cathie Chen
4395752c23 Bug 1866566 - If there is change in over-all relevancy, update HiddenByContentVisibility for animations, r=emilio,hiro
Differential Revision: https://phabricator.services.mozilla.com/D195009
2023-12-05 15:57:51 +00:00
Emilio Cobos Álvarez
ec7a1d06ff Bug 1864425 - Remove PendingAnimationTracker. r=birtles
Instead of starting transitions and animations as a result of a paint,
use the refresh driver tick to do this.

This sets the transition-ready time to the current time during the next
refresh driver tick that it was started on (see mSawTickWhilePending).

This is similar to what's described in the bugs comments, and seems to
work nicely in practice.

We could easily change that (current time) by a paint-based time if
needed (when available), which would be more similar to what we were
doing. But I'd rather do the simple thing for now, and land this shortly
after the soft freeze is over so that we have time to watch out for
regressions.

There's one regression on a test that birtles wrote (using an XHR doc
and switching the timeline to a rendered doc's timeline).

We use the timeline's document rather than the target document to
determine whether to trigger animations now. That's one of the cases
where we'd keep vsync perma-running without this patch, and Chrome also
fails that test. Maybe the test should be removed / the spec should be
tweaked to allow this behavior?

This causes some progression in some CSS transitions tests too, and I
added an extra test for the vsync behavior.

Over-all this is much simpler to reason about and I think we should try
to do this.

Differential Revision: https://phabricator.services.mozilla.com/D193583
2023-11-20 09:31:41 +00:00
Sylvestre Ledru
d0f6c7fc66 Bug 1856795 - Remove redundant member init r=emilio
Done with:
./mach static-analysis check --checks="-*, readability-redundant-member-init" --fix .

https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-member-init.html

Differential Revision: https://phabricator.services.mozilla.com/D190002
2023-10-15 15:29:02 +00:00
Cristina Horotan
6a90f5eded Backed out 2 changesets (bug 1856795) for causing build bustage at BasicEvents.h CLOSED TREE
Backed out changeset 1d98b028923a (bug 1856795)
Backed out changeset eae2ac93e17c (bug 1856795)
2023-10-14 21:42:14 +03:00
Sylvestre Ledru
cc8a0ee742 Bug 1856795 - Remove redundant member init r=emilio
Done with:
./mach static-analysis check --checks="-*, readability-redundant-member-init" --fix .

https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-member-init.html

Differential Revision: https://phabricator.services.mozilla.com/D190002
2023-10-14 17:34:26 +00:00
Emilio Cobos Álvarez
002a3c1893 Bug 1847200 - Don't create an internal event for transition events that we won't ever dispatch. r=smaug
This rejiggers a bit the transition event setup to not carry around an
InternalTransitionEvent. We create one once we're ready to dispatch it.

We can implement similar optimizations for animation and playback
events.

Also moves the markers out of line because those constructors were
getting rather unwieldy.

Differential Revision: https://phabricator.services.mozilla.com/D185425
2023-08-07 09:10:17 +00:00
Emilio Cobos Álvarez
6f904444e8 Bug 1832173 - Remove HasArcFFI for AnimationValue. r=boris
See previous patches for context.

Differential Revision: https://phabricator.services.mozilla.com/D177622
2023-05-11 08:25:36 +00:00
Emilio Cobos Álvarez
1c967006ab Bug 1831539 - Remove HasBoxFFI. r=boris
HasBoxFFI and HasArcFFI aren't great, see bug 1831242 as for examples of
why.

HasArcFFI requires a bit more care, but HasBoxFFI doesn't give us much
benefit. Instead use the same type in the FFI boundary.

Differential Revision: https://phabricator.services.mozilla.com/D177252
2023-05-09 11:07:26 +00:00
Adam Vandolder
868e17020e Bug 1809741 - commitStyles should enqueue attributeChanged for custom elements. r=edgar,emilio
Differential Revision: https://phabricator.services.mozilla.com/D166598
2023-01-19 01:55:03 +00:00
Boris Chiou
f856c08cc3 Bug 1774505 - Preserve the progress of null timeline for print. r=hiro
We always use the document timeline of the cloned document, and clone the
paused animation with the preserved progress, even if the original
timeline is null.

Differential Revision: https://phabricator.services.mozilla.com/D164712
2022-12-16 02:28:02 +00:00
Tom Ritter
a6f9cf1d33 Bug 1778510: Use the Timer Caller Type in Animation's timestamp code r=birtles
Depends on D151300

Differential Revision: https://phabricator.services.mozilla.com/D151301
2022-11-29 13:34:17 +00:00
Tom Ritter
3949bc4d55 Bug 1778510: Add a Timer Caller Type to Animation r=birtles
This will be needed for the various Timestamp related
members of Animations.

Depends on D151299

Differential Revision: https://phabricator.services.mozilla.com/D151300
2022-11-29 13:34:17 +00:00
Butkovits Atila
cb853b7f77 Backed out 33 changesets (bug 1778510) for causing build bustages at nsIGlobalObject.h. CLOSED TREE
Backed out changeset f2a53c9e497c
Backed out changeset 59350ca6f3f2 (bug 1778510)
Backed out changeset abbba7e72b57 (bug 1778510)
Backed out changeset 6cf7473afae8 (bug 1778510)
Backed out changeset 74fb5fed93ea (bug 1778510)
Backed out changeset 5b5dc70cdd0a (bug 1778510)
Backed out changeset ff93191cafd2 (bug 1778510)
Backed out changeset 39cc006b610c (bug 1778510)
Backed out changeset dfaef3ad17a9 (bug 1778510)
Backed out changeset 8fbabeb8244b (bug 1778510)
Backed out changeset 45051b62e3f1 (bug 1778510)
Backed out changeset 86c0923fd81f (bug 1778510)
Backed out changeset a49c0f69d519 (bug 1778510)
Backed out changeset cfad733d4aaf (bug 1778510)
Backed out changeset df6d0fe89d5b (bug 1778510)
Backed out changeset 704db76eab17 (bug 1778510)
Backed out changeset 0651c128e369 (bug 1778510)
Backed out changeset 1e650de647c0 (bug 1778510)
Backed out changeset fa15a3572741 (bug 1778510)
Backed out changeset 4ceffd409eae (bug 1778510)
Backed out changeset 47db43142c62 (bug 1778510)
Backed out changeset ebb21153aaac (bug 1778510)
Backed out changeset a87eaaec3f9c (bug 1778510)
Backed out changeset 43ad5ee21f79 (bug 1778510)
Backed out changeset 5f20af8e1263 (bug 1778510)
Backed out changeset b78576875db0 (bug 1778510)
Backed out changeset d801fdeac90b (bug 1778510)
Backed out changeset 5af032c628c0 (bug 1778510)
Backed out changeset 86aa59de11b4 (bug 1778510)
Backed out changeset 58642357a19c (bug 1778510)
Backed out changeset c575e824e291 (bug 1778510)
Backed out changeset 32a358de4843 (bug 1778510)
Backed out changeset 40e0708c01e7 (bug 1778510)
2022-11-28 23:14:52 +02:00
Tom Ritter
9e5db62471 Bug 1778510: Use the Timer Caller Type in Animation's timestamp code r=birtles
Depends on D151300

Differential Revision: https://phabricator.services.mozilla.com/D151301
2022-11-28 18:04:09 +00:00
Tom Ritter
3376fbf283 Bug 1778510: Add a Timer Caller Type to Animation r=birtles
This will be needed for the various Timestamp related
members of Animations.

Depends on D151299

Differential Revision: https://phabricator.services.mozilla.com/D151300
2022-11-28 18:04:08 +00:00
Cosmin Sabou
d245f666b9 Backed out 33 changesets (bug 1778510) for causing bp-hybrid bustages on nsIPrincipal.h. CLOSED TREE
Backed out changeset 282f589ede4a
Backed out changeset e23d03ba5a89 (bug 1778510)
Backed out changeset cbdb34cf7c8d (bug 1778510)
Backed out changeset d9a54521f3fb (bug 1778510)
Backed out changeset f5b7f8ce38b0 (bug 1778510)
Backed out changeset eb64607765a9 (bug 1778510)
Backed out changeset 18291e692834 (bug 1778510)
Backed out changeset bb71cc94a8be (bug 1778510)
Backed out changeset 507e84e1dafe (bug 1778510)
Backed out changeset 6d42e7a083ac (bug 1778510)
Backed out changeset 53799e6a46dd (bug 1778510)
Backed out changeset ff20d709839a (bug 1778510)
Backed out changeset 328d4d2df591 (bug 1778510)
Backed out changeset 9ba44fd8a440 (bug 1778510)
Backed out changeset eb1b7e30e519 (bug 1778510)
Backed out changeset c0927de6153b (bug 1778510)
Backed out changeset 02a306acd093 (bug 1778510)
Backed out changeset 2c5eecc4ad4c (bug 1778510)
Backed out changeset 38a9f45c9621 (bug 1778510)
Backed out changeset 35b7c7df62ce (bug 1778510)
Backed out changeset 187d71f42593 (bug 1778510)
Backed out changeset 450f4ccd6cd0 (bug 1778510)
Backed out changeset 915149e27da0 (bug 1778510)
Backed out changeset 9c6e85369f15 (bug 1778510)
Backed out changeset c6a9fe0ce713 (bug 1778510)
Backed out changeset a2f00462157e (bug 1778510)
Backed out changeset 5278e40b80c3 (bug 1778510)
Backed out changeset dba220581d93 (bug 1778510)
Backed out changeset 17a63044b0dc (bug 1778510)
Backed out changeset 68d607aaa121 (bug 1778510)
Backed out changeset e93004f91f6f (bug 1778510)
Backed out changeset 41d6d9f889e1 (bug 1778510)
Backed out changeset 28ac62019086 (bug 1778510)
2022-11-28 07:34:46 +02:00
Tom Ritter
2dcb5852a8 Bug 1778510: Use the Timer Caller Type in Animation's timestamp code r=birtles
Depends on D151300

Differential Revision: https://phabricator.services.mozilla.com/D151301
2022-11-28 04:21:28 +00:00
Tom Ritter
59f87c2eb7 Bug 1778510: Add a Timer Caller Type to Animation r=birtles
This will be needed for the various Timestamp related
members of Animations.

Depends on D151299

Differential Revision: https://phabricator.services.mozilla.com/D151300
2022-11-28 04:21:28 +00:00
Boris Chiou
5f4447e66d Bug 1799064 - Avoid potential call PostUpdate() twice in SetTimeline(). r=emilio
Basically, in SetTimelineNoUpdate(), we shouldn't call PostUpdate(). So we
shouldn't call SetCurrentTime() directly.

There is no behavior change. Just make sure we don't PostUpdate twice
while updating an existing CSS animation via changing animation-timeline.

Differential Revision: https://phabricator.services.mozilla.com/D161245
2022-11-04 14:05:43 +00:00
Boris Chiou
71eaeb877e Bug 1774275 - Support the basic dynamic change among document-timeline, scroll-timeline, and null timeline. r=hiro
This patch tries to let SetTimelineNoUpdate() and
SilentlySetCurrentTime() be closer to the spec,
https://drafts.csswg.org/web-animations-2/#setting-the-timeline, and
https://drafts.csswg.org/web-animations-2/#silently-set-the-current-time

Besides, I update the test in scroll-timeline-dynamic.tentative.html
when changing the timeline from a scroll-timeline to none. Per the spec,
we should preserve the progress (note: step 10 in
https://drafts.csswg.org/web-animations/#setting-the-timeline).

Differential Revision: https://phabricator.services.mozilla.com/D159656
2022-11-01 01:49:36 +00:00
Boris Chiou
722dd73447 Bug 1771282 - Introduce ScrollTimelineAnimationTracker. r=hiro
It's possible to change the timeline if the animation is in pending. So
we still need an animation tracker to track the scroll-linked
animations. Besides, per the spec, we should keep this animation in
pending if its timeline is inactive. So in this patch, we always put the
scroll-linked animations into ScrollTimelineAnimationTracker, and if we
change the timeline but the animation is still in pending, we move the
animation into the correct animation tracker if needed.

Using two different animation trackers because we would like to trigger
scroll-linked animations after frame construction and reflow,
and don't want to ensure the paint is scheduled.

Note:
1. All tests in scroll-timeline-dynamic.tentative.html are failed. We
   will fix them in Bug 1774275.
2. Drop `animation-duration: infinite` from
   progress-based-animation-animation-longhand-properties.tentative.html,
   because infinite is not defined in animation-duration in [css-animations-1].

Differential Revision: https://phabricator.services.mozilla.com/D159650
2022-10-31 23:25:17 +00:00
Sandor Molnar
6df873bdfb Backed out changeset 5ace811f7315 (bug 1771282) for causing bustages in dist/include/mozilla/RefPtr.h CLOSED TREE 2022-10-31 18:17:50 +02:00
Boris Chiou
195cc77578 Bug 1771282 - Introduce ScrollTimelineAnimationTracker. r=hiro
It's possible to change the timeline if the animation is in pending. So
we still need an animation tracker to track the scroll-linked
animations. Besides, per the spec, we should keep this animation in
pending if its timeline is inactive. So in this patch, we always put the
scroll-linked animations into ScrollTimelineAnimationTracker, and if we
change the timeline but the animation is still in pending, we move the
animation into the correct animation tracker if needed.

Using two different animation trackers because we would like to trigger
scroll-linked animations after frame construction and reflow,
and don't want to ensure the paint is scheduled.

Note:
1. All tests in scroll-timeline-dynamic.tentative.html are failed. We
   will fix them in Bug 1774275.
2. Drop `animation-duration: infinite` from
   progress-based-animation-animation-longhand-properties.tentative.html,
   because infinite is not defined in animation-duration in [css-animations-1].

Differential Revision: https://phabricator.services.mozilla.com/D159650
2022-10-31 15:31:57 +00:00
Boris Chiou
51b7446d62 Bug 1134538 - Avoid the computation of inf - inf for the interval end time. r=birtles
If both end time and start delay are Infinity, the result of interval
end time is undefined, so now we return zero duration to avoid the
assertion in StickyTimeDuration.

Differential Revision: https://phabricator.services.mozilla.com/D153818
2022-08-08 23:34:05 +00:00
Martin Robinson
2fbf04543f Bug 1777478 - Animations in content hidden by content-visibility should not fire events or resolve promises r=hiro
Keep a separate list of animations in the timeline that are hidden by
content visibility. This allows the DocumentTimeline to disconnect from
the refresh driver when all animations are hidden and prevents ticking
hidden animations in general.

Differential Revision: https://phabricator.services.mozilla.com/D150764
2022-07-19 09:57:21 +00:00
Boris Chiou
db1b58d707 Bug 1775327 - Part 2: Fix playing finished scroll animation on reversing scrolling. r=firefox-animation-reviewers,birtles
We have to make sure the scroll animations is still responsive at
boundaries even if it's playstate is finished.

This patch includes the update of UpdateFinishedState() to match the
spec, and make sure we still tick scroll animations at finished play state.

Getting a finished state might be strange for scroll animations, and this
might be a spec issue. However, for consistency with JS-generated animations,
we'd like to align the behaviors with other browsers, and make sure we are
still match the definition of finished state in the spec.

Besides, we have to use EndTime() on the compositor so
animation-iteration-count works properly.

Tests are in the last patch.

Differential Revision: https://phabricator.services.mozilla.com/D149940
2022-07-07 18:33:41 +00:00
Boris Chiou
ee025d7686 Bug 1775327 - Part 1: Make sure the scroll animation is still in active phase at boundaries. r=firefox-animation-reviewers,birtles
We have to introduce "at progress timeline boundary" which is defined in
web-animations-2 [1]. We need this to make sure the scroll animations
do not go into before phase or after phase.

The test of fill-mode should be together with delay, so I'd like to add the
tests in the last patch.

[1] https://drafts.csswg.org/web-animations-2/#at-progress-timeline-boundary

Differential Revision: https://phabricator.services.mozilla.com/D149684
2022-07-07 18:33:41 +00:00
Boris Chiou
6c723e6e0a Bug 1744850 - Drop ScrollTimeline:sTiming and introduce a normalized timing. r=birtles
`sTiming` is a hack and I believe animation-delay,
animation-iteration-count, animation-direction, and animation-fill-mode
should be meaningful for scroll-linked animations. (I will add the
tentative wpt in Bug 1775327.)

So we need to introduce a normalized timing when resolving the specified
timing.

Also, this patch makes the bug of printing scroll animations detectable.

No behavior is changed and I'd like to remove the magic values and do
normalization in Bug 1775327.

Note: Based on https://github.com/w3c/csswg-drafts/issues/4862 and
web-animations-2, we will introudce CSSNumberish for duration, current
time, and delay. That is, we will accept percentage for
animation-duration, animation-delay. However, Gecko doesn't support
CSSNumberish for those values, so we'd like to normalize these time values
in Bug 1775327. This patch is the 1st step: split the normalized
timing from the specified timing, and use it when resolving the
timing, for progress-based timeline.

Differential Revision: https://phabricator.services.mozilla.com/D149683
2022-06-22 21:19:30 +00:00
Tooru Fujisawa
99809832ac Bug 1768275 - Use SetAnyPromiseIsHandled instead of SetSettledPromiseIsHandled for promise that's not guaranteed to be not-yet-resolved. r=birtles
Differential Revision: https://phabricator.services.mozilla.com/D146032
2022-05-11 16:51:52 +00:00
Iulian Moraru
56df970864 Backed out changeset 20e8a5b10f18 (bug 1768275) for causing linting failures on cancel.html with setTimeout error. CLOSED TREE 2022-05-11 17:07:36 +03:00
Tooru Fujisawa
64e65ad9fc Bug 1768275 - Use SetAnyPromiseIsHandled instead of SetSettledPromiseIsHandled for promise that's not guaranteed to be not-yet-resolved. r=birtles
Differential Revision: https://phabricator.services.mozilla.com/D146032
2022-05-11 13:32:52 +00:00
Boris Chiou
d0a1f45cbd Bug 1767357 - Enable Animation.timeline setter in release channels. r=birtles,emilio
Basically, this patch reverts Bug 1612106 [1].

Webkit just turns this on by default [2], so it's worth to enable this
in our release channels.

[1] https://phabricator.services.mozilla.com/D63432
[2] https://trac.webkit.org/changeset/291868/webkit/

Differential Revision: https://phabricator.services.mozilla.com/D145356
2022-05-05 21:09:33 +00:00
Boris Chiou
6d5e17a8ed Bug 1758527 - Adjust the logic of handing the unresolved current time in PlayNoUpdate() and UpdatePlaybackRate(). r=birtles
Based on the spec [1], the unresolved current time should be checked only if
the auto-rewind flag is ture. Otherwise, the null timeline with the false
auto-rewind flag may get an InvalidStateError DOMException if its effect end
is positive infinity.

Note:
If the animation has no associated timeline, it's current time is
unresolved [2].

Besides, we also tweak the handle for unresolved current time based on the
spec PR: https://github.com/w3c/csswg-drafts/pull/7148, in
UpdatePlaybackRate() and PlayNoUpdate().

Note:
CSS animations and CSS transitions set auto-rewind flag to false [3], and
the current time is unresolved (because the start time and the hold time
are all unresolved), and so the seek time is unresolved as well, especially
when we build a new CSS animation or CSS transition. Therefore we have to
avoid the unresolved seek time to let PlayNoUpdate() early return.

[1] https://drafts.csswg.org/web-animations-1/#playing-an-animation-section
[2] https://drafts.csswg.org/web-animations-1/#animation-current-time
[3] https://drafts.csswg.org/css-animations-2/#animation-play-state

See the spec issue: https://github.com/w3c/csswg-drafts/issues/7145 for
more details.

Differential Revision: https://phabricator.services.mozilla.com/D140682
2022-03-23 01:30:51 +00:00
Boris Chiou
a6ce72cb76 Bug 1741255 - Don't put the scroll animations into PendingAnimationTracker. r=hiro
Basically, we use the current target scroll position as the ready time for
scroll animations, so we don't need to wait until it gets painted.

In fact, it's unclear whether do we need play/pause pending status for
scroll animations, so we choose the natural way for now, and this should
match other browsers' behaviors.

Note:
We avoid puting the scroll animation into PendingAnimationTracker
in PlayNoUpdate() and Pause(). However, we may still "try" to remove
scroll animations from PendingAnimationTracker in some APIs just in
case if those APIs change the animations from using DocumentTimeline to
using ScrollTimeline. They should be revisited once we expose
ScrollTimeline to JS.

Differential Revision: https://phabricator.services.mozilla.com/D132750
2021-12-15 09:54:43 +00:00
Boris Chiou
b47eaf7ccc Bug 1676791 - Part 7: Disable OMTA for scroll-timeline. r=hiro
For simplicity purposes, we don't consider OMTA for now. OMTA support
for scoll-timeline will be done in Bug 1737180.

However, in this patch, we would like to address:
if the geometic animations use scroll-timeline, we don't have to let it
affect the transform animations on the same animation target:
1. If we don't do scrolling, its geometric properties don't change, so no
   effect on transform-like properties.
2. If we do scrolling, we may un-throttle the transform animations by
   other ways, e.g. Keyframe::CanThrottle(). So we don't need to worry
   about this.

Note: tests are in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D129103
2021-12-08 01:16:30 +00:00
Boris Chiou
fcbeb1d2b0 Bug 1676791 - Part 5: Define the finite timeline and use it in Play() and Pause(). r=hiro
Based on https://github.com/w3c/csswg-drafts/pull/4842, we define
"has finite timeline", which is a timeline that's not monotonically increasing.
We need this to update start time and hold time for scroll-timeline, so
we play scroll-linked animations as we expected, e.g. GetLocalTime() returns
the correct time value from GetCurrentTimeAsDuration().

Known issue: we still have bugs when setting "animation-play-state:paused".
Will do that in Bug 1741255.

Differential Revision: https://phabricator.services.mozilla.com/D131168
2021-12-08 01:16:30 +00:00