Title: [94209] branches/safari-534.51-branch/Source/WebCore

Diff

Modified: branches/safari-534.51-branch/Source/WebCore/ChangeLog (94208 => 94209)


--- branches/safari-534.51-branch/Source/WebCore/ChangeLog	2011-08-31 18:37:50 UTC (rev 94208)
+++ branches/safari-534.51-branch/Source/WebCore/ChangeLog	2011-08-31 18:46:14 UTC (rev 94209)
@@ -1,3 +1,23 @@
+2011-08-29  Lucas Forschler  <[email protected]>
+
+    Merged 93878
+
+    2011-08-26  Eric Carlson  <[email protected]>
+
+            <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.
 2011-08-30  Lucas Forschler  <[email protected]>
 
     Reverted 93664.

Modified: branches/safari-534.51-branch/Source/WebCore/html/HTMLMediaElement.cpp (94208 => 94209)


--- branches/safari-534.51-branch/Source/WebCore/html/HTMLMediaElement.cpp	2011-08-31 18:37:50 UTC (rev 94208)
+++ branches/safari-534.51-branch/Source/WebCore/html/HTMLMediaElement.cpp	2011-08-31 18:46:14 UTC (rev 94209)
@@ -143,7 +143,7 @@
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
     , m_proxyWidget(0)
 #endif
-    , m_restrictions(RequireUserGestureForFullScreenRestriction)
+    , m_restrictions(RequireUserGestureForFullScreenRestriction | RequirePageConsentToLoadMedia)
     , m_preload(MediaPlayer::Auto)
     , m_displayMode(Unknown)
     , m_processingMediaPlayerCallback(0)
@@ -586,13 +586,18 @@
 {
     // If we can't start a load right away, start it later.
     Page* page = document()->page();
-    if (page && !page->canStartMedia()) {
+    if (requirePageConsentToLoadMedia() && page && !page->canStartMedia()) {
         if (m_isWaitingUntilMediaCanStart)
             return;
         document()->addMediaCanStartListener(this);
         m_isWaitingUntilMediaCanStart = true;
         return;
     }
+    
+    // Once the page has allowed an element to load media, it is free to load at will. This allows a 
+    // playlist that starts in a foreground tab to continue automatically if the tab is subsequently 
+    // put in the the background.
+    removeBehaviorRestriction(RequirePageConsentToLoadMedia);
 
     selectMediaResource();
 }

Modified: branches/safari-534.51-branch/Source/WebCore/html/HTMLMediaElement.h (94208 => 94209)


--- branches/safari-534.51-branch/Source/WebCore/html/HTMLMediaElement.h	2011-08-31 18:37:50 UTC (rev 94208)
+++ branches/safari-534.51-branch/Source/WebCore/html/HTMLMediaElement.h	2011-08-31 18:46:14 UTC (rev 94209)
@@ -186,13 +186,15 @@
         NoRestrictions = 0,
         RequireUserGestureForLoadRestriction = 1 << 0,
         RequireUserGestureForRateChangeRestriction = 1 << 1,
-        RequireUserGestureForFullScreenRestriction = 1 << 2
+        RequireUserGestureForFullScreenRestriction = 1 << 2,
+        RequirePageConsentToLoadMedia = 1 << 3,
     };
     typedef unsigned BehaviorRestrictions;
     
     bool requireUserGestureForLoad() const { return m_restrictions & RequireUserGestureForLoadRestriction; }
     bool requireUserGestureForRateChange() const { return m_restrictions & RequireUserGestureForRateChangeRestriction; }
     bool requireUserGestureForFullScreen() const { return m_restrictions & RequireUserGestureForFullScreenRestriction; }
+    bool requirePageConsentToLoadMedia() const { return m_restrictions & RequirePageConsentToLoadMedia; }
 
     void setBehaviorRestrictions(BehaviorRestrictions restrictions) { m_restrictions = restrictions; }
 
@@ -335,6 +337,8 @@
 
     virtual void mediaCanStart();
 
+    void removeBehaviorRestriction(BehaviorRestrictions restriction) { m_restrictions &= ~restriction; }
+
     void setShouldDelayLoadEvent(bool);
 
     void invalidateCachedTime();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to