- Revision
- 233325
- Author
- grao...@webkit.org
- Date
- 2018-06-28 14:13:16 -0700 (Thu, 28 Jun 2018)
Log Message
[Web Animations] Make imported/mozilla/css-animations/test_animation-starttime.html pass reliably
https://bugs.webkit.org/show_bug.cgi?id=183834
<rdar://problem/40997932>
Reviewed by Dean Jackson.
LayoutTests/imported/mozilla:
Mark progressions in the Mozilla CSS Animations tests.
* css-animations/test_animation-starttime-expected.txt:
Source/WebCore:
We need to run pending tasks in the "update animations" procedure to ensure that the start time has been set
to a different time than the timeline time at the time the animation was asked to play(). This ensure the
timeline current time has progressed and can be queried to a different value in a requestAnimationFrame()
callback.
When invalidating events, we need to make sure we disregard instances when an animation has and is still pending
so that we wait until we change the pending state to work out which events to enqueue.
* animation/DeclarativeAnimation.cpp:
(WebCore::DeclarativeAnimation::invalidateDOMEvents):
* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::updateAnimations):
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::updatePendingTasks):
(WebCore::WebAnimation::timeToNextRequiredTick const):
(WebCore::WebAnimation::runPendingTasks):
* animation/WebAnimation.h:
LayoutTests:
This test now passes reliably so we remove any specific expectation. Another test needed to be modified to account for
the pending state being updated at a different time, so we just wait a frame to ensure the animation is started.
* TestExpectations:
* compositing/visible-rect/animated.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (233324 => 233325)
--- trunk/LayoutTests/ChangeLog 2018-06-28 21:00:45 UTC (rev 233324)
+++ trunk/LayoutTests/ChangeLog 2018-06-28 21:13:16 UTC (rev 233325)
@@ -1,3 +1,17 @@
+2018-06-28 Antoine Quint <grao...@apple.com>
+
+ [Web Animations] Make imported/mozilla/css-animations/test_animation-starttime.html pass reliably
+ https://bugs.webkit.org/show_bug.cgi?id=183834
+ <rdar://problem/40997932>
+
+ Reviewed by Dean Jackson.
+
+ This test now passes reliably so we remove any specific expectation. Another test needed to be modified to account for
+ the pending state being updated at a different time, so we just wait a frame to ensure the animation is started.
+
+ * TestExpectations:
+ * compositing/visible-rect/animated.html:
+
2018-06-28 Jer Noble <jer.no...@apple.com>
Unreviewed gardening; media/video-buffering-allowed.html is flakey due to not completing in time.
Modified: trunk/LayoutTests/TestExpectations (233324 => 233325)
--- trunk/LayoutTests/TestExpectations 2018-06-28 21:00:45 UTC (rev 233324)
+++ trunk/LayoutTests/TestExpectations 2018-06-28 21:13:16 UTC (rev 233325)
@@ -1963,7 +1963,6 @@
webkit.org/b/181123 imported/w3c/web-platform-tests/web-animations/interfaces/Animation/finish.html [ Pass Failure ]
webkit.org/b/181888 imported/w3c/web-platform-tests/web-animations/timing-model/animation-effects/current-iteration.html [ Pass Failure ]
-webkit.org/b/183834 imported/mozilla/css-animations/test_animation-starttime.html [ Pass Failure Timeout ]
webkit.org/b/183836 imported/mozilla/css-animations/test_animations-dynamic-changes.html [ Pass Failure Timeout ]
webkit.org/b/183837 imported/mozilla/css-transitions/test_document-get-animations.html [ Pass Failure Timeout ]
webkit.org/b/183840 imported/mozilla/css-animations/test_document-get-animations.html [ Pass Failure Timeout ]
Modified: trunk/LayoutTests/compositing/visible-rect/animated.html (233324 => 233325)
--- trunk/LayoutTests/compositing/visible-rect/animated.html 2018-06-28 21:00:45 UTC (rev 233324)
+++ trunk/LayoutTests/compositing/visible-rect/animated.html 2018-06-28 21:13:16 UTC (rev 233325)
@@ -34,11 +34,13 @@
function doTest()
{
document.getElementById('animated').addEventListener('webkitAnimationStart', function() {
- if (window.internals)
- document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS)
+ requestAnimationFrame(() => {
+ if (window.internals)
+ document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS)
- if (window.testRunner)
- testRunner.notifyDone();
+ if (window.testRunner)
+ testRunner.notifyDone();
+ });
}, false);
}
window.addEventListener('load', doTest, false);
Modified: trunk/LayoutTests/imported/mozilla/ChangeLog (233324 => 233325)
--- trunk/LayoutTests/imported/mozilla/ChangeLog 2018-06-28 21:00:45 UTC (rev 233324)
+++ trunk/LayoutTests/imported/mozilla/ChangeLog 2018-06-28 21:13:16 UTC (rev 233325)
@@ -1,3 +1,15 @@
+2018-06-28 Antoine Quint <grao...@apple.com>
+
+ [Web Animations] Make imported/mozilla/css-animations/test_animation-starttime.html pass reliably
+ https://bugs.webkit.org/show_bug.cgi?id=183834
+ <rdar://problem/40997932>
+
+ Reviewed by Dean Jackson.
+
+ Mark progressions in the Mozilla CSS Animations tests.
+
+ * css-animations/test_animation-starttime-expected.txt:
+
2018-06-25 Antoine Quint <grao...@apple.com>
[Web Animations] Make imported/mozilla/css-animations/test_animation-pausing.html pass reliably
Modified: trunk/LayoutTests/imported/mozilla/css-animations/test_animation-starttime-expected.txt (233324 => 233325)
--- trunk/LayoutTests/imported/mozilla/css-animations/test_animation-starttime-expected.txt 2018-06-28 21:00:45 UTC (rev 233324)
+++ trunk/LayoutTests/imported/mozilla/css-animations/test_animation-starttime-expected.txt 2018-06-28 21:13:16 UTC (rev 233325)
@@ -6,7 +6,7 @@
PASS startTime while pause-pending and play-pending
PASS startTime while play-pending from finished state
PASS startTime while play-pending from finished state using finish()
-FAIL Pausing should make the startTime become null assert_true: After the animation has started, startTime is greater than the time when it was started expected true got false
+PASS Pausing should make the startTime become null
PASS Sanity test to check round-tripping assigning to a new animation's startTime
PASS Skipping forward through animation
PASS Skipping backwards through animation
Modified: trunk/Source/WebCore/ChangeLog (233324 => 233325)
--- trunk/Source/WebCore/ChangeLog 2018-06-28 21:00:45 UTC (rev 233324)
+++ trunk/Source/WebCore/ChangeLog 2018-06-28 21:13:16 UTC (rev 233325)
@@ -1,3 +1,29 @@
+2018-06-28 Antoine Quint <grao...@apple.com>
+
+ [Web Animations] Make imported/mozilla/css-animations/test_animation-starttime.html pass reliably
+ https://bugs.webkit.org/show_bug.cgi?id=183834
+ <rdar://problem/40997932>
+
+ Reviewed by Dean Jackson.
+
+ We need to run pending tasks in the "update animations" procedure to ensure that the start time has been set
+ to a different time than the timeline time at the time the animation was asked to play(). This ensure the
+ timeline current time has progressed and can be queried to a different value in a requestAnimationFrame()
+ callback.
+
+ When invalidating events, we need to make sure we disregard instances when an animation has and is still pending
+ so that we wait until we change the pending state to work out which events to enqueue.
+
+ * animation/DeclarativeAnimation.cpp:
+ (WebCore::DeclarativeAnimation::invalidateDOMEvents):
+ * animation/DocumentTimeline.cpp:
+ (WebCore::DocumentTimeline::updateAnimations):
+ * animation/WebAnimation.cpp:
+ (WebCore::WebAnimation::updatePendingTasks):
+ (WebCore::WebAnimation::timeToNextRequiredTick const):
+ (WebCore::WebAnimation::runPendingTasks):
+ * animation/WebAnimation.h:
+
2018-06-28 Ryosuke Niwa <rn...@webkit.org>
Release assert in ScriptController::canExecuteScripts via WebCore::SVGUseElement::insertedIntoAncestor
Modified: trunk/Source/WebCore/animation/DeclarativeAnimation.cpp (233324 => 233325)
--- trunk/Source/WebCore/animation/DeclarativeAnimation.cpp 2018-06-28 21:00:45 UTC (rev 233324)
+++ trunk/Source/WebCore/animation/DeclarativeAnimation.cpp 2018-06-28 21:13:16 UTC (rev 233325)
@@ -121,6 +121,9 @@
auto* animationEffect = effect();
auto isPending = pending();
+ if (isPending && m_wasPending)
+ return;
+
auto iteration = animationEffect ? animationEffect->currentIteration().value_or(0) : 0;
auto currentPhase = animationEffect ? animationEffect->phase() : phaseWithoutEffect();
Modified: trunk/Source/WebCore/animation/DocumentTimeline.cpp (233324 => 233325)
--- trunk/Source/WebCore/animation/DocumentTimeline.cpp 2018-06-28 21:00:45 UTC (rev 233324)
+++ trunk/Source/WebCore/animation/DocumentTimeline.cpp 2018-06-28 21:13:16 UTC (rev 233325)
@@ -232,6 +232,9 @@
void DocumentTimeline::updateAnimations()
{
+ for (const auto& animation : animations())
+ animation->runPendingTasks();
+
if (m_document && hasElementAnimations()) {
for (const auto& elementToAnimationsMapItem : elementToAnimationsMap())
elementToAnimationsMapItem.key->invalidateStyleAndLayerComposition();
Modified: trunk/Source/WebCore/animation/WebAnimation.cpp (233324 => 233325)
--- trunk/Source/WebCore/animation/WebAnimation.cpp 2018-06-28 21:00:45 UTC (rev 233324)
+++ trunk/Source/WebCore/animation/WebAnimation.cpp 2018-06-28 21:13:16 UTC (rev 233325)
@@ -988,25 +988,6 @@
void WebAnimation::updatePendingTasks()
{
- if (hasPendingPauseTask() && is<DocumentTimeline>(m_timeline)) {
- if (auto document = downcast<DocumentTimeline>(*m_timeline).document()) {
- document->postTask([this, protectedThis = makeRef(*this)] (auto&) {
- if (this->hasPendingPauseTask() && m_timeline)
- this->runPendingPauseTask();
- });
- }
- }
-
- // FIXME: This should only happen if we're ready, at the moment we think we're ready if we have a timeline.
- if (hasPendingPlayTask() && is<DocumentTimeline>(m_timeline)) {
- if (auto document = downcast<DocumentTimeline>(*m_timeline).document()) {
- document->postTask([this, protectedThis = makeRef(*this)] (auto&) {
- if (this->hasPendingPlayTask() && m_timeline)
- this->runPendingPlayTask();
- });
- }
- }
-
timingModelDidChange();
}
@@ -1014,13 +995,19 @@
{
// If we don't have a timeline, an effect, a start time or a playback rate other than 0,
// there is no value to apply so we don't need to schedule invalidation.
- if (!m_timeline || !m_effect || !m_startTime || !m_playbackRate)
+ if (!m_timeline || !m_effect || !m_playbackRate)
return Seconds::infinity();
- // If we're in the running state, we need to schedule invalidation as soon as possible.
- if (playState() == PlayState::Running)
+ if (pending())
return 0_s;
+ if (!m_startTime)
+ return Seconds::infinity();
+
+ // If we're in or expected to be in the running state, we need to schedule invalidation as soon as possible.
+ if (hasPendingPlayTask() || playState() == PlayState::Running)
+ return 0_s;
+
// If our current time is negative, we need to be scheduled to be resolved at the inverse
// of our current time, unless we fill backwards, in which case we want to invalidate as
// soon as possible.
@@ -1033,6 +1020,15 @@
return Seconds::infinity();
}
+void WebAnimation::runPendingTasks()
+{
+ if (hasPendingPauseTask())
+ runPendingPauseTask();
+
+ if (hasPendingPlayTask())
+ runPendingPlayTask();
+}
+
void WebAnimation::resolve(RenderStyle& targetStyle)
{
updateFinishedState(DidSeek::No, SynchronouslyNotify::Yes);
Modified: trunk/Source/WebCore/animation/WebAnimation.h (233324 => 233325)
--- trunk/Source/WebCore/animation/WebAnimation.h 2018-06-28 21:00:45 UTC (rev 233324)
+++ trunk/Source/WebCore/animation/WebAnimation.h 2018-06-28 21:13:16 UTC (rev 233325)
@@ -107,6 +107,7 @@
Seconds timeToNextRequiredTick() const;
virtual void resolve(RenderStyle&);
+ void runPendingTasks();
void effectTargetDidChange(Element* previousTarget, Element* newTarget);
void acceleratedStateDidChange();
void applyPendingAcceleratedActions();