Title: [202918] trunk/Source/WebCore
- Revision
- 202918
- Author
- jer.no...@apple.com
- Date
- 2016-07-07 11:00:49 -0700 (Thu, 07 Jul 2016)
Log 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:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (202917 => 202918)
--- trunk/Source/WebCore/ChangeLog 2016-07-07 17:30:14 UTC (rev 202917)
+++ trunk/Source/WebCore/ChangeLog 2016-07-07 18:00:49 UTC (rev 202918)
@@ -1,3 +1,27 @@
+2016-07-05 Jer Noble <jer.no...@apple.com>
+
+ 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:
+
2016-07-07 Jer Noble <jer.no...@apple.com>
Unreviewed build fix after r202908. Fix the webPlaybackSessionInterfaceMac @property.
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (202917 => 202918)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-07-07 17:30:14 UTC (rev 202917)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-07-07 18:00:49 UTC (rev 202918)
@@ -563,6 +563,7 @@
m_seekTaskQueue.close();
m_promiseTaskQueue.close();
m_pauseAfterDetachedTaskQueue.close();
+ m_updatePlaybackControlsManagerQueue.close();
m_completelyLoaded = true;
@@ -3368,7 +3369,7 @@
#endif
}
- updatePlaybackControlsManager();
+ scheduleUpdatePlaybackControlsManager();
}
void HTMLMediaElement::togglePlayState()
@@ -4013,7 +4014,7 @@
if (!m_receivedLayoutSizeChanged) {
m_receivedLayoutSizeChanged = true;
- updatePlaybackControlsManager();
+ scheduleUpdatePlaybackControlsManager();
}
}
@@ -4861,7 +4862,7 @@
LOG(Media, "HTMLMediaElement::updatePlayState(%p) - shouldBePlaying = %s, playerPaused = %s", this, boolString(shouldBePlaying), boolString(playerPaused));
if (shouldBePlaying) {
- updatePlaybackControlsManager();
+ scheduleUpdatePlaybackControlsManager();
setDisplayMode(Video);
invalidateCachedTime();
@@ -4895,7 +4896,7 @@
startPlaybackProgressTimer();
setPlaying(true);
} else {
- updatePlaybackControlsManager();
+ scheduleUpdatePlaybackControlsManager();
if (!playerPaused)
m_player->pause();
@@ -5093,6 +5094,7 @@
m_shadowDOMTaskQueue.close();
m_promiseTaskQueue.close();
m_pauseAfterDetachedTaskQueue.close();
+ m_updatePlaybackControlsManagerQueue.close();
ActiveDOMObject::contextDestroyed();
}
@@ -5106,6 +5108,7 @@
m_asyncEventQueue.close();
m_promiseTaskQueue.close();
+ m_updatePlaybackControlsManagerQueue.close();
// Once an active DOM object has been stopped it can not be restarted, so we can deallocate
// the media player now. Note that userCancelledLoad will already called clearMediaPlayer
@@ -5956,7 +5959,7 @@
forgetResourceSpecificTracks();
#endif
m_player = std::make_unique<MediaPlayer>(static_cast<MediaPlayerClient&>(*this));
- updatePlaybackControlsManager();
+ scheduleUpdatePlaybackControlsManager();
#if ENABLE(WEB_AUDIO)
if (m_audioSourceNode) {
@@ -7120,6 +7123,12 @@
page->chrome().client().setUpPlaybackControlsManager(downcast<MediaElementSession>(session)->element());
}
+void HTMLMediaElement::scheduleUpdatePlaybackControlsManager()
+{
+ if (!m_updatePlaybackControlsManagerQueue.hasPendingTasks())
+ m_updatePlaybackControlsManagerQueue.enqueueTask(std::bind(&HTMLMediaElement::updatePlaybackControlsManager, this));
+}
+
bool HTMLMediaElement::shouldOverrideBackgroundLoadingRestriction() const
{
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (202917 => 202918)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2016-07-07 17:30:14 UTC (rev 202917)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2016-07-07 18:00:49 UTC (rev 202918)
@@ -781,6 +781,7 @@
void pauseAfterDetachedTask();
void updatePlaybackControlsManager();
+ void scheduleUpdatePlaybackControlsManager();
void updateRenderer();
@@ -797,6 +798,7 @@
GenericTaskQueue<Timer> m_shadowDOMTaskQueue;
GenericTaskQueue<Timer> m_promiseTaskQueue;
GenericTaskQueue<Timer> m_pauseAfterDetachedTaskQueue;
+ GenericTaskQueue<Timer> m_updatePlaybackControlsManagerQueue;
RefPtr<TimeRanges> m_playedTimeRanges;
GenericEventQueue m_asyncEventQueue;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes