WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
207629
[Web Animations] Make all animation event types inherit from the same base class
https://bugs.webkit.org/show_bug.cgi?id=207629
Summary
[Web Animations] Make all animation event types inherit from the same base class
Antoine Quint
Reported
2020-02-12 07:14:34 PST
[Web Animations] Make all animation event types inherit from the same base class
Attachments
Patch
(27.80 KB, patch)
2020-02-12 07:23 PST
,
Antoine Quint
no flags
Details
Formatted Diff
Diff
Patch
(27.80 KB, patch)
2020-02-12 07:28 PST
,
Antoine Quint
no flags
Details
Formatted Diff
Diff
Patch
(31.95 KB, patch)
2020-02-14 03:27 PST
,
Antoine Quint
no flags
Details
Formatted Diff
Diff
Patch
(32.07 KB, patch)
2020-02-14 03:38 PST
,
Antoine Quint
no flags
Details
Formatted Diff
Diff
Patch
(32.00 KB, patch)
2020-02-14 04:10 PST
,
Antoine Quint
simon.fraser
: review+
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Antoine Quint
Comment 1
2020-02-12 07:23:15 PST
Created
attachment 390515
[details]
Patch
Antoine Quint
Comment 2
2020-02-12 07:28:16 PST
Created
attachment 390516
[details]
Patch
Simon Fraser (smfr)
Comment 3
2020-02-12 09:46:21 PST
Comment on
attachment 390516
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=390516&action=review
> Source/WebCore/animation/AnimationEventBase.h:56 > + RefPtr<WebAnimation> m_animation;
This tingles my "ref cycle" spidey sense.
> Source/WebCore/animation/DeclarativeAnimation.cpp:355 > + Optional<Seconds> timelineTime = timeline() ? timeline()->currentTime() : WTF::nullopt;
auto
> Source/WebCore/animation/DeclarativeAnimation.cpp:364 > + if (is<CSSAnimation>(this)) { > + auto event = AnimationEvent::create(eventType, downcast<CSSAnimation>(this)->animationName(), time, pseudoId, timelineTime, this); > + event->setTarget(m_owningElement); > + m_eventQueue->enqueueEvent(WTFMove(event)); > + } else if (is<CSSTransition>(this)) { > + auto event = TransitionEvent::create(eventType, downcast<CSSTransition>(this)->transitionProperty(), time, pseudoId, timelineTime, this); > + event->setTarget(m_owningElement); > + m_eventQueue->enqueueEvent(WTFMove(event)); > + }
This is what virtual functions are for. Why the is<>(this) here?
Antoine Quint
Comment 4
2020-02-13 02:03:40 PST
(In reply to Simon Fraser (smfr) from
comment #3
)
> Comment on
attachment 390516
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=390516&action=review
> > > Source/WebCore/animation/AnimationEventBase.h:56 > > + RefPtr<WebAnimation> m_animation; > > This tingles my "ref cycle" spidey sense.
So, for a DeclarativeAnimation, as it stands, events will be enqueued on a queue owned by a DeclarativeAnimation, and those events will maintain a strong reference to the DeclarativeAnimation until dispatched. This is a temporary cycle. When we will dispatch those events on the DocumentTimeline's queue, there will be a temporary cycle as well, DocumentTimeline > AnimationEventBase > WebAnimation > DocumentTimeline.
> > Source/WebCore/animation/DeclarativeAnimation.cpp:355 > > + Optional<Seconds> timelineTime = timeline() ? timeline()->currentTime() : WTF::nullopt; > > auto
Will fix.
> > Source/WebCore/animation/DeclarativeAnimation.cpp:364 > > + if (is<CSSAnimation>(this)) { > > + auto event = AnimationEvent::create(eventType, downcast<CSSAnimation>(this)->animationName(), time, pseudoId, timelineTime, this); > > + event->setTarget(m_owningElement); > > + m_eventQueue->enqueueEvent(WTFMove(event)); > > + } else if (is<CSSTransition>(this)) { > > + auto event = TransitionEvent::create(eventType, downcast<CSSTransition>(this)->transitionProperty(), time, pseudoId, timelineTime, this); > > + event->setTarget(m_owningElement); > > + m_eventQueue->enqueueEvent(WTFMove(event)); > > + } > > This is what virtual functions are for. Why the is<>(this) here?
Right, I'll add a new virtual function on DeclarativeAnimation to generate the right event.
Antoine Quint
Comment 5
2020-02-14 03:27:13 PST
Created
attachment 390748
[details]
Patch
Antoine Quint
Comment 6
2020-02-14 03:38:48 PST
Created
attachment 390753
[details]
Patch
Antoine Quint
Comment 7
2020-02-14 04:10:04 PST
Created
attachment 390754
[details]
Patch
Radar WebKit Bug Importer
Comment 8
2020-02-14 04:49:01 PST
<
rdar://problem/59456167
>
Simon Fraser (smfr)
Comment 9
2020-02-14 08:26:50 PST
Comment on
attachment 390754
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=390754&action=review
very nice
> Source/WebCore/animation/CSSAnimation.h:52 > + Ref<AnimationEventBase> createEvent(const AtomString& eventType, double elapsedTime, const String& pseudoId, Optional<Seconds> timelineTime) final;
Maybe a comment somewhere to mention how elapsedTime and timelineTime differ.
Antoine Quint
Comment 10
2020-02-14 08:30:37 PST
(In reply to Simon Fraser (smfr) from
comment #9
)
> Comment on
attachment 390754
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=390754&action=review
> > very nice > > > Source/WebCore/animation/CSSAnimation.h:52 > > + Ref<AnimationEventBase> createEvent(const AtomString& eventType, double elapsedTime, const String& pseudoId, Optional<Seconds> timelineTime) final; > > Maybe a comment somewhere to mention how elapsedTime and timelineTime differ.
Sure, adding this in DeclarativeAnimation.h where the virtual method is specified: // elapsedTime is the animation's current time at the time the event is added and is exposed through the DOM API, timelineTime is the animations' // timeline current time and is not exposed through the DOM API but used by the DocumentTimeline for sorting events before dispatch.
Antoine Quint
Comment 11
2020-02-14 08:37:01 PST
https://bugs.webkit.org/show_bug.cgi?id=207364
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug