Title: [217677] branches/safari-603-branch

Diff

Modified: branches/safari-603-branch/LayoutTests/ChangeLog (217676 => 217677)


--- branches/safari-603-branch/LayoutTests/ChangeLog	2017-06-01 19:51:58 UTC (rev 217676)
+++ branches/safari-603-branch/LayoutTests/ChangeLog	2017-06-01 19:52:06 UTC (rev 217677)
@@ -1,3 +1,19 @@
+2017-06-01  Matthew Hanson  <matthew_han...@apple.com>
+
+        Cherry-pick r211501. rdar://problem/32080671
+
+    2017-02-01  Antoine Quint  <grao...@apple.com>
+
+            [mac-wk1] LayoutTest media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html is a flaky timeout
+            https://bugs.webkit.org/show_bug.cgi?id=165319
+            <rdar://problem/30284104>
+
+            Reviewed by Dean Jackson.
+
+            Since we've fixed the root cause of this test's flakiness, we no longer need to mark it as flaky.
+
+            * platform/mac/TestExpectations:
+
 2017-05-30  Ryan Haddad  <ryanhad...@apple.com>
 
         Merge r210012. rdar://problem/32472141

Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (217676 => 217677)


--- branches/safari-603-branch/Source/WebCore/ChangeLog	2017-06-01 19:51:58 UTC (rev 217676)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog	2017-06-01 19:52:06 UTC (rev 217677)
@@ -1,5 +1,52 @@
 2017-06-01  Matthew Hanson  <matthew_han...@apple.com>
 
+        Cherry-pick r211501. rdar://problem/32080671
+
+    2017-02-01  Antoine Quint  <grao...@apple.com>
+
+            [mac-wk1] LayoutTest media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html is a flaky timeout
+            https://bugs.webkit.org/show_bug.cgi?id=165319
+            <rdar://problem/30284104>
+
+            Reviewed by Dean Jackson.
+
+            Running media/controls/track-menu.html before media/modern-media-controls/tracks-support/tracks-
+            support-click-track-in-panel.html makes that test time out in all test runs. The root of the issue
+            is that animations are suspended by media/controls/track-menu.html with a call to
+            internals.suspendAnimations(), and that state isn't reset with a call to internals.resumeAnimations().
+            Then, media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html fails because
+            the selection animation for the tracks panel menu item that is clicked never completes and the delegate
+            to notify that an item in the tracks panel was selected is never fired, which leads to the test failure.
+
+            We change Internals::suspendAnimations() and Internals::resumeAnimations() to only affect the current
+            document, rather than calling into AnimationController::suspendAnimations() which would do just that,
+            but also set a Frame-wide flag that would prevent further animations from running, even in a subsequent
+            document load.
+
+            * dom/Document.cpp:
+            (WebCore::Document::prepareForDestruction): Ensure the document that is about to be destroyed is no longer
+            associated with an AnimationController.
+            * page/animation/AnimationController.cpp:
+            (WebCore::AnimationControllerPrivate::ensureCompositeAnimation): Update the animation's suspend state in case
+            the document its renderer is associated with is suspended. This is required since previously CompositeAnimations
+            would set their suspend state in their constructor, based on the Frame-wide suspended state, but there is no
+            document to use as a basis to query its suspended state in that constructor.
+            (WebCore::AnimationControllerPrivate::animationsAreSuspendedForDocument):
+            (WebCore::AnimationControllerPrivate::detachFromDocument):
+            (WebCore::AnimationControllerPrivate::suspendAnimationsForDocument):
+            (WebCore::AnimationControllerPrivate::resumeAnimationsForDocument):
+            (WebCore::AnimationControllerPrivate::startAnimationsIfNotSuspended):
+            (WebCore::AnimationController::animationsAreSuspendedForDocument):
+            (WebCore::AnimationController::detachFromDocument):
+            * page/animation/AnimationController.h:
+            * page/animation/AnimationControllerPrivate.h:
+            * testing/Internals.cpp:
+            (WebCore::Internals::animationsAreSuspended):
+            (WebCore::Internals::suspendAnimations):
+            (WebCore::Internals::resumeAnimations):
+
+2017-06-01  Matthew Hanson  <matthew_han...@apple.com>
+
         Cherry-pick r210226. rdar://problem/32080671
 
     2017-01-02  Andreas Kling  <akl...@apple.com>

