Title: [183751] trunk/Source/WebCore
Revision
183751
Author
[email protected]
Date
2015-05-04 11:26:00 -0700 (Mon, 04 May 2015)

Log Message

[Mac] Show wireless playback placard even when an element has custom controls
https://bugs.webkit.org/show_bug.cgi?id=144548

Reviewed by Brent Fulgham.

* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.shouldHaveAnyUI): Return true when playing to wireless target.
(Controller.prototype.reconnectControls): Add controls when playing to wireless target.
(Controller.prototype.setPlaying): Return early when there is no 'controls' attribute.
(Controller.prototype.showControls): Ditto.
(Controller.prototype.updateWirelessPlaybackStatus): Call updateBase when playing to wireless
target to ensure that controls have been set up.
(Controller.prototype.handleWirelessPlaybackChange): Call reconnectControls when playing
to wireless target when there is no 'controls' attribute.
(Controller.prototype.showInlinePlaybackPlaceholderOnly): New.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged): Call configureMediaControls.
(WebCore::HTMLMediaElement::configureMediaControls): Require controls when playing
to wireless target.
(WebCore::HTMLMediaElement::configureTextTrackDisplay): Remove some unhelpful, noisy, logging.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (183750 => 183751)


--- trunk/Source/WebCore/ChangeLog	2015-05-04 18:24:19 UTC (rev 183750)
+++ trunk/Source/WebCore/ChangeLog	2015-05-04 18:26:00 UTC (rev 183751)
@@ -1,3 +1,27 @@
+2015-05-04  Eric Carlson  <[email protected]>
+
+        [Mac] Show wireless playback placard even when an element has custom controls
+        https://bugs.webkit.org/show_bug.cgi?id=144548
+
+        Reviewed by Brent Fulgham.
+
+        * Modules/mediacontrols/mediaControlsApple.js:
+        (Controller.prototype.shouldHaveAnyUI): Return true when playing to wireless target.
+        (Controller.prototype.reconnectControls): Add controls when playing to wireless target.
+        (Controller.prototype.setPlaying): Return early when there is no 'controls' attribute.
+        (Controller.prototype.showControls): Ditto.
+        (Controller.prototype.updateWirelessPlaybackStatus): Call updateBase when playing to wireless
+        target to ensure that controls have been set up.
+        (Controller.prototype.handleWirelessPlaybackChange): Call reconnectControls when playing
+        to wireless target when there is no 'controls' attribute.
+        (Controller.prototype.showInlinePlaybackPlaceholderOnly): New.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged): Call configureMediaControls.
+        (WebCore::HTMLMediaElement::configureMediaControls): Require controls when playing
+        to wireless target.
+        (WebCore::HTMLMediaElement::configureTextTrackDisplay): Remove some unhelpful, noisy, logging.
+
 2015-05-04  Dan Bernstein  <[email protected]>
 
         Fixed the build.

Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js (183750 => 183751)


--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js	2015-05-04 18:24:19 UTC (rev 183750)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js	2015-05-04 18:26:00 UTC (rev 183751)
@@ -264,7 +264,7 @@
 
     shouldHaveAnyUI: function()
     {
-        return this.shouldHaveControls() || (this.video.textTracks && this.video.textTracks.length);
+        return this.shouldHaveControls() || (this.video.textTracks && this.video.textTracks.length) || this.currentPlaybackTargetIsWireless();
     },
 
     shouldHaveControls: function()
@@ -506,8 +506,7 @@
             this.configureInlineControls();
         else if (this.controlsType == Controller.FullScreenControls)
             this.configureFullScreenControls();
-
-        if (this.shouldHaveControls())
+        if (this.shouldHaveControls() || this.currentPlaybackTargetIsWireless())
             this.addControls();
     },
 
@@ -1302,6 +1301,9 @@
 
     setPlaying: function(isPlaying)
     {
+        if (this.showInlinePlaybackPlaceholderOnly())
+            return;
+
         if (this.isPlaying === isPlaying)
             return;
         this.isPlaying = isPlaying;
@@ -1325,22 +1327,22 @@
 
     showControls: function()
     {
+        this.updateShouldListenForPlaybackTargetAvailabilityEvent();
+        if (this.showInlinePlaybackPlaceholderOnly())
+            return;
+
         this.setNeedsTimelineMetricsUpdate();
-
         this.updateTime(true);
         this.updateProgress(true);
         this.drawVolumeBackground();
         this.drawTimelineBackground();
-
         this.controls.panel.classList.add(this.ClassNames.show);
         this.controls.panel.classList.remove(this.ClassNames.hidden);
-        
+
         if (this.controls.panelBackground) {
             this.controls.panelBackground.classList.add(this.ClassNames.show);
             this.controls.panelBackground.classList.remove(this.ClassNames.hidden);
         }
-
-        this.updateShouldListenForPlaybackTargetAvailabilityEvent();
     },
 
     hideControls: function()
@@ -1816,6 +1818,7 @@
                 this.controls.volumeBox.style.display = "none";
             else
                 this.controls.muteBox.style.display = "none";
+            this.updateBase();
             this.showControls();
         } else {
             this.controls.inlinePlaybackPlaceholder.classList.add(this.ClassNames.hidden);
@@ -1851,6 +1854,8 @@
         this.updateWirelessTargetAvailable();
         this.updateWirelessPlaybackStatus();
         this.setNeedsTimelineMetricsUpdate();
+        if (this.showInlinePlaybackPlaceholderOnly())
+            this.reconnectControls();
     },
 
     handleWirelessTargetAvailableChange: function(event) {
@@ -1876,4 +1881,10 @@
         else
             this.stopListeningFor(this.video, 'webkitplaybacktargetavailabilitychanged', this.handleWirelessTargetAvailableChange);
     },
+
+    showInlinePlaybackPlaceholderOnly: function(event)
+    {
+        return this.currentPlaybackTargetIsWireless() && !this.video.controls;
+    },
+
 };

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (183750 => 183751)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2015-05-04 18:24:19 UTC (rev 183750)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2015-05-04 18:26:00 UTC (rev 183751)
@@ -4869,8 +4869,9 @@
 void HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged(MediaPlayer*)
 {
     LOG(Media, "HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged(%p) - webkitCurrentPlaybackTargetIsWireless = %s", this, boolString(webkitCurrentPlaybackTargetIsWireless()));
+
+    configureMediaControls();
     scheduleEvent(eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent);
-
     m_mediaSession->mediaStateDidChange(*this, mediaState());
 }
 
@@ -5337,6 +5338,11 @@
     if (isFullscreen())
         requireControls = true;
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+    if (m_player && m_player->isCurrentPlaybackTargetWireless())
+        requireControls = true;
+#endif
+
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
     if (!requireControls || !inDocument() || !inActiveDocument())
         return;
@@ -5364,11 +5370,8 @@
     if (m_processingPreferenceChange)
         return;
 
-    LOG(Media, "HTMLMediaElement::configureTextTrackDisplay(%p) - checkType = %s", this, checkType == CheckTextTrackVisibility ? "check-visibility" : "assume-visibility-changed");
-
     bool haveVisibleTextTrack = false;
     for (unsigned i = 0; i < m_textTracks->length(); ++i) {
-        LOG(Media, "     track[%i]->mode = %s", i, String(m_textTracks->item(i)->mode()).utf8().data());
         if (m_textTracks->item(i)->mode() == TextTrack::showingKeyword()) {
             haveVisibleTextTrack = true;
             break;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to