Bug 191153 - [Web Animations] Make document.getAnimations() return declarative animations in the correct order
Summary: [Web Animations] Make document.getAnimations() return declarative animations ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-11-01 08:44 PDT by Antoine Quint
Modified: 2018-11-02 00:55 PDT (History)
4 users (show)

See Also:


Attachments
Patch (52.80 KB, patch)
2018-11-01 09:34 PDT, Antoine Quint
dino: review+
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews107 for mac-sierra-wk2 (3.13 MB, application/zip)
2018-11-01 10:48 PDT, EWS Watchlist
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Quint 2018-11-01 08:44:05 PDT
[Web Animations] Make document.getAnimations() return declarative animations in the correct order
Comment 1 Antoine Quint 2018-11-01 09:34:41 PDT
Created attachment 353607 [details]
Patch
Comment 2 EWS Watchlist 2018-11-01 10:48:06 PDT
Comment on attachment 353607 [details]
Patch

Attachment 353607 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/9815304

New failing tests:
fast/layers/no-clipping-overflow-hidden-added-after-transform.html
Comment 3 EWS Watchlist 2018-11-01 10:48:07 PDT
Created attachment 353620 [details]
Archive of layout-test-results from ews107 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 4 Dean Jackson 2018-11-01 12:06:20 PDT
Comment on attachment 353607 [details]
Patch

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

> Source/WebCore/animation/AnimationTimeline.cpp:88
> +    HashMap<Element*, ListHashSet<RefPtr<WebAnimation>>>* map = &m_elementToAnimationsMap;

auto*

> Source/WebCore/animation/AnimationTimeline.cpp:92
> +    if (is<CSSTransition>(animation) && downcast<CSSTransition>(animation).owningElement())
> +        map = &m_elementToCSSTransitionsMap;
> +    else if (is<CSSAnimation>(animation) && downcast<CSSAnimation>(animation).owningElement())
> +        map = &m_elementToCSSAnimationsMap;

I suggest doing this:

auto* map  = [&] () -> HashMap<Element*, ListHashSet<RefPtr<WebAnimation>>>* {
    if (is<CSSTransition>(animation) && downcast<CSSTransition>(animation).owningElement())
        return map = &m_elementToCSSTransitionsMap;
    else if (is<CSSAnimation>(animation) && downcast<CSSAnimation>(animation).owningElement())
        return &m_elementToCSSAnimationsMap;
    return &m_elementToAnimationsMap;
}();

Then in fact you could probably do it with just an auto& and return the objects directly.

Also, you might want to typedef (using) that HashMap type so it's easier to read.

> Source/WebCore/animation/AnimationTimeline.cpp:134
> +    // First, we clear this animation from one of the m_elementToCSSAnimationsMap, m_elementToCSSTransitionsMap,
> +    // m_elementToAnimationsMap or m_elementToCompletedCSSTransitionByCSSPropertyID map, whichever is relevant to
> +    // this type of animation.

This comment doesn't add anything.

> Source/WebCore/animation/AnimationTimeline.cpp:338
> +        return HashMap<CSSPropertyID, RefPtr<CSSTransition>> { };

You should using/typedef this one as well.

> Source/WebCore/animation/AnimationTimeline.h:82
> +    HashMap<Element*, HashMap<CSSPropertyID, RefPtr<CSSTransition>>> m_elementToCompletedCSSTransitionByCSSPropertyID;

Use using here.

> Source/WebCore/animation/DocumentTimeline.cpp:161
> +        // Otherwise, if A and B have different transition generation values, sort by their corresponding transition generation in ascending order.

generation time
Comment 5 Antoine Quint 2018-11-02 00:54:26 PDT
Committed r237726: <https://trac.webkit.org/changeset/237726>
Comment 6 Radar WebKit Bug Importer 2018-11-02 00:55:21 PDT
<rdar://problem/45756154>