Bug 179708 - [Web Animations] Complete support for keyframe animations
Summary: [Web Animations] Complete support for keyframe animations
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Animations (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-11-14 16:42 PST by Antoine Quint
Modified: 2017-12-21 11:51 PST (History)
2 users (show)

See Also:


Attachments
Patch (56.67 KB, patch)
2017-12-21 09:10 PST, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch (56.68 KB, patch)
2017-12-21 11:11 PST, Antoine Quint
dino: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Quint 2017-11-14 16:42:44 PST
We're adding basic support for from-to animations in https://bugs.webkit.org/show_bug.cgi?id=179707, but we need to support the full complexity of multiple keyframe animations.
Comment 1 Antoine Quint 2017-12-12 04:41:25 PST
<rdar://problem/34953942>
Comment 2 Antoine Quint 2017-12-21 09:10:18 PST
Created attachment 330032 [details]
Patch
Comment 3 Antoine Quint 2017-12-21 11:11:23 PST
Created attachment 330043 [details]
Patch
Comment 4 Dean Jackson 2017-12-21 11:12:28 PST
Comment on attachment 330032 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=330032&action=review

It stresses me out that so much code is landing without many tests.

> Source/WebCore/animation/KeyframeEffect.cpp:101
> +static inline ExceptionOr<void> processIterableKeyframes(ExecState& state, Strong<JSObject>&& keyframesInput, JSValue method, Vector<KeyframeEffect::ProcessedKeyframe>& processedKeyframes)

It might be nicer to have this function return an ExceptionOr<Vector<KeyframeEffect::ProcessedKeyframe>>, to avoid having an out parameter.

> Source/WebCore/animation/KeyframeEffect.cpp:132
> +            auto ownPropertyName = ownPropertyNames[j];
> +            auto ownPropertyNameAsString = ownPropertyName.string();
> +            auto ownPropertyRawValue = keyframe->get(&state, ownPropertyName);
> +            if (ownPropertyName == "easing")
> +                easing = convert<IDLDOMString>(state, ownPropertyRawValue);
> +            else if (ownPropertyNameAsString == "offset")
> +                offset = convert<IDLNullable<IDLDouble>>(state, ownPropertyRawValue);
> +            else if (ownPropertyName == "composite")

What is ownPropertyNameAsString for? You already compare ownPropertyName == "easing" and "composite". Why is "offset" different?
Comment 5 Dean Jackson 2017-12-21 11:12:58 PST
Comment on attachment 330043 [details]
Patch

copying review from previous patch
Comment 6 Dean Jackson 2017-12-21 11:13:23 PST
I'm sure Darin or someone will find lots of nits.
Comment 7 Antoine Quint 2017-12-21 11:41:35 PST
(In reply to Dean Jackson from comment #4)
> Comment on attachment 330032 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=330032&action=review
> 
> It stresses me out that so much code is landing without many tests.

There are many tests, they're simply all using Element.animate(), which is landing next.

> > Source/WebCore/animation/KeyframeEffect.cpp:101
> > +static inline ExceptionOr<void> processIterableKeyframes(ExecState& state, Strong<JSObject>&& keyframesInput, JSValue method, Vector<KeyframeEffect::ProcessedKeyframe>& processedKeyframes)
> 
> It might be nicer to have this function return an
> ExceptionOr<Vector<KeyframeEffect::ProcessedKeyframe>>, to avoid having an
> out parameter.

Yes, I can do that. It was easier to follow the spec text by passing around the out parameter though.

> > Source/WebCore/animation/KeyframeEffect.cpp:132
> > +            auto ownPropertyName = ownPropertyNames[j];
> > +            auto ownPropertyNameAsString = ownPropertyName.string();
> > +            auto ownPropertyRawValue = keyframe->get(&state, ownPropertyName);
> > +            if (ownPropertyName == "easing")
> > +                easing = convert<IDLDOMString>(state, ownPropertyRawValue);
> > +            else if (ownPropertyNameAsString == "offset")
> > +                offset = convert<IDLNullable<IDLDouble>>(state, ownPropertyRawValue);
> > +            else if (ownPropertyName == "composite")
> 
> What is ownPropertyNameAsString for? You already compare ownPropertyName ==
> "easing" and "composite". Why is "offset" different?

I started out by only implementing offset, and then added easing and composite. But I see that JSC::Identifier, which is the type of ownPropertyName, supports string comparisons, so I'll remove ownPropertyName.
Comment 8 Antoine Quint 2017-12-21 11:51:43 PST
Committed r226234: <https://trac.webkit.org/changeset/226234>