WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 179941
[Web Animations] Adopt KeyframeList in KeyframeEffect
https://bugs.webkit.org/show_bug.cgi?id=179941
Summary
[Web Animations] Adopt KeyframeList in KeyframeEffect
Antoine Quint
Reported
2017-11-22 05:10:41 PST
KeyframeEffect currently models its keyframes by creating a new Keyframe struct and storing them in a Vector<Keyframe>. As it turns out, there already is a way to model keyframes in WebCore, it's KeyframeList. We should adopt this class, which will also make it possible to run hardware-composited animations using RenderBoxModelObject::startAnimation() in the future since this function expects a KeyframeList.
Attachments
Patch
(8.23 KB, patch)
2017-11-22 05:22 PST
,
Antoine Quint
no flags
Details
Formatted Diff
Diff
Patch
(8.45 KB, patch)
2017-11-22 10:03 PST
,
Antoine Quint
darin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Antoine Quint
Comment 1
2017-11-22 05:22:04 PST
Created
attachment 327450
[details]
Patch
Radar WebKit Bug Importer
Comment 2
2017-11-22 05:25:05 PST
<
rdar://problem/35666924
>
Darin Adler
Comment 3
2017-11-22 09:44:54 PST
Comment on
attachment 327450
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=327450&action=review
> Source/WebCore/animation/KeyframeEffect.cpp:54 > + , m_keyframes("")
empytString() is more efficient than writing ""
> Source/WebCore/animation/KeyframeEffect.cpp:78 > + KeyframeList newKeyframes("keyframe-effect-" + createCanonicalUUIDString()); > + newKeyframes.clear();
Seems annoying to have to construct this with two values, and then clear them out. Is there a more elegant construction we can come up with?
> Source/WebCore/animation/KeyframeEffect.cpp:127 > - m_keyframes = WTFMove(newKeyframes); > + m_keyframes.swap(newKeyframes);
This seems unnecessary. Seems like KeyFrameList could and should easily support move assignment since AtomicString, Vector, and HashSet all support that.
> Source/WebCore/rendering/style/KeyframeList.h:81 > + void swap(KeyframeList& other) > + { > + std::swap(m_animationName, other.m_animationName); > + std::swap(m_keyframes, other.m_keyframes); > + std::swap(m_properties, other.m_properties); > + }
Should just add the move assignment operator instead: KeyFrameList& operator=(KeyFrameList&&) = default; But also, why doesn’t that get generated automatically for us?
Antoine Quint
Comment 4
2017-11-22 09:56:20 PST
(In reply to Darin Adler from
comment #3
)
> Comment on
attachment 327450
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=327450&action=review
> > > Source/WebCore/animation/KeyframeEffect.cpp:54 > > + , m_keyframes("") > > empytString() is more efficient than writing ""
Will fix.
> > Source/WebCore/animation/KeyframeEffect.cpp:78 > > + KeyframeList newKeyframes("keyframe-effect-" + createCanonicalUUIDString()); > > + newKeyframes.clear(); > > Seems annoying to have to construct this with two values, and then clear > them out. Is there a more elegant construction we can come up with?
Agreed. I think we might be able to remove the addition of the two values in the KeyframeList constructor actually. Running WKTR through the animations and transitions directories reveals no failures, so I'll upload a new patch with that removal to see what the bots say, but I doubt any of our code relies those initial values.
> > Source/WebCore/animation/KeyframeEffect.cpp:127 > > - m_keyframes = WTFMove(newKeyframes); > > + m_keyframes.swap(newKeyframes); > > This seems unnecessary. Seems like KeyFrameList could and should easily > support move assignment since AtomicString, Vector, and HashSet all support > that.
Will add the move assignment operator you've suggested and revert to the previous move assignment.
> > Source/WebCore/rendering/style/KeyframeList.h:81 > > + void swap(KeyframeList& other) > > + { > > + std::swap(m_animationName, other.m_animationName); > > + std::swap(m_keyframes, other.m_keyframes); > > + std::swap(m_properties, other.m_properties); > > + } > > Should just add the move assignment operator instead: > > KeyFrameList& operator=(KeyFrameList&&) = default;
Easy. Thanks for the tip.
> But also, why doesn’t that get generated automatically for us?
That goes well beyond my current understand of how WebCore works.
Antoine Quint
Comment 5
2017-11-22 10:03:42 PST
Created
attachment 327458
[details]
Patch
Antoine Quint
Comment 6
2017-11-22 11:04:28 PST
Committed
r225099
: <
https://trac.webkit.org/changeset/225099
>
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