⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 202918 in webkit


Ignore:
Timestamp:
Jul 7, 2016, 11:00:49 AM (10 years ago)
Author:
jer.noble@apple.com
Message:

Facebook videos without audio tracks will sometimes cause playback controls to appear.
https://bugs.webkit.org/show_bug.cgi?id=159437

Reviewed by Eric Carlson.

Because updatePlaybackControlsManager() will cause the session manager to walk through all
the outstanding sessions asking if it canControlControlsManager(), some sessions will say
they can control the controls manager if we are currently processing a user gesture. This is
obviously not intended (there may be a user gesture to un-mute video 1, but an unrelated
video 2 should not be allowed to use that use gesture to fulfill its own requirements.)

So in those situations where conditions may have changed and updatePlaybackControlsManager()
needs to be called, instead schedule the update for the next run loop.

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::setMuted):
(WebCore::HTMLMediaElement::layoutSizeChanged):
(WebCore::HTMLMediaElement::updatePlayState):
(WebCore::HTMLMediaElement::createMediaPlayer):
(WebCore::HTMLMediaElement::scheduleUpdatePlaybackControlsManager):

  • html/HTMLMediaElement.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r202917 r202918  
     12016-07-05  Jer Noble  <jer.noble@apple.com>
     2
     3        Facebook videos without audio tracks will sometimes cause playback controls to appear.
     4        https://bugs.webkit.org/show_bug.cgi?id=159437
     5
     6        Reviewed by Eric Carlson.
     7
     8        Because updatePlaybackControlsManager() will cause the session manager to walk through all
     9        the outstanding sessions asking if it canControlControlsManager(), some sessions will say
     10        they can control the controls manager if we are currently processing a user gesture. This is
     11        obviously not intended (there may be a user gesture to un-mute video 1, but an unrelated
     12        video 2 should not be allowed to use that use gesture to fulfill its own requirements.)
     13
     14        So in those situations where conditions may have changed and updatePlaybackControlsManager()
     15        needs to be called, instead schedule the update for the next run loop.
     16       
     17        * html/HTMLMediaElement.cpp:
     18        (WebCore::HTMLMediaElement::setMuted):
     19        (WebCore::HTMLMediaElement::layoutSizeChanged):
     20        (WebCore::HTMLMediaElement::updatePlayState):
     21        (WebCore::HTMLMediaElement::createMediaPlayer):
     22        (WebCore::HTMLMediaElement::scheduleUpdatePlaybackControlsManager):
     23        * html/HTMLMediaElement.h:
     24
    1252016-07-07  Jer Noble  <jer.noble@apple.com>
    226
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r202872 r202918  
    564564    m_promiseTaskQueue.close();
    565565    m_pauseAfterDetachedTaskQueue.close();
     566    m_updatePlaybackControlsManagerQueue.close();
    566567
    567568    m_completelyLoaded = true;
     
    33693370    }
    33703371
    3371     updatePlaybackControlsManager();
     3372    scheduleUpdatePlaybackControlsManager();
    33723373}
    33733374
     
    40144015    if (!m_receivedLayoutSizeChanged) {
    40154016        m_receivedLayoutSizeChanged = true;
    4016         updatePlaybackControlsManager();
     4017        scheduleUpdatePlaybackControlsManager();
    40174018    }
    40184019}
     
    48624863
    48634864    if (shouldBePlaying) {
    4864         updatePlaybackControlsManager();
     4865        scheduleUpdatePlaybackControlsManager();
    48654866
    48664867        setDisplayMode(Video);
     
    48964897        setPlaying(true);
    48974898    } else {
    4898         updatePlaybackControlsManager();
     4899        scheduleUpdatePlaybackControlsManager();
    48994900
    49004901        if (!playerPaused)
     
    50945095    m_promiseTaskQueue.close();
    50955096    m_pauseAfterDetachedTaskQueue.close();
     5097    m_updatePlaybackControlsManagerQueue.close();
    50965098
    50975099    ActiveDOMObject::contextDestroyed();
     
    51075109    m_asyncEventQueue.close();
    51085110    m_promiseTaskQueue.close();
     5111    m_updatePlaybackControlsManagerQueue.close();
    51095112
    51105113    // Once an active DOM object has been stopped it can not be restarted, so we can deallocate
     
    59575960#endif
    59585961    m_player = std::make_unique<MediaPlayer>(static_cast<MediaPlayerClient&>(*this));
    5959     updatePlaybackControlsManager();
     5962    scheduleUpdatePlaybackControlsManager();
    59605963
    59615964#if ENABLE(WEB_AUDIO)
     
    71217124}
    71227125
     7126void HTMLMediaElement::scheduleUpdatePlaybackControlsManager()
     7127{
     7128    if (!m_updatePlaybackControlsManagerQueue.hasPendingTasks())
     7129        m_updatePlaybackControlsManagerQueue.enqueueTask(std::bind(&HTMLMediaElement::updatePlaybackControlsManager, this));
     7130}
     7131
    71237132bool HTMLMediaElement::shouldOverrideBackgroundLoadingRestriction() const
    71247133{
  • trunk/Source/WebCore/html/HTMLMediaElement.h

    r202749 r202918  
    782782    void pauseAfterDetachedTask();
    783783    void updatePlaybackControlsManager();
     784    void scheduleUpdatePlaybackControlsManager();
    784785
    785786    void updateRenderer();
     
    798799    GenericTaskQueue<Timer> m_promiseTaskQueue;
    799800    GenericTaskQueue<Timer> m_pauseAfterDetachedTaskQueue;
     801    GenericTaskQueue<Timer> m_updatePlaybackControlsManagerQueue;
    800802    RefPtr<TimeRanges> m_playedTimeRanges;
    801803    GenericEventQueue m_asyncEventQueue;
Note: See TracChangeset for help on using the changeset viewer.