Modified: branches/safari-603-branch/Source/WebCore/dom/Document.cpp (217676 => 217677)


--- branches/safari-603-branch/Source/WebCore/dom/Document.cpp	2017-06-01 19:51:58 UTC (rev 217676)
+++ branches/safari-603-branch/Source/WebCore/dom/Document.cpp	2017-06-01 19:52:06 UTC (rev 217677)
@@ -2284,6 +2284,8 @@
     if (m_hasPreparedForDestruction)
         return;
 
+    m_frame->animation().detachFromDocument(this);
+
 #if ENABLE(IOS_TOUCH_EVENTS)
     clearTouchEventHandlersAndListeners();
 #endif

Modified: branches/safari-603-branch/Source/WebCore/page/animation/AnimationController.cpp (217676 => 217677)


--- branches/safari-603-branch/Source/WebCore/page/animation/AnimationController.cpp	2017-06-01 19:51:58 UTC (rev 217676)
+++ branches/safari-603-branch/Source/WebCore/page/animation/AnimationController.cpp	2017-06-01 19:52:06 UTC (rev 217677)
@@ -91,6 +91,9 @@
         renderer.setIsCSSAnimating(true);
     }
 
+    if (animationsAreSuspendedForDocument(&renderer.document()))
+        result.iterator->value->suspendAnimations();
+
     return *result.iterator->value;
 }
 
@@ -316,8 +319,23 @@
     m_isSuspended = false;
 }
 
