-
Notifications
You must be signed in to change notification settings - Fork 717
[web-animation-2] Making currentTime and startTime CSSNumerish #6479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[web-animation-2] Making currentTime and startTime CSSNumerish #6479
Conversation
web-animations-2/Overview.bs
Outdated
[=validate a CSSNumberish time=] procedure with <var>seek time</var> | ||
as the input. | ||
|
||
1. If valid seek time is false, abort this procedure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, <var>valid seek time</var>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
web-animations-2/Overview.bs
Outdated
[=validate a CSSNumberish time=] procedure with | ||
<var>new start time</var> as the input. | ||
|
||
1. If valid start time is false, abort this procedure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: <var>valid start time</var>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
web-animations-2/Overview.bs
Outdated
[=progress-based timeline=], [=start time=] must be returned as a | ||
<a href="https://drafts.css-houdini.org/css-typed-om/#cssnumericvalue"> | ||
CSSNumericValue</a> with percent units. Otherwise [=start time=] must be | ||
returned as a double value, representing the time in units of milliseconds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels a little out of place to declare in the interface the types that must be returned. I would have expected these types to be the implicit result of starting an animation on or switching an animation to a progress based timeline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CSSNumerish is naturally ambiguous since it could be a double or a CSSNumericValue, and when expressed as a CSSNumericValue it could have any compatible units (e.g. 's' vs 'ms'). Internally, it doesn't matter how we should express time, but should have a canonical form for API return values. Perhaps this belong in a normalization procedure that is called at the end of "getting the current/start time".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this should be clarified in an addendum to https://www.w3.org/TR/web-animations-1/#time-value-section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is why Typed OM never uses CSSNumberish for method return types, and when it uses it for an attribute, it's very explicit about what is returned by the getter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack, sounds like it is appropriate to be explicit here about the type that should be expected.
web-animations-2/Overview.bs
Outdated
|
||
: If <em>all</em> of the following conditions are true: | ||
* The animation is not associated with a [=progress-based timeline=], | ||
amd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
web-animations-2/Overview.bs
Outdated
* The animation is not associated with a [=progress-based timeline=], | ||
amd | ||
* <var>time</var> is a CSSNumericValue: | ||
* The units of time are not <a href="https://www.w3.org/TR/css3-values/#time">duration units</a>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Links to other specs should use autolinks https://tabatkins.github.io/bikeshed/#autolink-biblio
E.g. This particular case would be [[CSS3-VALUES#time|duration units]]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, that would produce a section link, which is only very slightly less fragile than a direct link, as it just protects you against the possibility of the Values 3 url being changed at some point. You probably actually want <a type lt="<time>">duration units</a>
, to link to the definition of those units whereever they may be.
(You should be able to write <<time|duration units>>
, but I haven't yet landed the fix harmonizing the parsing of all linking shorthands, ugh.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
web-animations-2/Overview.bs
Outdated
:: Update the description as: | ||
> The [=start time=] of this animation. When associated with a | ||
> [=progress-based timeline=], [=start time=] must be returned as a | ||
> <a href="https://drafts.css-houdini.org/css-typed-om/#cssnumericvalue"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and below, replace with {{CSSNumericValue}}.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
web-animations-2/Overview.bs
Outdated
|
||
: If <em>all</em> of the following conditions are true: | ||
* The animation is not associated with a [=progress-based timeline=], | ||
and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an incorrect indent. Bikeshed requires a 4-space (or tab) indent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
web-animations-2/Overview.bs
Outdated
<div class='attributes'> | ||
: <dfn attribute for=Animation>startTime</dfn> | ||
:: Update the description as: | ||
> The [=start time=] of this animation. When associated with a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is nested in a list this requires more indentation, The '>' needs to be aligned with Update on the line above. There's an example with delay and endDelay below, e.g.
:: Update the description as:
> The [=start time=] of this animation. When associated with a
> [=progress-based timeline=], [=start time=] must be returned as a
> {{CSSNumericValue}} with percent units. Otherwise [=start time=] must be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list as a whole is indented incorrectly - for some reason it has a 1-space indent before each item, which doesn't do anything but does make the subsequent 4-space indents also misaligned. It should be indented one level from the container div
, and then yeah, the blockquote would need two levels to nest it under the dd
properly.
Just use tab indents; humans can't reliably space-indent to save their lives. ^_^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have much experience with tab indenting specs but I'll take your word that it's simpler. I guess it takes away the temptation to use anything less than a full tab indent ^_^. I take it I should update #6565 (review) or follow up with another PR to do this for the whole spec and then we can update this to match.
> be returned as a double value, representing the time in units of | ||
> milliseconds. Setting this attribute follows the procedure to | ||
> <a>set the current time</a> of this object to the new value. | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline before to separate it from the block above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
web-animations-2/Overview.bs
Outdated
> <a>set the start time</a> of this object to the new value. | ||
: <dfn attribute for=Animation>currentTime</dfn> | ||
:: update the description as: | ||
> The <a>current time</a> of this animation. When associated with a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same indentation issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent issues should all be resolved now. Formatting glitches with dl.switch have also been addressed.
> be returned as a double value, representing the time in units of | ||
> milliseconds. Setting this attribute follows the procedure to | ||
> <a>set the current time</a> of this object to the new value. | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
web-animations-2/Overview.bs
Outdated
dl.switch > dt > ul > li { | ||
text-indent: 0; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tabatkins there seems to be issues with the generated bikeshed css when we switched to dl instead of just the div. You can see the issue at this link which @kevers-google is trying to work around here. Do you know if there's something wrong with the spec formatting or generator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you provide more details on what's wrong? I see that the "switch icon" is on its own line (unavoidable given the way it's injected, since the dt contains block elements), but it doesn't look like that's what your CSS is trying to mess with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bullets in the list are also incorrectly indented. See https://drafts.csswg.org/web-animations-1/#setting-the-current-time-of-an-animation for comparison. web-animations-1 seems to be using <div class="switch">
: https://github.com/w3c/csswg-drafts/blob/main/web-animations-1/Overview.bs#L957
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The switch being on it's own line was resolved by the rule:
dl.switch > [data-md] > p {
display: inline;
}
This aligns with a rule we have in web-animations-1, namely:
div.switch > dl > dt > p {
display: inline;
}
The overlap resulted from the following rules in base.css:
dl.switch > dt {
text-indent: -1.5em;
}
When applied to a paragraph inside a list item, it creates an overlap between the paragraph and the marker.
web-animation-1 controls the indent within a switch via these rules:
div.switch > dl > dt:before {
margin-left: -1.3em;
}
div.switch > dl {
padding-left: 2em;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, huh, I see that base.css
is doing some weird text-indent stuff. I... don't understand why it's doing that; it appears to only work well on single-line dt
s, and makes structured ones like this look weird. @fantasai, I don't remember if this style was imported from Bikeshed's stylesheet or done by you, any idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving the style changes to a separate PR to unblock the remainder of the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style changes moved to #6655.
web-animations-2/Overview.bs
Outdated
evaluating | ||
<code>|timeline time| - (|seek time| / [=playback rate=])</code> | ||
where <var>timeline time</var> is the current <a>time value</a> | ||
of <a>timeline</a> associated with <var>animation</var>. | ||
|
||
</dl> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the indentation level here doesn't match the opening tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
[web-animation-2] Making currentTime and startTime CSSNumerish
The animation attributes currentTime and startTime were nullable doubles and represented times in units of milliseconds. These units do not align well with progress based animations where it is more natural to work in percentages.
With this change, progress based animations expect and report times as percentages. When setting current or start time, the value may be expressed as a double with implicit units of milliseconds, or as a CSSNumericValue with duration units ('s' or 'ms') when the animation is associated with a non-monotonic timeline.
issue #6458