Changeset 211501 in webkit


Ignore:
Timestamp:
Feb 1, 2017 11:54:25 AM (7 years ago)
Author:
commit-queue@webkit.org
Message:

[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>

Patch by Antoine Quint <Antoine Quint> on 2017-02-01
Reviewed by Dean Jackson.

Source/WebCore:

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):

LayoutTests:

Since we've fixed the root cause of this test's flakiness, we no longer need to mark it as flaky.

  • platform/mac/TestExpectations:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r211495 r211501  
     12017-02-01  Antoine Quint  <graouts@apple.com>
     2
     3        [mac-wk1] LayoutTest media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html is a flaky timeout
     4        https://bugs.webkit.org/show_bug.cgi?id=165319
     5        <rdar://problem/30284104>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Since we've fixed the root cause of this test's flakiness, we no longer need to mark it as flaky.
     10
     11        * platform/mac/TestExpectations:
     12
    1132017-02-01  Jer Noble  <jer.noble@apple.com>
    214
  • trunk/LayoutTests/platform/mac/TestExpectations

    r211447 r211501  
    14851485webkit.org/b/167442 [ ElCapitan ] media/modern-media-controls/airplay-support/airplay-support.html [ Pass Timeout ]
    14861486
    1487 webkit.org/b/165319 media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html [ Pass Timeout ]
    1488 
    14891487webkit.org/b/167461 media/modern-media-controls/layout-node/addChild.html [ Pass Timeout ]
    14901488
  • trunk/Source/WebCore/ChangeLog

    r211500 r211501  
     12017-02-01  Antoine Quint  <graouts@apple.com>
     2
     3        [mac-wk1] LayoutTest media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html is a flaky timeout
     4        https://bugs.webkit.org/show_bug.cgi?id=165319
     5        <rdar://problem/30284104>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Running media/controls/track-menu.html before media/modern-media-controls/tracks-support/tracks-
     10        support-click-track-in-panel.html makes that test time out in all test runs. The root of the issue
     11        is that animations are suspended by media/controls/track-menu.html with a call to
     12        internals.suspendAnimations(), and that state isn't reset with a call to internals.resumeAnimations().
     13        Then, media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html fails because
     14        the selection animation for the tracks panel menu item that is clicked never completes and the delegate
     15        to notify that an item in the tracks panel was selected is never fired, which leads to the test failure.
     16
     17        We change Internals::suspendAnimations() and Internals::resumeAnimations() to only affect the current
     18        document, rather than calling into AnimationController::suspendAnimations() which would do just that,
     19        but also set a Frame-wide flag that would prevent further animations from running, even in a subsequent
     20        document load.
     21
     22        * dom/Document.cpp:
     23        (WebCore::Document::prepareForDestruction): Ensure the document that is about to be destroyed is no longer
     24        associated with an AnimationController.
     25        * page/animation/AnimationController.cpp:
     26        (WebCore::AnimationControllerPrivate::ensureCompositeAnimation): Update the animation's suspend state in case
     27        the document its renderer is associated with is suspended. This is required since previously CompositeAnimations
     28        would set their suspend state in their constructor, based on the Frame-wide suspended state, but there is no
     29        document to use as a basis to query its suspended state in that constructor.
     30        (WebCore::AnimationControllerPrivate::animationsAreSuspendedForDocument):
     31        (WebCore::AnimationControllerPrivate::detachFromDocument):
     32        (WebCore::AnimationControllerPrivate::suspendAnimationsForDocument):
     33        (WebCore::AnimationControllerPrivate::resumeAnimationsForDocument):
     34        (WebCore::AnimationControllerPrivate::startAnimationsIfNotSuspended):
     35        (WebCore::AnimationController::animationsAreSuspendedForDocument):
     36        (WebCore::AnimationController::detachFromDocument):
     37        * page/animation/AnimationController.h:
     38        * page/animation/AnimationControllerPrivate.h:
     39        * testing/Internals.cpp:
     40        (WebCore::Internals::animationsAreSuspended):
     41        (WebCore::Internals::suspendAnimations):
     42        (WebCore::Internals::resumeAnimations):
     43
    1442017-02-01  Ryan Haddad  <ryanhaddad@apple.com>
    245
  • trunk/Source/WebCore/dom/Document.cpp

    r211455 r211501  
    22642264        return;
    22652265
     2266    m_frame->animation().detachFromDocument(this);
     2267
    22662268#if ENABLE(IOS_TOUCH_EVENTS)
    22672269    clearTouchEventHandlersAndListeners();
  • trunk/Source/WebCore/page/animation/AnimationController.cpp

    r211033 r211501  
    9292    }
    9393
     94    if (animationsAreSuspendedForDocument(&renderer.document()))
     95        result.iterator->value->suspendAnimations();
     96
    9497    return *result.iterator->value;
    9598}
     
    309312}
    310313
     314bool AnimationControllerPrivate::animationsAreSuspendedForDocument(Document* document)
     315{
     316    return isSuspended() || m_suspendedDocuments.contains(document);
     317}
     318
     319void AnimationControllerPrivate::detachFromDocument(Document* document)
     320{
     321    m_suspendedDocuments.remove(document);
     322}
     323
    311324void AnimationControllerPrivate::suspendAnimationsForDocument(Document* document)
    312325{
     326    if (animationsAreSuspendedForDocument(document))
     327        return;
     328
     329    m_suspendedDocuments.add(document);
     330
    313331    AnimationPrivateUpdateBlock updateBlock(*this);
    314332
     
    323341void AnimationControllerPrivate::resumeAnimationsForDocument(Document* document)
    324342{
     343    if (!animationsAreSuspendedForDocument(document))
     344        return;
     345
     346    detachFromDocument(document);
     347
    325348    AnimationPrivateUpdateBlock updateBlock(*this);
    326349
     
    335358void AnimationControllerPrivate::startAnimationsIfNotSuspended(Document* document)
    336359{
    337     if (!isSuspended() || allowsNewAnimationsWhileSuspended())
     360    if (!animationsAreSuspendedForDocument(document) || allowsNewAnimationsWhileSuspended())
    338361        resumeAnimationsForDocument(document);
    339362}
     
    702725}
    703726
     727bool AnimationController::animationsAreSuspendedForDocument(Document* document)
     728{
     729    return m_data->animationsAreSuspendedForDocument(document);
     730}
     731
     732void AnimationController::detachFromDocument(Document* document)
     733{
     734    return m_data->detachFromDocument(document);
     735}
     736
    704737void AnimationController::suspendAnimationsForDocument(Document* document)
    705738{
  • trunk/Source/WebCore/page/animation/AnimationController.h

    r210797 r211501  
    7373    void serviceAnimations();
    7474
    75     void suspendAnimationsForDocument(Document*);
    76     void resumeAnimationsForDocument(Document*);
     75    WEBCORE_EXPORT void suspendAnimationsForDocument(Document*);
     76    WEBCORE_EXPORT void resumeAnimationsForDocument(Document*);
     77    WEBCORE_EXPORT bool animationsAreSuspendedForDocument(Document*);
     78    void detachFromDocument(Document*);
    7779    void startAnimationsIfNotSuspended(Document*);
    7880
  • trunk/Source/WebCore/page/animation/AnimationControllerPrivate.h

    r211033 r211501  
    7070    void suspendAnimationsForDocument(Document*);
    7171    void resumeAnimationsForDocument(Document*);
     72    bool animationsAreSuspendedForDocument(Document*);
    7273    void startAnimationsIfNotSuspended(Document*);
     74    void detachFromDocument(Document*);
    7375
    7476    bool isRunningAnimationOnRenderer(RenderElement&, CSSPropertyID, AnimationBase::RunningState) const;
     
    132134    Vector<EventToDispatch> m_eventsToDispatch;
    133135    Vector<Ref<Element>> m_elementChangesToDispatch;
    134    
     136    HashSet<Document*> m_suspendedDocuments;
     137
    135138    double m_beginAnimationUpdateTime;
    136139
  • trunk/Source/WebCore/testing/Internals.cpp

    r211356 r211501  
    740740        return Exception { INVALID_ACCESS_ERR };
    741741
    742     return document->frame()->animation().isSuspended();
     742    return document->frame()->animation().animationsAreSuspendedForDocument(document);
    743743}
    744744
     
    749749        return Exception { INVALID_ACCESS_ERR };
    750750
    751     document->frame()->animation().suspendAnimations();
     751    document->frame()->animation().suspendAnimationsForDocument(document);
     752
     753    for (Frame* frame = document->frame(); frame; frame = frame->tree().traverseNext()) {
     754        if (Document* document = frame->document())
     755            frame->animation().suspendAnimationsForDocument(document);
     756    }
     757
    752758    return { };
    753759}
     
    759765        return Exception { INVALID_ACCESS_ERR };
    760766
    761     document->frame()->animation().resumeAnimations();
     767    document->frame()->animation().resumeAnimationsForDocument(document);
     768
     769    for (Frame* frame = document->frame(); frame; frame = frame->tree().traverseNext()) {
     770        if (Document* document = frame->document())
     771            frame->animation().resumeAnimationsForDocument(document);
     772    }
     773
    762774    return { };
    763775}
Note: See TracChangeset for help on using the changeset viewer.