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

Changeset 93878 in webkit


Ignore:
Timestamp:
Aug 26, 2011, 8:14:03 AM (15 years ago)
Author:
eric.carlson@apple.com
Message:

<video> playlist can not advance when playing in background tab
https://bugs.webkit.org/show_bug.cgi?id=66978

Reviewed by Darin Adler.

No new tests added because it isn't possible to simulate a background tab in DRT.

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::HTMLMediaElement): Set RequirePageConsentToLoadMedia restriction.
(WebCore::HTMLMediaElement::loadInternal): Don't consider page->canStartMedia if it has ever

allowed a file to load.

  • html/HTMLMediaElement.h:

(WebCore::HTMLMediaElement::requirePageConsentToLoadMedia): New.
(WebCore::HTMLMediaElement::removeBehaviorRestriction): New.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r93873 r93878  
     12011-08-26  Eric Carlson  <eric.carlson@apple.com>
     2
     3        <video> playlist can not advance when playing in background tab
     4        https://bugs.webkit.org/show_bug.cgi?id=66978
     5
     6        Reviewed by Darin Adler.
     7
     8        No new tests added because it isn't possible to simulate a background tab in DRT.
     9
     10        * html/HTMLMediaElement.cpp:
     11        (WebCore::HTMLMediaElement::HTMLMediaElement): Set RequirePageConsentToLoadMedia restriction.
     12        (WebCore::HTMLMediaElement::loadInternal): Don't consider page->canStartMedia if it has ever
     13            allowed a file to load.
     14        * html/HTMLMediaElement.h:
     15        (WebCore::HTMLMediaElement::requirePageConsentToLoadMedia): New.
     16        (WebCore::HTMLMediaElement::removeBehaviorRestriction): New.
     17
    1182011-08-26  Andreas Kling  <kling@webkit.org>
    219
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r93437 r93878  
    151151    , m_proxyWidget(0)
    152152#endif
    153     , m_restrictions(RequireUserGestureForFullScreenRestriction)
     153    , m_restrictions(RequireUserGestureForFullScreenRestriction | RequirePageConsentToLoadMedia)
    154154    , m_preload(MediaPlayer::Auto)
    155155    , m_displayMode(Unknown)
     
    585585    // If we can't start a load right away, start it later.
    586586    Page* page = document()->page();
    587     if (page && !page->canStartMedia()) {
     587    if (requirePageConsentToLoadMedia() && page && !page->canStartMedia()) {
    588588        if (m_isWaitingUntilMediaCanStart)
    589589            return;
     
    592592        return;
    593593    }
     594   
     595    // Once the page has allowed an element to load media, it is free to load at will. This allows a
     596    // playlist that starts in a foreground tab to continue automatically if the tab is subsequently
     597    // put in the the background.
     598    removeBehaviorRestriction(RequirePageConsentToLoadMedia);
    594599
    595600    selectMediaResource();
  • trunk/Source/WebCore/html/HTMLMediaElement.h

    r93108 r93878  
    185185        RequireUserGestureForLoadRestriction = 1 << 0,
    186186        RequireUserGestureForRateChangeRestriction = 1 << 1,
    187         RequireUserGestureForFullScreenRestriction = 1 << 2
     187        RequireUserGestureForFullScreenRestriction = 1 << 2,
     188        RequirePageConsentToLoadMedia = 1 << 3,
    188189    };
    189190    typedef unsigned BehaviorRestrictions;
     
    192193    bool requireUserGestureForRateChange() const { return m_restrictions & RequireUserGestureForRateChangeRestriction; }
    193194    bool requireUserGestureForFullScreen() const { return m_restrictions & RequireUserGestureForFullScreenRestriction; }
     195    bool requirePageConsentToLoadMedia() const { return m_restrictions & RequirePageConsentToLoadMedia; }
    194196
    195197    void setBehaviorRestrictions(BehaviorRestrictions restrictions) { m_restrictions = restrictions; }
     
    333335    virtual void mediaCanStart();
    334336
     337    void removeBehaviorRestriction(BehaviorRestrictions restriction) { m_restrictions &= ~restriction; }
     338
    335339    void setShouldDelayLoadEvent(bool);
    336340
Note: See TracChangeset for help on using the changeset viewer.