+bool AnimationControllerPrivate::animationsAreSuspendedForDocument(Document* document)
+{
+    return isSuspended() || m_suspendedDocuments.contains(document);
+}
+
+void AnimationControllerPrivate::detachFromDocument(Document* document)
+{
+    m_suspendedDocuments.remove(document);
+}
+
 void AnimationControllerPrivate::suspendAnimationsForDocument(Document* document)
 {
+    if (animationsAreSuspendedForDocument(document))
+        return;
+
+    m_suspendedDocuments.add(document);
+
     AnimationPrivateUpdateBlock updateBlock(*this);
 
     for (auto& animation : m_compositeAnimations) {
@@ -330,6 +348,11 @@
 
 void AnimationControllerPrivate::resumeAnimationsForDocument(Document* document)
 {
+    if (!animationsAreSuspendedForDocument(document))
+        return;
+
+    detachFromDocument(document);
+
     AnimationPrivateUpdateBlock updateBlock(*this);
 
     for (auto& animation : m_compositeAnimations) {
@@ -342,7 +365,7 @@
 
 void AnimationControllerPrivate::startAnimationsIfNotSuspended(Document* document)
 {
-    if (!isSuspended() || allowsNewAnimationsWhileSuspended())
+    if (!animationsAreSuspendedForDocument(document) || allowsNewAnimationsWhileSuspended())
         resumeAnimationsForDocument(document);
 }
 
@@ -713,6 +736,16 @@
 }
 #endif
 
+bool AnimationController::animationsAreSuspendedForDocument(Document* document)
+{
+    return m_data->animationsAreSuspendedForDocument(document);
+}
+
+void AnimationController::detachFromDocument(Document* document)
+{
+    return m_data->detachFromDocument(document);
+}
+
 void AnimationController::suspendAnimationsForDocument(Document* document)
 {
     LOG(Animations, "suspending animations for document %p", document);

Modified: branches/safari-603-branch/Source/WebCore/page/animation/AnimationController.h (217676 => 217677)


--- branches/safari-603-branch/Source/WebCore/page/animation/AnimationController.h	2017-06-01 19:51:58 UTC (rev 217676)
+++ branches/safari-603-branch/Source/WebCore/page/animation/AnimationController.h	2017-06-01 19:52:06 UTC (rev 217677)
@@ -74,8 +74,10 @@
     void serviceAnimations();
 #endif
 
-    void suspendAnimationsForDocument(Document*);
-    void resumeAnimationsForDocument(Document*);
+    WEBCORE_EXPORT void suspendAnimationsForDocument(Document*);
+    WEBCORE_EXPORT void resumeAnimationsForDocument(Document*);
+    WEBCORE_EXPORT bool animationsAreSuspendedForDocument(Document*);
+    void detachFromDocument(Document*);
     void startAnimationsIfNotSuspended(Document*);
 
     void beginAnimationUpdate();

Modified: branches/safari-603-branch/Source/WebCore/page/animation/AnimationControllerPrivate.h (217676 => 217677)


--- branches/safari-603-branch/Source/WebCore/page/animation/AnimationControllerPrivate.h	2017-06-01 19:51:58 UTC (rev 217676)
+++ branches/safari-603-branch/Source/WebCore/page/animation/AnimationControllerPrivate.h	2017-06-01 19:52:06 UTC (rev 217677)
@@ -83,7 +83,9 @@
 
     void suspendAnimationsForDocument(Document*);
     void resumeAnimationsForDocument(Document*);
+    bool animationsAreSuspendedForDocument(Document*);
     void startAnimationsIfNotSuspended(Document*);
+    void detachFromDocument(Document*);
 
     bool isRunningAnimationOnRenderer(RenderElement&, CSSPropertyID, AnimationBase::RunningState) const;
     bool isRunningAcceleratedAnimationOnRenderer(RenderElement&, CSSPropertyID, AnimationBase::RunningState) const;
@@ -147,7 +149,8 @@
     
     Vector<EventToDispatch> m_eventsToDispatch;
     Vector<Ref<Element>> m_elementChangesToDispatch;
-    
+    HashSet<Document*> m_suspendedDocuments;
+
     double m_beginAnimationUpdateTime;
 
     typedef HashSet<RefPtr<AnimationBase>> AnimationsSet;

Modified: branches/safari-603-branch/Source/WebCore/testing/Internals.cpp (217676 => 217677)


--- branches/safari-603-branch/Source/WebCore/testing/Internals.cpp	2017-06-01 19:51:58 UTC (rev 217676)
+++ branches/safari-603-branch/Source/WebCore/testing/Internals.cpp	2017-06-01 19:52:06 UTC (rev 217677)
@@ -755,7 +755,7 @@
     if (!document || !document->frame())
         return Exception { INVALID_ACCESS_ERR };
 
-    return document->frame()->animation().isSuspended();
+    return document->frame()->animation().animationsAreSuspendedForDocument(document);
 }
 
 ExceptionOr<void> Internals::suspendAnimations() const
@@ -764,7 +764,13 @@
     if (!document || !document->frame())
         return Exception { INVALID_ACCESS_ERR };
 
-    document->frame()->animation().suspendAnimations();
+    document->frame()->animation().suspendAnimationsForDocument(document);
+
+    for (Frame* frame = document->frame(); frame; frame = frame->tree().traverseNext()) {
+        if (Document* document = frame->document())
+            frame->animation().suspendAnimationsForDocument(document);
+    }
+
     return { };
 }
 
@@ -774,7 +780,13 @@
     if (!document || !document->frame())
         return Exception { INVALID_ACCESS_ERR };
 
-    document->frame()->animation().resumeAnimations();
+    document->frame()->animation().resumeAnimationsForDocument(document);
+
+    for (Frame* frame = document->frame(); frame; frame = frame->tree().traverseNext()) {
+        if (Document* document = frame->document())
+            frame->animation().resumeAnimationsForDocument(document);
+    }
+
     return { };
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to