[webkit-reviews] review granted: [Bug 202192] [Web Animations] Move Document.getAnimations() to DocumentOrShadowRoot : [Attachment 395573] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 6 09:55:42 PDT 2020


Antti Koivisto <koivisto at iki.fi> has granted Antoine Quint
<graouts at apple.com>'s request for review:
Bug 202192: [Web Animations] Move Document.getAnimations() to
DocumentOrShadowRoot
https://bugs.webkit.org/show_bug.cgi?id=202192

Attachment 395573: Patch

https://bugs.webkit.org/attachment.cgi?id=395573&action=review




--- Comment #7 from Antti Koivisto <koivisto at iki.fi> ---
Comment on attachment 395573
  --> https://bugs.webkit.org/attachment.cgi?id=395573
Patch

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

> Source/WebCore/dom/Document.cpp:8111
> +Vector<RefPtr<WebAnimation>> Document::getMatchingAnimations(const
WTF::Function<bool(Element&)>& function)

We don't usually name functions getSomething. API functions like
getAnimations() are the exception. Maybe just matchingAnimations()?

> Source/WebCore/dom/Document.cpp:8129
> +    for (auto& animation : m_timeline->getAnimations()) {
> +	   auto* effect = animation->effect();
> +	   ASSERT(is<KeyframeEffect>(animation->effect()));
> +	   auto* target = downcast<KeyframeEffect>(*effect).target();
> +	   ASSERT(target);
> +	   if (function(*target))
> +	       animations.append(animation);
> +    }
> +    return animations;

This function doesn't really have much to do with Document. Maybe it could live
in DocumentTimeline instead?


More information about the webkit-reviews mailing list