Bug 180402 - [Web Animations] Implement Element.animate()
Summary: [Web Animations] Implement Element.animate()
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-12-05 02:28 PST by Antoine Quint
Modified: 2017-12-24 05:58 PST (History)
4 users (show)

See Also:


Attachments
Patch (296.79 KB, patch)
2017-12-22 03:05 PST, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch (296.82 KB, patch)
2017-12-22 04:34 PST, Antoine Quint
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-elcapitan (2.19 MB, application/zip)
2017-12-22 05:39 PST, Build Bot
no flags Details
Archive of layout-test-results from ews105 for mac-elcapitan-wk2 (2.54 MB, application/zip)
2017-12-22 05:49 PST, Build Bot
no flags Details
Archive of layout-test-results from ews113 for mac-elcapitan (2.92 MB, application/zip)
2017-12-22 05:59 PST, Build Bot
no flags Details
Archive of layout-test-results from ews125 for ios-simulator-wk2 (2.16 MB, application/zip)
2017-12-22 06:04 PST, Build Bot
no flags Details
Patch (308.93 KB, patch)
2017-12-22 06:25 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-12-05 02:28:44 PST
We need to expose and implement the animate() method on Element via the Animatable interface.
Comment 1 Radar WebKit Bug Importer 2017-12-05 02:30:27 PST
<rdar://problem/35851353>
Comment 2 Antoine Quint 2017-12-22 03:05:55 PST
Created attachment 330115 [details]
Patch
Comment 3 Antoine Quint 2017-12-22 04:34:31 PST
Created attachment 330118 [details]
Patch
Comment 4 Build Bot 2017-12-22 05:39:08 PST
Comment on attachment 330118 [details]
Patch

Attachment 330118 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/5801251

New failing tests:
imported/w3c/web-platform-tests/css-timing-1/step-timing-functions-output.html
imported/w3c/web-platform-tests/css-timing-1/frames-timing-functions-output.html
imported/w3c/web-platform-tests/css-timing-1/cubic-bezier-timing-functions-output.html
imported/blink/virtual/threaded/animations/compositor-rotate-zero-degrees.html
Comment 5 Build Bot 2017-12-22 05:39:09 PST
Created attachment 330119 [details]
Archive of layout-test-results from ews101 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 6 Build Bot 2017-12-22 05:49:53 PST
Comment on attachment 330118 [details]
Patch

Attachment 330118 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/5801268

New failing tests:
imported/blink/virtual/threaded/animations/compositor-rotate-zero-degrees.html
imported/w3c/web-platform-tests/css-timing-1/step-timing-functions-output.html
imported/w3c/web-platform-tests/css-timing-1/frames-timing-functions-output.html
imported/w3c/web-platform-tests/css-timing-1/cubic-bezier-timing-functions-output.html
Comment 7 Build Bot 2017-12-22 05:49:54 PST
Created attachment 330120 [details]
Archive of layout-test-results from ews105 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 8 Build Bot 2017-12-22 05:59:02 PST
Comment on attachment 330118 [details]
Patch

Attachment 330118 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/5801279

New failing tests:
imported/w3c/web-platform-tests/css-timing-1/step-timing-functions-output.html
imported/w3c/web-platform-tests/css-timing-1/frames-timing-functions-output.html
imported/w3c/web-platform-tests/css-timing-1/cubic-bezier-timing-functions-output.html
imported/blink/virtual/threaded/animations/compositor-rotate-zero-degrees.html
Comment 9 Build Bot 2017-12-22 05:59:03 PST
Created attachment 330121 [details]
Archive of layout-test-results from ews113 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews113  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 10 Build Bot 2017-12-22 06:04:56 PST
Comment on attachment 330118 [details]
Patch

Attachment 330118 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/5801290

New failing tests:
imported/w3c/web-platform-tests/css-timing-1/step-timing-functions-output.html
imported/w3c/web-platform-tests/css-timing-1/frames-timing-functions-output.html
imported/w3c/web-platform-tests/css-timing-1/cubic-bezier-timing-functions-output.html
imported/blink/virtual/threaded/animations/compositor-rotate-zero-degrees.html
Comment 11 Build Bot 2017-12-22 06:04:57 PST
Created attachment 330122 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.6
Comment 12 Antoine Quint 2017-12-22 06:25:02 PST
Created attachment 330124 [details]
Patch
Comment 13 Dean Jackson 2017-12-23 13:09:12 PST
Comment on attachment 330124 [details]
Patch

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

> Source/WebCore/animation/AnimationEffectTiming.cpp:55
> +        double durationAsDouble = WTF::get<double>(duration);

auto

> Source/WebCore/animation/AnimationEffectTiming.cpp:59
> +        m_duration = Seconds::fromMilliseconds(durationAsDouble);
> +    } else if (WTF::holds_alternative<String>(duration)) {

Return here. The only other option is String.

> Source/WebCore/animation/AnimationEffectTiming.cpp:61
> +        String durationAsString = WTF::get<String>(duration);
> +        if (durationAsString != "auto")

No need for the local variable.

> Source/WebCore/animation/AnimationEffectTimingProperties.h:44
> +struct AnimationEffectTimingProperties {
> +    double delay;
> +    double endDelay;
> +    FillMode fill;
> +    double iterationStart;
> +    double iterations;
> +    Variant<double, String> duration;
> +    PlaybackDirection direction;
> +    String easing;
> +};

Explicitly set all the default values? Or does the bindings code do that?

> Source/WebCore/animation/KeyframeEffect.cpp:383
> +    if (options) {
> +        Variant<double, String> bindingsDuration;
> +        if (WTF::holds_alternative<double>(options.value()))
> +            bindingsDuration = WTF::get<double>(options.value());
> +        else
> +            bindingsDuration = WTF::get<KeyframeEffectOptions>(options.value()).duration;
> +        auto setBindingsDurationResult = keyframeEffect->timing()->setBindingsDuration(WTFMove(bindingsDuration));
> +        if (setBindingsDurationResult.hasException())
> +            return setBindingsDurationResult.releaseException();
> +    }

Get the .value() as a local variable to avoid calling it so many times.

Also, you could use switch_on here, rather than holds_alternative, etc.

> Source/WebCore/animation/KeyframeEffect.h:45
> +        ~KeyframeEffect() { }

Indentation.

> Source/WebCore/animation/KeyframeEffectOptions.h:38
> +struct KeyframeEffectOptions : AnimationEffectTimingProperties {
> +    IterationCompositeOperation iterationComposite;
> +    CompositeOperation composite;
> +};

Ditto on default values.

> Source/WebCore/dom/Element.cpp:3700
> +        if (WTF::holds_alternative<double>(options.value()))
> +            keyframeEffectOptionsVariant = WTF::get<double>(options.value());
> +        else
> +            keyframeEffectOptionsVariant = WTF::get<KeyframeAnimationOptions>(options.value());

Another case where you could use switch_on, and use a local variable for the value (you wouldn't even need it with switch_on)
Comment 14 Antoine Quint 2017-12-24 05:58:08 PST
Committed r226289: <https://trac.webkit.org/changeset/226289>