Title: [93878] trunk/Source/WebCore
- Revision
- 93878
- Author
- eric.carl...@apple.com
- Date
- 2011-08-26 08:14:03 -0700 (Fri, 26 Aug 2011)
Log 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.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (93877 => 93878)
--- trunk/Source/WebCore/ChangeLog 2011-08-26 15:06:42 UTC (rev 93877)
+++ trunk/Source/WebCore/ChangeLog 2011-08-26 15:14:03 UTC (rev 93878)
@@ -1,3 +1,20 @@
+2011-08-26 Eric Carlson <eric.carl...@apple.com>
+
+ <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-26 Andreas Kling <kl...@webkit.org>
[Qt] Path::boundingRect() is unnecessarily slow.
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (93877 => 93878)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2011-08-26 15:06:42 UTC (rev 93877)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2011-08-26 15:14:03 UTC (rev 93878)
@@ -150,7 +150,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)
@@ -584,13 +584,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();
#if ENABLE(VIDEO_TRACK)
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (93877 => 93878)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2011-08-26 15:06:42 UTC (rev 93877)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2011-08-26 15:14:03 UTC (rev 93878)
@@ -184,13 +184,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; }
@@ -332,6 +334,8 @@
virtual void mediaCanStart();
+ void removeBehaviorRestriction(BehaviorRestrictions restriction) { m_restrictions &= ~restriction; }
+
void setShouldDelayLoadEvent(bool);
void invalidateCachedTime();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes