https://bugs.webkit.org/show_bug.cgi?id=178643
Patch by Antoine Quint <graouts@apple.com> on 2017-10-22
Reviewed by Dean Jackson.
Source/WebCore:
If a timeline is provided as a parameter to the Animation constructor,
add it to the timeline, and remove it when the object is destroyed.
We also start the basic mechanism to dump the contents of a timeline
as text for testing purposes, currently only logging the number of
animations in a timeline and just logging the class name for animation
themselves.
Test: webanimations/animation-creation-addition.html
* animation/AnimationTimeline.cpp:
(WebCore::AnimationTimeline::description):
* animation/AnimationTimeline.h:
* animation/AnimationTimeline.idl:
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::create):
(WebCore::WebAnimation::~WebAnimation):
(WebCore::WebAnimation::description):
* animation/WebAnimation.h:
* testing/Internals.cpp:
(WebCore::Internals::timelineDescription):
* testing/Internals.h:
* testing/Internals.idl:
LayoutTests:
Add a new test that checks that animations created with a timeline
are added to the provided timeline.
* webanimations/animation-creation-addition-expected.txt: Added.
* webanimations/animation-creation-addition.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223825
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-10-22 Antoine Quint <graouts@apple.com>
+
+ [Web Animations] Add animations to the timeline
+ https://bugs.webkit.org/show_bug.cgi?id=178643
+
+ Reviewed by Dean Jackson.
+
+ Add a new test that checks that animations created with a timeline
+ are added to the provided timeline.
+
+ * webanimations/animation-creation-addition-expected.txt: Added.
+ * webanimations/animation-creation-addition.html: Added.
+
2017-10-21 Dean Jackson <dino@apple.com>
createImageBitmap with basic HTMLImageElement
--- /dev/null
+Constructing an Animation with a timeline should add the animation to the timeline.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+DocumentTimeline with 2 animations:
+ 1. Animation
+ 2. Animation
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<script src="../resources/js-test-pre.js"></script>
+<script>
+
+description("Constructing an Animation with a timeline should add the animation to the timeline.");
+
+new Animation(document.timeline);
+new Animation();
+new Animation(document.timeline);
+debug(internals.timelineDescription(document.timeline));
+
+</script>
+<script src="../resources/js-test-post.js"></script>
\ No newline at end of file
+2017-10-22 Antoine Quint <graouts@apple.com>
+
+ [Web Animations] Add animations to the timeline
+ https://bugs.webkit.org/show_bug.cgi?id=178643
+
+ Reviewed by Dean Jackson.
+
+ If a timeline is provided as a parameter to the Animation constructor,
+ add it to the timeline, and remove it when the object is destroyed.
+
+ We also start the basic mechanism to dump the contents of a timeline
+ as text for testing purposes, currently only logging the number of
+ animations in a timeline and just logging the class name for animation
+ themselves.
+
+ Test: webanimations/animation-creation-addition.html
+
+ * animation/AnimationTimeline.cpp:
+ (WebCore::AnimationTimeline::description):
+ * animation/AnimationTimeline.h:
+ * animation/AnimationTimeline.idl:
+ * animation/WebAnimation.cpp:
+ (WebCore::WebAnimation::create):
+ (WebCore::WebAnimation::~WebAnimation):
+ (WebCore::WebAnimation::description):
+ * animation/WebAnimation.h:
+ * testing/Internals.cpp:
+ (WebCore::Internals::timelineDescription):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2017-10-21 Zalan Bujtas <zalan@apple.com>
[FrameView::layout cleanup] Drop allowSubtree parameter
#include "AnimationTimeline.h"
#include "DocumentTimeline.h"
+#include <wtf/text/TextStream.h>
+#include <wtf/text/WTFString.h>
namespace WebCore {
m_animations.remove(WTFMove(animation));
}
+String AnimationTimeline::description()
+{
+ TextStream stream;
+ int count = 1;
+ stream << (m_classType == DocumentTimelineClass ? "DocumentTimeline" : "AnimationTimeline") << " with " << m_animations.size() << " animations:";
+ stream << "\n";
+ for (const auto& animation : m_animations) {
+ writeIndent(stream, 1);
+ stream << count << ". " << animation->description();
+ stream << "\n";
+ count++;
+ }
+ return stream.release();
+}
+
} // namespace WebCore
#pragma once
#include "WebAnimation.h"
+#include <wtf/Forward.h>
#include <wtf/HashSet.h>
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
bool isDocumentTimeline() const { return m_classType == DocumentTimelineClass; }
void addAnimation(Ref<WebAnimation>&&);
void removeAnimation(Ref<WebAnimation>&&);
+ WEBCORE_EXPORT String description();
virtual ~AnimationTimeline();
[
EnabledAtRuntime=WebAnimations,
+ ExportMacro=WEBCORE_EXPORT,
CustomToJSObject
] interface AnimationTimeline {
};
#include "config.h"
#include "WebAnimation.h"
+#include <wtf/text/WTFString.h>
#include "AnimationTimeline.h"
Ref<WebAnimation> WebAnimation::create(AnimationTimeline* timeline)
{
- return adoptRef(*new WebAnimation(timeline));
+ auto result = adoptRef(*new WebAnimation(timeline));
+
+ if (timeline)
+ timeline->addAnimation(result.copyRef());
+
+ return result;
}
WebAnimation::WebAnimation(AnimationTimeline* timeline)
WebAnimation::~WebAnimation()
{
+ if (m_timeline)
+ m_timeline->removeAnimation(*this);
+}
+
+String WebAnimation::description()
+{
+ return "Animation";
}
} // namespace WebCore
#pragma once
+#include <wtf/Forward.h>
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
~WebAnimation();
AnimationTimeline* timeline() const { return m_timeline.get(); }
+ String description();
private:
WebAnimation(AnimationTimeline*);
}
#endif
+String Internals::timelineDescription(AnimationTimeline& timeline)
+{
+ return timeline.description();
+}
+
} // namespace WebCore
namespace WebCore {
+class AnimationTimeline;
class AudioContext;
class CacheStorageConnection;
class DOMRect;
bool hasServiceWorkerRegisteredForOrigin(const String&);
+ String timelineDescription(AnimationTimeline&);
+
private:
explicit Internals(Document&);
Document* contextDocument() const;
[Conditional=SERVICE_WORKER] ExtendableEvent createTrustedExtendableEvent();
boolean hasServiceWorkerRegisteredForOrigin(DOMString origin);
+
+ [EnabledAtRuntime=WebAnimations] DOMString timelineDescription(AnimationTimeline timeline);
};