RESOLVED FIXED208079
AnimationTimeline should not have multiple HashMaps with raw Element* keys
https://bugs.webkit.org/show_bug.cgi?id=208079
Summary AnimationTimeline should not have multiple HashMaps with raw Element* keys
Simon Fraser (smfr)
Reported 2020-02-21 16:32:45 PST
We need to find a different solution to the 6 HashMaps that AnimationTimeline has. We have to consult each of them every time we remove an element.
Attachments
Patch (49.84 KB, patch)
2020-03-11 04:04 PDT, Antoine Quint
no flags
Patch (52.49 KB, patch)
2020-03-11 04:08 PDT, Antoine Quint
no flags
Patch (52.98 KB, patch)
2020-03-11 06:14 PDT, Antoine Quint
no flags
Patch (52.94 KB, patch)
2020-03-11 06:27 PDT, Antoine Quint
no flags
Patch (53.55 KB, patch)
2020-03-11 09:37 PDT, Antoine Quint
rniwa: review+
Radar WebKit Bug Importer
Comment 1 2020-02-21 16:33:20 PST
Ryosuke Niwa
Comment 2 2020-02-21 17:54:01 PST
We should probably move these data structures to hang off of ElementRareData. Create something like ElementAnimationRareData and then put it on ElementRareData.
Antoine Quint
Comment 3 2020-02-24 03:51:33 PST
I like Ryosuke's suggestion and will implement that.
Antoine Quint
Comment 4 2020-03-10 12:08:11 PDT
Should also make KeyframeEffectStack hang off that instead of ElementRareData directly.
Ryosuke Niwa
Comment 5 2020-03-10 22:40:04 PDT
(In reply to Antoine Quint from comment #4) > Should also make KeyframeEffectStack hang off that instead of > ElementRareData directly. That would make most sense.
Antoine Quint
Comment 6 2020-03-11 04:04:19 PDT
Antoine Quint
Comment 7 2020-03-11 04:08:00 PDT
Antoine Quint
Comment 8 2020-03-11 06:14:18 PDT
Antoine Quint
Comment 9 2020-03-11 06:27:35 PDT
Simon Fraser (smfr)
Comment 10 2020-03-11 09:11:51 PDT
Comment on attachment 393233 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=393233&action=review > Source/WebCore/dom/NodeRareData.h:262 > + Animations = 1 << 14, I think you missed the #if DUMP_NODE_STATISTICS code that uses this enum value.
Antoine Quint
Comment 11 2020-03-11 09:37:08 PDT
Antoine Quint
Comment 12 2020-03-11 09:38:12 PDT
(In reply to Simon Fraser (smfr) from comment #10) > Comment on attachment 393233 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=393233&action=review > > > Source/WebCore/dom/NodeRareData.h:262 > > + Animations = 1 << 14, > > I think you missed the #if DUMP_NODE_STATISTICS code that uses this enum > value. I did! I added the required code in the newest patch.
Ryosuke Niwa
Comment 13 2020-03-11 13:15:30 PDT
Comment on attachment 393252 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=393252&action=review > Source/WebCore/animation/AnimationTimeline.cpp:105 > + if (is<CSSTransition>(animation) && downcast<CSSTransition>(animation).owningElement()) > + element.transitions().add(&animation); Should we check that the owning element is same as element here?? > Source/WebCore/animation/AnimationTimeline.cpp:107 > + else if (is<CSSAnimation>(animation) && downcast<CSSAnimation>(animation).owningElement()) > + element.cssAnimations().add(&animation); Ditto. > Source/WebCore/animation/ElementAnimationRareData.h:38 > + WTF_MAKE_FAST_ALLOCATED; Make this not copyable? > Source/WebCore/dom/Element.h:496 > + AnimationCollection& webAnimations(); Should we also forward declare AnimationCollection & CSSAnimationCollection?
Antoine Quint
Comment 14 2020-03-11 13:30:01 PDT
(In reply to Ryosuke Niwa from comment #13) > Comment on attachment 393252 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=393252&action=review > > > Source/WebCore/animation/AnimationTimeline.cpp:105 > > + if (is<CSSTransition>(animation) && downcast<CSSTransition>(animation).owningElement()) > > + element.transitions().add(&animation); > > Should we check that the owning element is same as element here?? These should always be the same thing, so I'll add an ASSERT(). > > Source/WebCore/animation/AnimationTimeline.cpp:107 > > + else if (is<CSSAnimation>(animation) && downcast<CSSAnimation>(animation).owningElement()) > > + element.cssAnimations().add(&animation); > > Ditto. Will add an ASSERT(). > > Source/WebCore/animation/ElementAnimationRareData.h:38 > > + WTF_MAKE_FAST_ALLOCATED; > > Make this not copyable? Will do. > > Source/WebCore/dom/Element.h:496 > > + AnimationCollection& webAnimations(); > > Should we also forward declare AnimationCollection & CSSAnimationCollection? No, these come from `#include "WebAnimationTypes.h"`.
Antoine Quint
Comment 15 2020-03-12 00:48:15 PDT
Antoine Quint
Comment 16 2020-03-12 00:48:52 PDT
(In reply to Ryosuke Niwa from comment #13) > Comment on attachment 393252 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=393252&action=review > > > Source/WebCore/animation/AnimationTimeline.cpp:105 > > + if (is<CSSTransition>(animation) && downcast<CSSTransition>(animation).owningElement()) > > + element.transitions().add(&animation); > > Should we check that the owning element is same as element here?? In the end that was the right thing to do and I added the equality check in the commit.
Note You need to log in before you can comment on or make changes to this bug.