From 5cdffe601d254ff9b295910236ae70ae8e26266e Mon Sep 17 00:00:00 2001 From: Kevin Ellis Date: Tue, 8 Aug 2023 19:14:19 +0000 Subject: [PATCH 01/22] Checkpoint --- web-animations-2/Overview.bs | 81 +++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 30 deletions(-) diff --git a/web-animations-2/Overview.bs b/web-animations-2/Overview.bs index 43e98de226d..ab907adfb46 100644 --- a/web-animations-2/Overview.bs +++ b/web-animations-2/Overview.bs @@ -49,6 +49,34 @@ dl.switch > [data-md] > p { dl.switch > dt > ul > li { text-indent: 0; } + +/* Override settings in base.css */ +/* Inconsistencies in the handling of dl.switch. Sometimes it is expanded to + div.switch > dl, while other times it remains dl.switch. The inconsistency + probably suggests an indentation problem. + TODO: Remove dl.switch > dt rule once the inconsistencies are addressed. */ +dl.switch > dt { + /* "display: list-item" in base.css, which triggers an increase in + numbering resulting in gaps in the numbered list items. */ + /* display: block !important; */ + /* text-indent: 0 !important; */ +} + +/* +div.switch > dl > dt:before, +dl.switch > dt:before { + content: '\21AA'; + padding: 0 0.5em 0 0; + display: inline-block; + width: 1em; + text-align: right; + line-height: 0.5em; +} + +div.switch > dl > dt > p { + display: inline; +} +*/
@@ -59,11 +87,11 @@ Work Status: Exploring
 Shortname: web-animations
 ED: https://drafts.csswg.org/web-animations-2/
 TR: https://www.w3.org/TR/web-animations-2/
-Version history: https://github.com/w3c/csswg-drafts/commits/master/web-animations-2
+Version history: https://github.com/w3c/csswg-drafts/commits/main/web-animations-2
 Level: 2
 
 Group: csswg
-!Participate: Fix the text through GitHub
+!Participate: Fix the text through GitHub
 !Participate: Join the ‘waapi’ channel on the Animation at Work slack
 !Participate: IRC: #webanimations on W3C's IRC
 Repository: w3c/csswg-drafts
@@ -546,8 +574,7 @@ is as follows:
 1.  Let previous current time be animation's
     [=animation/current time=].
 
-    Note: This is the [=animation/current time=] after applying the changes from the
-    previous step which may cause the [=animation/current time=] to become
+    Note: This is the [=animation/current time=] after applying the changes from the previous step which may cause the [=animation/current time=] to become
     unresolved.
 
 1.  [=Apply any pending playback rate=] on |animation|.
@@ -582,6 +609,7 @@ is as follows:
     animation with the did seek flag set to true, and
     the synchronously notify flag set to false.
 
+
 

Playing an animation

The procedure to play an animation, animation, given @@ -595,34 +623,31 @@ as CSS Animations [[CSS-ANIMATIONS-1]]. animation has a pending pause task, and false otherwise. 1. Let has pending ready promise be a boolean flag that is initially false. -1. Let seek time be a time value that is initially unresolved. 1. Let has finite timeline be true if |animation| has an associated timeline that is not [=monotonically increasing timeline|monotonically increasing=]. 1. Let previous current time be the |animation|'s [=animation/current time=] -1. If |reset current time on resume| is set: - - * Set previous current time to unresolved. - * Set the |reset current time on resume| flag to false. - +1. Let enable seek be true if the auto-rewind flag is + true and has finite timeline is false. Otherwise, initialize to + false. 1. Perform the steps corresponding to the first matching condition from the following, if any: -
+
: If |animation|'s [=effective playback rate=] > 0, - the auto-rewind flag is true and either + enable seek is true and either animation's: * previous current time is unresolved, or * previous current time < zero, or * previous current timeassociated effect end, - :: Set seek time to zero. + :: Set the |animation|'s hold time to zero. : If |animation|'s [=effective playback rate=] < 0, - the auto-rewind flag is true and either + enable seek is true and either animation's: * previous current time is unresolved, or @@ -635,31 +660,27 @@ as CSS Animations [[CSS-ANIMATIONS-1]]. :: throw an "{{InvalidStateError}}" {{DOMException}} and abort these steps. : Otherwise, - :: Set seek time to |animation|'s associated effect end. + :: Set the |animation|'s hold time to the + |animation|'s associated effect end.
: If |animation|'s [=effective playback rate=] = 0 and |animation|'s [=animation/current time=] is [=unresolved=], - :: Set seek time to zero. - - - -1. If |seek time| is resolved, + :: Set the |animation|'s hold time to zero. -
+ - : If |has finite timeline| is true, - :: 1. Set animation's [=animation/start time=] to - seek time. - 1. Let |animation|'s [=hold time=] be unresolved. - 1. [=Apply any pending playback rate=] on |animation|. +1. If |has finite timeline| and the |auto-rewind| flag is true: + * Set the flag |auto align start time| to true. + * Set the |animation|'s hold time to the |animation|'s + [=animation/current time=] - : Otherwise, - :: 1. Set animation's hold time to - seek time. -
+ Note: If play is called for a CSS animation during style update, + the |animation|'s [=start time=] cannot be reliably calculated until post + layout since the start time is to align with the start or end of the animation + range (depending on the [=playback rate=]). 1. If animation's hold time is resolved, let its [=animation/start time=] be unresolved. From e76d19a7f9fe5f81723eb30ecced2192a42a8c8a Mon Sep 17 00:00:00 2001 From: Kevin Ellis Date: Wed, 9 Aug 2023 14:38:38 +0000 Subject: [PATCH 02/22] Checkpoint --- web-animations-2/Overview.bs | 55 +++++++++++++----------------------- 1 file changed, 19 insertions(+), 36 deletions(-) diff --git a/web-animations-2/Overview.bs b/web-animations-2/Overview.bs index 9742b02451c..cdd61830f2e 100644 --- a/web-animations-2/Overview.bs +++ b/web-animations-2/Overview.bs @@ -6,6 +6,7 @@ background: #efe; border: green 1px dotted; } + @media (prefers-color-scheme: dark) { .informative-bg { background: rgba(255, 255, 255, .05); @@ -26,6 +27,11 @@ div.informative-bg h4 { background: none; } +/* crbug.com/1471465 */ +dl.switch > dt { + counter-increment: list-item 0; +} + .attributes::before, .methods::before, .parameters::before, .exceptions::before, .constructors::before, .members::before { @@ -42,41 +48,17 @@ div.informative-bg h4 { .constructors::before { content: 'Constructors' } .members::before { content: 'Dictionary members' } -dl.switch > [data-md] > p { - display: inline; -} - -dl.switch > dt > ul > li { - text-indent: 0; -} - -/* Override settings in base.css */ -/* Inconsistencies in the handling of dl.switch. Sometimes it is expanded to - div.switch > dl, while other times it remains dl.switch. The inconsistency - probably suggests an indentation problem. - TODO: Remove dl.switch > dt rule once the inconsistencies are addressed. */ -dl.switch > dt { - /* "display: list-item" in base.css, which triggers an increase in - numbering resulting in gaps in the numbered list items. */ - /* display: block !important; */ - /* text-indent: 0 !important; */ +.param, +.exceptionname, +.estype, +.esvalue { + font-weight: bold; } -/* -div.switch > dl > dt:before, -dl.switch > dt:before { - content: '\21AA'; - padding: 0 0.5em 0 0; - display: inline-block; - width: 1em; - text-align: right; - line-height: 0.5em; +.formula { + display: block; + margin: .5em 2em; } - -div.switch > dl > dt > p { - display: inline; -} -*/ # Introduction # {#intro} @@ -952,42 +951,10 @@ spec:web-animations-2: type:dfn; text:auto-aligned start time and the state of a scroll-driven animation may be inconsistent in the composited frame. -## Updating an auto-aligned start time ## {#updating-auto-aligned-start-time} - - When updating timeline current time, the [=start time=] of any attached - animation is conditionally updated. The procedure for - calculating auto-aligned start times - is as follows: - - 1. For each attached animation: - - 1. If the animation does not have an [=auto-aligned start time=], abort - this procedure. - - 1. If [=play state=] is idle or [=hold time=] is resolved and - [=play state=] is not finished, abort this procedure. - - 1. Let |start offset| be the resolved scroll offset as a percentage - corresponding to the start of the [=animation attachment range=], or - 0% if unresolved. - - 1. Let |end offset| be the resolved scroll offset as a percentage - corresponding to the end of the [=animation attachment range=], or - 100% if unresolved. - - 1. Set [=start time=] to |start offset| if [=effective playback rate=] - ≥ 0, and |end offset| otherwise. - - 1. Clear [=hold time=]. - - Note: The [=start time=] is auto-aligned unless [=animation/current time=] or - [=start time=] are explicitly set via the web-animations API, which makes the - [=start time=] sticky. Playing an animation implicitly resets the stickiness - of the [=start time=]. - - Note: A [=start time=] is still required for a pause-pending animation to - properly align to the animation range. In this case, [=hold time=] will be - set when the pending pause microtask is run. + When updating timeline current time, + the [=start time=] of any attached animation is conditionally updated. + For each attached animation, + run the procedure for [=animation/calculating an auto-aligned start time=]. # Privacy Considerations # {#privacy-considerations} diff --git a/web-animations-2/Overview.bs b/web-animations-2/Overview.bs index 443ead7d019..46b7bf8eb65 100644 --- a/web-animations-2/Overview.bs +++ b/web-animations-2/Overview.bs @@ -388,15 +388,34 @@ After the step to assign new effect as animation's

Waiting for the associated effect

-The definition of when an animation is ready needs to be extended to consider -descendant effects and custom effects such that the first condition is: +Replace: + +> An animation is ready at the first moment +> where both of the following conditions are true: +> +> * the user agent has completed any setup required +> to begin the playback of the animation's [=associated effect=], +> including rendering the first frame of any [=keyframe effect=]. +> +> * the animation is associated with a [=timeline=] +> that is not [=inactive timeline|inactive=]. + +With: +> An animation is ready at the first moment +> where all of the following conditions are true: +> > * the user agent has completed any setup required to begin the playback of > each inclusive descendant of > the animation's associated effect > including rendering the first frame of any keyframe > effect or executing any custom effects associated with an > animation effect. +> +> * the animation is associated with a [=timeline=] +> that is not [=inactive timeline|inactive=]. +> +> * the animation's [=hold time=] or [=animation/start time=] is resolved.

Validating a CSSNumberish time

@@ -793,6 +812,32 @@ as CSS Animations [[CSS-ANIMATIONS-1]]. Issue: The procedure to [=play an animation=] needs to include scheduling a task for updating [=custom effects=]. +
Auto-aligning the start time
+ +When attached to a non-monotonic timeline, the start time of the animation may be layout dependent. +In this case, we defer calculation of the start time until the timeline has been updated post +layout. +When updating timeline current time, the [=start time=] of any attached animation is conditionally updated. The procedure for + calculating an auto-aligned start time + is as follows: + + 1. If the |auto-align star time| flag is false, abort this procedure. + + 1. If [=play state=] is idle or [=hold time=] is resolved and [=play state=] is not finished, abort this procedure. + + 1. Let |start offset| be the resolved scroll offset as a percentage + corresponding to the start of the [=animation attachment range=], + or 0% if unresolved. + + 1. Let |end offset| be the resolved scroll offset as a percentage + corresponding to the end of the [=animation attachment range=], + or 100% if unresolved. + + 1. Set [=start time=] to |start offset| if [=effective playback rate=] ≥ 0, + and |end offset| otherwise. + + 1. Clear [=hold time=]. +

Pausing an animation

@@ -806,16 +851,58 @@ Update the constraints for setting the seek time to only apply when using a monotonic timeline. A [=scroll-driven animation=] needs to defer setting the hold time until the animation range has been computed. -Add the following steps after conditionally setting the hold time: +Replace: -> If [=hold time=] and [=animation/start time=] are both unresolved. -> * Set the |auto align start time| flag to true +> If |seek time| is [=unresolved|resolved=], +> +>
+> +> : If |has finite timeline| is true, +> :: +> Set |animation|'s [=start time=] to |seek time|. +> +> : Otherwise, +> :: +> Set |animation|'s [=hold time=] to |seek time|. +> +>
+ +With: + +> If |seek time| is [=unresolved|resolved=], +> +>
+> +> : If |has finite timeline| is true, +> :: +> Set the |auto align start time| flag to true. +> +> : Otherwise, +> :: +> Set |animation|'s [=hold time=] to |seek time|. +> +>
+ +Replace: + +> Schedule a task to be executed at the first possible moment where both of the following conditions are true: +> +> * the user agent has performed any processing necessary to suspend the playback of animation’s associated effect, if any. +> +> * the animation is associated with a timeline that is not inactive. + +With: + +> Schedule a task to be executed at the first possible moment where all of the following conditions are true: +> +> * the user agent has performed any processing necessary to suspend the playback of animation’s associated effect, if any. +> +> * the animation is associated with a timeline that is not inactive. +> +> * the animation has a resolved [=hold time=] or [=animation/start time=]. -Note: Setting the |auto align start time| flag forces an update of the start -time when the timeline is updated, the pause-pending microtask sets the -[=hold time=] based on the auto-aligned [=animation/start time=]. The animation -is not ready until the animation has either a [=hold time=] or -[=animation/start time=]. +Note: A [=animation/start time=] is still required for a pause-pending animation if the |auto-align start time| flag is true to properly align to the animation range. +The [=animation/start time=] is set following the procedure for [=calculating an auto-aligned start time=].

Canceling an animation

From f7e051273eeae440c5c5cd95991d94cd1d26d540 Mon Sep 17 00:00:00 2001 From: Kevin Ellis Date: Mon, 14 Aug 2023 16:16:17 +0000 Subject: [PATCH 07/22] Cleanup --- web-animations-2/Overview.bs | 44 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/web-animations-2/Overview.bs b/web-animations-2/Overview.bs index 46b7bf8eb65..10908269fda 100644 --- a/web-animations-2/Overview.bs +++ b/web-animations-2/Overview.bs @@ -131,6 +131,8 @@ urlPrefix: https://webidl.spec.whatwg.org/; type: dfn; spec: webidl urlPrefix: http://www.ecma-international.org/ecma-262/6.0/#sec-; type: dfn; spec: ecma-262 text: code realms text: execution contexts +urlPrefix: https://drafts.csswg.org/scroll-animations-1/; type: dfn; spec: scroll-animations-1 + text: html-processing-model-event-loops