<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[181347] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/181347">181347</a></dd>
<dt>Author</dt> <dd>eric.carlson@apple.com</dd>
<dt>Date</dt> <dd>2015-03-10 14:26:36 -0700 (Tue, 10 Mar 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Mac] Refactor media controls code
https://bugs.webkit.org/show_bug.cgi?id=142455
Reviewed by Dean Jackson.
Source/WebCore:
No new tests, updated tests/media/hls/video-controls-live-stream-expected.txt.
* Modules/mediacontrols/mediaControlsApple.js:
(Controller):
(Controller.prototype.addVideoListeners):
(Controller.prototype.removeVideoListeners):
(Controller.prototype.createControls):
(Controller.prototype.setControlsType):
(Controller.prototype.configureInlineControls):
(Controller.prototype.updateStatusDisplay):
(Controller.prototype.handlePanelMouseDown):
(Controller.prototype.showControls):
(Controller.prototype.hideControls):
(Controller.prototype.handleOptimizedFullscreenButtonClicked):
(Controller.prototype.currentPlaybackTargetIsWireless):
(Controller.prototype.updateShouldListenForPlaybackTargetAvailabilityEvent):
(Controller.prototype.updateWirelessPlaybackStatus):
(Controller.prototype.updateWirelessTargetAvailable):
(Controller.prototype.handleWirelessPickerButtonClicked):
(Controller.prototype.handleWirelessPlaybackChange):
(Controller.prototype.handleWirelessTargetAvailableChange):
(Controller.prototype.setShouldListenForPlaybackTargetAvailabilityEvent):
* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS):
(ControllerIOS.prototype.addVideoListeners):
(ControllerIOS.prototype.removeVideoListeners):
(ControllerIOS.prototype.createControls):
(ControllerIOS.prototype.setControlsType):
(ControllerIOS.prototype.configureInlineControls):
(ControllerIOS.prototype.showControls):
(ControllerIOS.prototype.handleWirelessPickerButtonTouchEnd):
(ControllerIOS.prototype.updateShouldListenForPlaybackTargetAvailabilityEvent):
(ControllerIOS.prototype.updateStatusDisplay):
(ControllerIOS.prototype.setShouldListenForPlaybackTargetAvailabilityEvent):
(ControllerIOS.prototype.currentPlaybackTargetIsWireless): Deleted.
(ControllerIOS.prototype.updateWirelessPlaybackStatus): Deleted.
(ControllerIOS.prototype.updateWirelessTargetAvailable): Deleted.
(ControllerIOS.prototype.hideControls): Deleted.
(ControllerIOS.prototype.handleWirelessPlaybackChange): Deleted.
(ControllerIOS.prototype.handleWirelessTargetAvailableChange): Deleted.
LayoutTests:
* platform/mac/http/tests/media/hls/video-controls-live-stream-expected.txt:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmachttptestsmediahlsvideocontrolslivestreamexpectedtxt">trunk/LayoutTests/platform/mac/http/tests/media/hls/video-controls-live-stream-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsmediaControlsApplecss">trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsmediaControlsApplejs">trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsmediaControlsiOSjs">trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (181346 => 181347)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-03-10 21:17:39 UTC (rev 181346)
+++ trunk/LayoutTests/ChangeLog        2015-03-10 21:26:36 UTC (rev 181347)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2015-03-10 Eric Carlson <eric.carlson@apple.com>
+
+ [Mac] Refactor media controls code
+ https://bugs.webkit.org/show_bug.cgi?id=142455
+
+ Reviewed by Dean Jackson.
+
+ * platform/mac/http/tests/media/hls/video-controls-live-stream-expected.txt:
+
</ins><span class="cx"> 2015-03-10 Yusuke Suzuki <utatane.tea@gmail.com>
</span><span class="cx">
</span><span class="cx"> Upgrade Map, Set and WeakMap constructor interface
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmachttptestsmediahlsvideocontrolslivestreamexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/http/tests/media/hls/video-controls-live-stream-expected.txt (181346 => 181347)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/http/tests/media/hls/video-controls-live-stream-expected.txt        2015-03-10 21:17:39 UTC (rev 181346)
+++ trunk/LayoutTests/platform/mac/http/tests/media/hls/video-controls-live-stream-expected.txt        2015-03-10 21:26:36 UTC (rev 181347)
</span><span class="lines">@@ -2,6 +2,7 @@
</span><span class="cx"> EVENT(play)
</span><span class="cx"> EXPECTED (video.duration == 'Infinity') OK
</span><span class="cx"> -webkit-media-text-track-container: classes: [hidden]
</span><ins>+-webkit-media-controls-wireless-playback-status: classes: [hidden]
</ins><span class="cx"> -webkit-media-controls-panel: classes: [paused]
</span><span class="cx"> -webkit-media-controls-play-button: classes: [paused]
</span><span class="cx"> -webkit-media-controls-status-display: classes: []
</span><span class="lines">@@ -9,6 +10,7 @@
</span><span class="cx"> -webkit-media-controls-volume-slider-container: classes: [volume-box]
</span><span class="cx"> -webkit-media-controls-volume-slider: classes: []
</span><span class="cx"> -webkit-media-controls-mute-button: classes: []
</span><ins>+-webkit-media-controls-wireless-playback-picker-button: classes: [hidden]
</ins><span class="cx"> -webkit-media-controls-toggle-closed-captions-button: classes: [hidden]
</span><span class="cx"> -webkit-media-controls-fullscreen-button: classes: []
</span><span class="cx"> TEST(timeline == null || timeline.disabled) OK
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181346 => 181347)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-10 21:17:39 UTC (rev 181346)
+++ trunk/Source/WebCore/ChangeLog        2015-03-10 21:26:36 UTC (rev 181347)
</span><span class="lines">@@ -1,3 +1,51 @@
</span><ins>+2015-03-10 Eric Carlson <eric.carlson@apple.com>
+
+ [Mac] Refactor media controls code
+ https://bugs.webkit.org/show_bug.cgi?id=142455
+
+ Reviewed by Dean Jackson.
+
+ No new tests, updated tests/media/hls/video-controls-live-stream-expected.txt.
+
+ * Modules/mediacontrols/mediaControlsApple.js:
+ (Controller):
+ (Controller.prototype.addVideoListeners):
+ (Controller.prototype.removeVideoListeners):
+ (Controller.prototype.createControls):
+ (Controller.prototype.setControlsType):
+ (Controller.prototype.configureInlineControls):
+ (Controller.prototype.updateStatusDisplay):
+ (Controller.prototype.handlePanelMouseDown):
+ (Controller.prototype.showControls):
+ (Controller.prototype.hideControls):
+ (Controller.prototype.handleOptimizedFullscreenButtonClicked):
+ (Controller.prototype.currentPlaybackTargetIsWireless):
+ (Controller.prototype.updateShouldListenForPlaybackTargetAvailabilityEvent):
+ (Controller.prototype.updateWirelessPlaybackStatus):
+ (Controller.prototype.updateWirelessTargetAvailable):
+ (Controller.prototype.handleWirelessPickerButtonClicked):
+ (Controller.prototype.handleWirelessPlaybackChange):
+ (Controller.prototype.handleWirelessTargetAvailableChange):
+ (Controller.prototype.setShouldListenForPlaybackTargetAvailabilityEvent):
+ * Modules/mediacontrols/mediaControlsiOS.js:
+ (ControllerIOS):
+ (ControllerIOS.prototype.addVideoListeners):
+ (ControllerIOS.prototype.removeVideoListeners):
+ (ControllerIOS.prototype.createControls):
+ (ControllerIOS.prototype.setControlsType):
+ (ControllerIOS.prototype.configureInlineControls):
+ (ControllerIOS.prototype.showControls):
+ (ControllerIOS.prototype.handleWirelessPickerButtonTouchEnd):
+ (ControllerIOS.prototype.updateShouldListenForPlaybackTargetAvailabilityEvent):
+ (ControllerIOS.prototype.updateStatusDisplay):
+ (ControllerIOS.prototype.setShouldListenForPlaybackTargetAvailabilityEvent):
+ (ControllerIOS.prototype.currentPlaybackTargetIsWireless): Deleted.
+ (ControllerIOS.prototype.updateWirelessPlaybackStatus): Deleted.
+ (ControllerIOS.prototype.updateWirelessTargetAvailable): Deleted.
+ (ControllerIOS.prototype.hideControls): Deleted.
+ (ControllerIOS.prototype.handleWirelessPlaybackChange): Deleted.
+ (ControllerIOS.prototype.handleWirelessTargetAvailableChange): Deleted.
+
</ins><span class="cx"> 2015-03-10 Said Abou-Hallawa <sabouhallawa@apple.com>
</span><span class="cx">
</span><span class="cx"> Remove PassRefPtr from svg/properties classes.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsApplecss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css (181346 => 181347)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css        2015-03-10 21:17:39 UTC (rev 181346)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css        2015-03-10 21:26:36 UTC (rev 181347)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013, 2014, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -726,3 +726,21 @@
</span><span class="cx"> audio::-webkit-media-text-track-container .hidden {
</span><span class="cx"> display: none;
</span><span class="cx"> }
</span><ins>+
+/* ==================== AIRPLAY PLACARD ==================== */
+
+video::-webkit-media-controls-wireless-playback-status,
+audio::-webkit-media-controls-wireless-playback-status {
+ display: block;
+ width: 100%;
+ height: 100%;
+ background-color: black;
+ background-repeat: no-repeat;
+ background-position: 50% 50%;
+ background-size: 100% 50%;
+}
+
+video::-webkit-media-controls-wireless-playback-status.hidden,
+audio::-webkit-media-controls-wireless-playback-status.hidden {
+ display: none;
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsApplejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js (181346 => 181347)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js        2015-03-10 21:17:39 UTC (rev 181346)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js        2015-03-10 21:26:36 UTC (rev 181347)
</span><span class="lines">@@ -13,6 +13,8 @@
</span><span class="cx"> this.isLive = false;
</span><span class="cx"> this.statusHidden = true;
</span><span class="cx"> this.hasVisualMedia = false;
</span><ins>+ this.hasWirelessPlaybackTargets = false;
+ this.isListeningForPlaybackTargetAvailabilityEvent = false;
</ins><span class="cx">
</span><span class="cx"> this.addVideoListeners();
</span><span class="cx"> this.createBase();
</span><span class="lines">@@ -31,6 +33,8 @@
</span><span class="cx"> this.updateVolume();
</span><span class="cx"> this.updateHasAudio();
</span><span class="cx"> this.updateHasVideo();
</span><ins>+ this.updateWirelessTargetAvailable();
+ this.updateWirelessPlaybackStatus();
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> /* Enums */
</span><span class="lines">@@ -39,7 +43,12 @@
</span><span class="cx">
</span><span class="cx"> Controller.PlayAfterSeeking = 0;
</span><span class="cx"> Controller.PauseAfterSeeking = 1;
</span><ins>+
+/* Globals */
</ins><span class="cx"> Controller.gLastTimelineId = 0;
</span><ins>+Controller.gWirelessImage = 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 245"><g fill="#1060FE"><path d="M193.6,6.3v121.6H6.4V6.3H193.6 M199.1,0.7H0.9v132.7h198.2V0.7L199.1,0.7z"/><path d="M43.5,139.3c15.8,8,35.3,12.7,56.5,12.7s40.7-4.7,56.5-12.7H43.5z"/></g><g text-anchor="middle" font-family="Helvetica Neue"><text x="100" y="204" fill="white" font-size="24">##DEVICE_TYPE##</text><text x="100" y="234" fill="#5C5C5C" font-size="21">##DEVICE_NAME##</text></g></svg>';
+Controller.gSimulateWirelessPlaybackTarget = false; // Used for testing when there are no wireless targets.
+Controller.gSimulateOptimizedFullscreenAvailable = false; // Used for testing when optimized fullscreen is not available.
</ins><span class="cx">
</span><span class="cx"> Controller.prototype = {
</span><span class="cx">
</span><span class="lines">@@ -179,6 +188,8 @@
</span><span class="cx"> /* controls attribute */
</span><span class="cx"> this.controlsObserver = new MutationObserver(this.handleControlsChange.bind(this));
</span><span class="cx"> this.controlsObserver.observe(this.video, { attributes: true, attributeFilter: ['controls'] });
</span><ins>+
+ this.listenFor(this.video, 'webkitcurrentplaybacktargetiswirelesschanged', this.handleWirelessPlaybackChange);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> removeVideoListeners: function()
</span><span class="lines">@@ -205,6 +216,9 @@
</span><span class="cx"> /* controls attribute */
</span><span class="cx"> this.controlsObserver.disconnect();
</span><span class="cx"> delete(this.controlsObserver);
</span><ins>+
+ this.stopListeningFor(this.video, 'webkitcurrentplaybacktargetiswirelesschanged', this.handleWirelessPlaybackChange);
+ this.setShouldListenForPlaybackTargetAvailabilityEvent(false);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> handleEvent: function(event)
</span><span class="lines">@@ -415,6 +429,20 @@
</span><span class="cx"> optimizedFullscreenButton.setAttribute('pseudo', '-webkit-media-controls-optimized-fullscreen-button');
</span><span class="cx"> optimizedFullscreenButton.setAttribute('aria-label', this.UIString('Display Optimized Full Screen'));
</span><span class="cx"> this.listenFor(optimizedFullscreenButton, 'click', this.handleOptimizedFullscreenButtonClicked);
</span><ins>+
+ var inlinePlaybackPlaceholder = this.controls.inlinePlaybackPlaceholder = document.createElement('div');
+ inlinePlaybackPlaceholder.setAttribute('pseudo', '-webkit-media-controls-wireless-playback-status');
+ if (!Controller.gSimulateOptimizedFullscreenAvailable)
+ inlinePlaybackPlaceholder.classList.add(this.ClassNames.hidden);
+ inlinePlaybackPlaceholder.setAttribute('aria-label', this.UIString('Display Optimized Full Screen'));
+
+ var wirelessTargetPicker = this.controls.wirelessTargetPicker = document.createElement('button');
+ wirelessTargetPicker.setAttribute('pseudo', '-webkit-media-controls-wireless-playback-picker-button');
+ wirelessTargetPicker.setAttribute('aria-label', this.UIString('Choose Wireless Display'));
+ this.listenFor(wirelessTargetPicker, 'click', this.handleWirelessPickerButtonClicked);
+
+ if (!Controller.gSimulateWirelessPlaybackTarget)
+ wirelessTargetPicker.classList.add(this.ClassNames.hidden);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> setControlsType: function(type)
</span><span class="lines">@@ -424,6 +452,7 @@
</span><span class="cx"> this.controlsType = type;
</span><span class="cx">
</span><span class="cx"> this.reconnectControls();
</span><ins>+ this.updateShouldListenForPlaybackTargetAvailabilityEvent();
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> setIsLive: function(live)
</span><span class="lines">@@ -478,6 +507,7 @@
</span><span class="cx"> this.controls.muteBox.appendChild(this.controls.volumeBox);
</span><span class="cx"> this.controls.volumeBox.appendChild(this.controls.volume);
</span><span class="cx"> this.controls.muteBox.appendChild(this.controls.muteButton);
</span><ins>+ this.controls.panel.appendChild(this.controls.wirelessTargetPicker);
</ins><span class="cx"> this.controls.panel.appendChild(this.controls.captionButton);
</span><span class="cx"> if (!this.isAudio())
</span><span class="cx"> this.controls.panel.appendChild(this.controls.fullscreenButton);
</span><span class="lines">@@ -523,6 +553,7 @@
</span><span class="cx">
</span><span class="cx"> updateStatusDisplay: function(event)
</span><span class="cx"> {
</span><ins>+ this.updateShouldListenForPlaybackTargetAvailabilityEvent();
</ins><span class="cx"> if (this.video.error !== null)
</span><span class="cx"> this.controls.statusDisplay.innerText = this.UIString('Error');
</span><span class="cx"> else if (this.isLive && this.video.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA)
</span><span class="lines">@@ -702,7 +733,7 @@
</span><span class="cx">
</span><span class="cx"> handlePanelMouseDown: function(event)
</span><span class="cx"> {
</span><del>- if (event.target != this.controls.panel)
</del><ins>+ if (event.target != this.controls.panel && event.target != this.controls.inlinePlaybackPlaceholder)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (!this.isFullScreen())
</span><span class="lines">@@ -1220,10 +1251,13 @@
</span><span class="cx"> this.controls.panelBackground.classList.add(this.ClassNames.show);
</span><span class="cx"> this.controls.panelBackground.classList.remove(this.ClassNames.hidden);
</span><span class="cx"> }
</span><ins>+
+ this.updateShouldListenForPlaybackTargetAvailabilityEvent();
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> hideControls: function()
</span><span class="cx"> {
</span><ins>+ this.updateShouldListenForPlaybackTargetAvailabilityEvent();
</ins><span class="cx"> this.controls.panel.classList.remove(this.ClassNames.show);
</span><span class="cx"> if (this.controls.panelBackground)
</span><span class="cx"> this.controls.panelBackground.classList.remove(this.ClassNames.show);
</span><span class="lines">@@ -1243,6 +1277,7 @@
</span><span class="cx">
</span><span class="cx"> addControls: function()
</span><span class="cx"> {
</span><ins>+ this.base.appendChild(this.controls.inlinePlaybackPlaceholder);
</ins><span class="cx"> this.base.appendChild(this.controls.panel);
</span><span class="cx"> this.setNeedsTimelineMetricsUpdate();
</span><span class="cx"> },
</span><span class="lines">@@ -1625,4 +1660,94 @@
</span><span class="cx"> clearTimeout(this.hideTimer);
</span><span class="cx"> this.hideTimer = setTimeout(this.hideControls.bind(this), this.HideControlsDelay);
</span><span class="cx"> },
</span><ins>+
+ handleOptimizedFullscreenButtonClicked: function(event) {
+ },
+
+ currentPlaybackTargetIsWireless: function() {
+ return Controller.gSimulateWirelessPlaybackTarget || (('webkitCurrentPlaybackTargetIsWireless' in this.video) && this.video.webkitCurrentPlaybackTargetIsWireless);
+ },
+
+ updateShouldListenForPlaybackTargetAvailabilityEvent: function() {
+ var shouldListen = true;
+ if (this.video.error)
+ shouldListen = false;
+ if (!this.isAudio() && !this.video.paused && this.controlsAreHidden())
+ shouldListen = false;
+ if (document.hidden)
+ shouldListen = false;
+
+ this.setShouldListenForPlaybackTargetAvailabilityEvent(shouldListen);
+ },
+
+ updateWirelessPlaybackStatus: function() {
+ if (this.currentPlaybackTargetIsWireless()) {
+ var backgroundImageSVG = "url('" + Controller.gWirelessImage + "')";
+
+ var deviceName = "";
+ var deviceType = "";
+ var type = this.host.externalDeviceType;
+ if (type == "airplay") {
+ deviceType = this.UIString('##WIRELESS_PLAYBACK_DEVICE_TYPE##');
+ deviceName = this.UIString('##WIRELESS_PLAYBACK_DEVICE_NAME##', '##DEVICE_NAME##', this.host.externalDeviceDisplayName || "Apple TV");
+ } else if (type == "tvout") {
+ deviceType = this.UIString('##TVOUT_DEVICE_TYPE##');
+ deviceName = this.UIString('##TVOUT_DEVICE_NAME##');
+ }
+
+ backgroundImageSVG = backgroundImageSVG.replace('##DEVICE_TYPE##', deviceType);
+ backgroundImageSVG = backgroundImageSVG.replace('##DEVICE_NAME##', deviceName);
+
+ this.controls.inlinePlaybackPlaceholder.style.backgroundImage = backgroundImageSVG;
+ this.controls.inlinePlaybackPlaceholder.setAttribute('aria-label', deviceType + ", " + deviceName);
+
+ this.controls.inlinePlaybackPlaceholder.classList.remove(this.ClassNames.hidden);
+ this.controls.wirelessTargetPicker.classList.add(this.ClassNames.playing);
+ } else {
+ this.controls.inlinePlaybackPlaceholder.classList.add(this.ClassNames.hidden);
+ this.controls.wirelessTargetPicker.classList.remove(this.ClassNames.playing);
+ }
+ },
+
+ updateWirelessTargetAvailable: function() {
+ if (Controller.gSimulateWirelessPlaybackTarget || this.hasWirelessPlaybackTargets)
+ this.controls.wirelessTargetPicker.classList.remove(this.ClassNames.hidden);
+ else
+ this.controls.wirelessTargetPicker.classList.add(this.ClassNames.hidden);
+ },
+
+ handleWirelessPickerButtonClicked: function(event)
+ {
+ this.video.webkitShowPlaybackTargetPicker();
+ return true;
+ },
+
+ handleWirelessPlaybackChange: function(event) {
+ this.updateWirelessPlaybackStatus();
+ this.setNeedsTimelineMetricsUpdate();
+ },
+
+ handleWirelessTargetAvailableChange: function(event) {
+ var wirelessPlaybackTargetsAvailable = event.availability == "available";
+ if (this.hasWirelessPlaybackTargets === wirelessPlaybackTargetsAvailable)
+ return;
+
+ this.hasWirelessPlaybackTargets = wirelessPlaybackTargetsAvailable;
+ this.updateWirelessTargetAvailable();
+ this.setNeedsTimelineMetricsUpdate();
+ },
+
+ setShouldListenForPlaybackTargetAvailabilityEvent: function(shouldListen) {
+ if (!window.WebKitPlaybackTargetAvailabilityEvent || this.isListeningForPlaybackTargetAvailabilityEvent == shouldListen)
+ return;
+
+ if (shouldListen && this.video.error)
+ return;
+
+ this.isListeningForPlaybackTargetAvailabilityEvent = shouldListen;
+ if (shouldListen)
+ this.listenFor(this.video, 'webkitplaybacktargetavailabilitychanged', this.handleWirelessTargetAvailableChange);
+ else
+ this.stopListeningFor(this.video, 'webkitplaybacktargetavailabilitychanged', this.handleWirelessTargetAvailableChange);
+ },
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsiOSjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js (181346 => 181347)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js        2015-03-10 21:17:39 UTC (rev 181346)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js        2015-03-10 21:26:36 UTC (rev 181347)
</span><span class="lines">@@ -6,16 +6,12 @@
</span><span class="cx"> function ControllerIOS(root, video, host)
</span><span class="cx"> {
</span><span class="cx"> this.doingSetup = true;
</span><del>- this.hasWirelessPlaybackTargets = false;
</del><span class="cx"> this._pageScaleFactor = 1;
</span><del>- this.isListeningForPlaybackTargetAvailabilityEvent = false;
</del><span class="cx">
</span><span class="cx"> this.timelineContextName = "_webkit-media-controls-timeline-" + ControllerIOS.gLastTimelineId++;
</span><span class="cx">
</span><span class="cx"> Controller.call(this, root, video, host);
</span><span class="cx">
</span><del>- this.updateWirelessTargetAvailable();
- this.updateWirelessPlaybackStatus();
</del><span class="cx"> this.setNeedsTimelineMetricsUpdate();
</span><span class="cx">
</span><span class="cx"> this._timelineIsHidden = false;
</span><span class="lines">@@ -34,9 +30,6 @@
</span><span class="cx"> ControllerIOS.StartPlaybackControls = 2;
</span><span class="cx">
</span><span class="cx"> /* Globals */
</span><del>-ControllerIOS.gWirelessImage = 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 245"><g fill="#1060FE"><path d="M193.6,6.3v121.6H6.4V6.3H193.6 M199.1,0.7H0.9v132.7h198.2V0.7L199.1,0.7z"/><path d="M43.5,139.3c15.8,8,35.3,12.7,56.5,12.7s40.7-4.7,56.5-12.7H43.5z"/></g><g text-anchor="middle" font-family="Helvetica Neue"><text x="100" y="204" fill="white" font-size="24">##DEVICE_TYPE##</text><text x="100" y="234" fill="#5C5C5C" font-size="21">##DEVICE_NAME##</text></g></svg>';
-ControllerIOS.gSimulateWirelessPlaybackTarget = false; // Used for testing when there are no wireless targets.
-ControllerIOS.gSimulateOptimizedFullscreenAvailable = false; // Used for testing when optimized fullscreen is not available.
</del><span class="cx"> ControllerIOS.gLastTimelineId = 0;
</span><span class="cx">
</span><span class="cx"> ControllerIOS.prototype = {
</span><span class="lines">@@ -45,7 +38,6 @@
</span><span class="cx">
</span><span class="cx"> this.listenFor(this.video, 'webkitbeginfullscreen', this.handleFullscreenChange);
</span><span class="cx"> this.listenFor(this.video, 'webkitendfullscreen', this.handleFullscreenChange);
</span><del>- this.listenFor(this.video, 'webkitcurrentplaybacktargetiswirelesschanged', this.handleWirelessPlaybackChange);
</del><span class="cx"> this.listenFor(this.video, 'webkitpresentationmodechanged', this.handlePresentationModeChange);
</span><span class="cx"> },
</span><span class="cx">
</span><span class="lines">@@ -54,10 +46,7 @@
</span><span class="cx">
</span><span class="cx"> this.stopListeningFor(this.video, 'webkitbeginfullscreen', this.handleFullscreenChange);
</span><span class="cx"> this.stopListeningFor(this.video, 'webkitendfullscreen', this.handleFullscreenChange);
</span><del>- this.stopListeningFor(this.video, 'webkitcurrentplaybacktargetiswirelesschanged', this.handleWirelessPlaybackChange);
</del><span class="cx"> this.stopListeningFor(this.video, 'webkitpresentationmodechanged', this.handlePresentationModeChange);
</span><del>-
- this.setShouldListenForPlaybackTargetAvailabilityEvent(false);
</del><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> createBase: function() {
</span><span class="lines">@@ -115,46 +104,6 @@
</span><span class="cx"> return this.shouldHaveStartPlaybackButton() || Controller.prototype.shouldHaveAnyUI.call(this) || this.currentPlaybackTargetIsWireless();
</span><span class="cx"> },
</span><span class="cx">
</span><del>- currentPlaybackTargetIsWireless: function() {
- return ControllerIOS.gSimulateWirelessPlaybackTarget || (('webkitCurrentPlaybackTargetIsWireless' in this.video) && this.video.webkitCurrentPlaybackTargetIsWireless);
- },
-
- updateWirelessPlaybackStatus: function() {
- if (this.currentPlaybackTargetIsWireless()) {
- var backgroundImageSVG = "url('" + ControllerIOS.gWirelessImage + "')";
-
- var deviceName = "";
- var deviceType = "";
- var type = this.host.externalDeviceType;
- if (type == "airplay") {
- deviceType = this.UIString('##WIRELESS_PLAYBACK_DEVICE_TYPE##');
- deviceName = this.UIString('##WIRELESS_PLAYBACK_DEVICE_NAME##', '##DEVICE_NAME##', this.host.externalDeviceDisplayName || "Apple TV");
- } else if (type == "tvout") {
- deviceType = this.UIString('##TVOUT_DEVICE_TYPE##');
- deviceName = this.UIString('##TVOUT_DEVICE_NAME##');
- }
-
- backgroundImageSVG = backgroundImageSVG.replace('##DEVICE_TYPE##', deviceType);
- backgroundImageSVG = backgroundImageSVG.replace('##DEVICE_NAME##', deviceName);
-
- this.controls.inlinePlaybackPlaceholder.style.backgroundImage = backgroundImageSVG;
- this.controls.inlinePlaybackPlaceholder.setAttribute('aria-label', deviceType + ", " + deviceName);
-
- this.controls.inlinePlaybackPlaceholder.classList.remove(this.ClassNames.hidden);
- this.controls.wirelessTargetPicker.classList.add(this.ClassNames.playing);
- } else {
- this.controls.inlinePlaybackPlaceholder.classList.add(this.ClassNames.hidden);
- this.controls.wirelessTargetPicker.classList.remove(this.ClassNames.playing);
- }
- },
-
- updateWirelessTargetAvailable: function() {
- if (ControllerIOS.gSimulateWirelessPlaybackTarget || this.hasWirelessPlaybackTargets)
- this.controls.wirelessTargetPicker.classList.remove(this.ClassNames.hidden);
- else
- this.controls.wirelessTargetPicker.classList.add(this.ClassNames.hidden);
- },
-
</del><span class="cx"> createControls: function() {
</span><span class="cx"> Controller.prototype.createControls.call(this);
</span><span class="cx">
</span><span class="lines">@@ -168,22 +117,11 @@
</span><span class="cx"> spacer.setAttribute('pseudo', '-webkit-media-controls-spacer');
</span><span class="cx"> spacer.classList.add(this.ClassNames.hidden);
</span><span class="cx">
</span><del>- var inlinePlaybackPlaceholder = this.controls.inlinePlaybackPlaceholder = document.createElement('div');
- inlinePlaybackPlaceholder.setAttribute('pseudo', '-webkit-media-controls-inline-playback-placeholder');
- if (!ControllerIOS.gSimulateOptimizedFullscreenAvailable)
- inlinePlaybackPlaceholder.classList.add(this.ClassNames.hidden);
- inlinePlaybackPlaceholder.setAttribute('aria-label', this.UIString('Display Optimized Full Screen'));
-
- var wirelessTargetPicker = this.controls.wirelessTargetPicker = document.createElement('button');
- wirelessTargetPicker.setAttribute('pseudo', '-webkit-media-controls-wireless-playback-picker-button');
- wirelessTargetPicker.setAttribute('aria-label', this.UIString('Choose Wireless Display'));
</del><ins>+ var wirelessTargetPicker = this.controls.wirelessTargetPicker
</ins><span class="cx"> this.listenFor(wirelessTargetPicker, 'touchstart', this.handleWirelessPickerButtonTouchStart);
</span><span class="cx"> this.listenFor(wirelessTargetPicker, 'touchend', this.handleWirelessPickerButtonTouchEnd);
</span><span class="cx"> this.listenFor(wirelessTargetPicker, 'touchcancel', this.handleWirelessPickerButtonTouchCancel);
</span><span class="cx">
</span><del>- if (!ControllerIOS.gSimulateWirelessPlaybackTarget)
- wirelessTargetPicker.classList.add(this.ClassNames.hidden);
-
</del><span class="cx"> this.listenFor(this.controls.startPlaybackButton, 'touchstart', this.handleStartPlaybackButtonTouchStart);
</span><span class="cx"> this.listenFor(this.controls.startPlaybackButton, 'touchend', this.handleStartPlaybackButtonTouchEnd);
</span><span class="cx"> this.listenFor(this.controls.startPlaybackButton, 'touchcancel', this.handleStartPlaybackButtonTouchCancel);
</span><span class="lines">@@ -214,8 +152,6 @@
</span><span class="cx"> this.addStartPlaybackControls();
</span><span class="cx"> else
</span><span class="cx"> this.removeStartPlaybackControls();
</span><del>-
- this.updateShouldListenForPlaybackTargetAvailabilityEvent();
</del><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> addStartPlaybackControls: function() {
</span><span class="lines">@@ -250,7 +186,7 @@
</span><span class="cx"> // Hide the scrubber on audio until the user starts playing.
</span><span class="cx"> this.controls.timelineBox.classList.add(this.ClassNames.hidden);
</span><span class="cx"> } else {
</span><del>- if (ControllerIOS.gSimulateOptimizedFullscreenAvailable || ('webkitSupportsPresentationMode' in this.video && this.video.webkitSupportsPresentationMode('optimized')))
</del><ins>+ if (Controller.gSimulateOptimizedFullscreenAvailable || ('webkitSupportsPresentationMode' in this.video && this.video.webkitSupportsPresentationMode('optimized')))
</ins><span class="cx"> this.controls.panel.appendChild(this.controls.optimizedFullscreenButton);
</span><span class="cx"> this.controls.panel.appendChild(this.controls.fullscreenButton);
</span><span class="cx"> }
</span><span class="lines">@@ -260,17 +196,11 @@
</span><span class="cx"> // Explicitly do nothing to override base-class behavior.
</span><span class="cx"> },
</span><span class="cx">
</span><del>- hideControls: function() {
- Controller.prototype.hideControls.call(this);
- this.updateShouldListenForPlaybackTargetAvailabilityEvent();
- },
-
</del><span class="cx"> showControls: function() {
</span><span class="cx"> this.updateLayoutForDisplayedWidth();
</span><span class="cx"> this.updateTime(true);
</span><span class="cx"> this.updateProgress(true);
</span><span class="cx"> Controller.prototype.showControls.call(this);
</span><del>- this.updateShouldListenForPlaybackTargetAvailabilityEvent();
</del><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> addControls: function() {
</span><span class="lines">@@ -558,21 +488,6 @@
</span><span class="cx"> this.updateControls();
</span><span class="cx"> },
</span><span class="cx">
</span><del>- handleWirelessPlaybackChange: function(event) {
- this.updateWirelessPlaybackStatus();
- this.setNeedsTimelineMetricsUpdate();
- },
-
- handleWirelessTargetAvailableChange: function(event) {
- var wirelessPlaybackTargetsAvailable = event.availability == "available";
- if (this.hasWirelessPlaybackTargets === wirelessPlaybackTargetsAvailable)
- return;
-
- this.hasWirelessPlaybackTargets = wirelessPlaybackTargetsAvailable;
- this.updateWirelessTargetAvailable();
- this.setNeedsTimelineMetricsUpdate();
- },
-
</del><span class="cx"> handleWirelessPickerButtonTouchStart: function() {
</span><span class="cx"> if (!this.video.error)
</span><span class="cx"> this.controls.wirelessTargetPicker.classList.add('active');
</span><span class="lines">@@ -580,8 +495,7 @@
</span><span class="cx">
</span><span class="cx"> handleWirelessPickerButtonTouchEnd: function(event) {
</span><span class="cx"> this.controls.wirelessTargetPicker.classList.remove('active');
</span><del>- this.video.webkitShowPlaybackTargetPicker();
- return true;
</del><ins>+ return this.handleWirelessPickerButtonClicked();
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> handleWirelessPickerButtonTouchCancel: function(event) {
</span><span class="lines">@@ -590,22 +504,16 @@
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> updateShouldListenForPlaybackTargetAvailabilityEvent: function() {
</span><del>- var shouldListen = true;
- if (this.video.error)
- shouldListen = false;
- if (this.controlsType === ControllerIOS.StartPlaybackControls)
- shouldListen = false;
- if (!this.isAudio() && !this.video.paused && this.controlsAreHidden())
- shouldListen = false;
- if (document.hidden)
- shouldListen = false;
</del><ins>+ if (this.controlsType === ControllerIOS.StartPlaybackControls) {
+ this.setShouldListenForPlaybackTargetAvailabilityEvent(false);
+ return;
+ }
</ins><span class="cx">
</span><del>- this.setShouldListenForPlaybackTargetAvailabilityEvent(shouldListen);
</del><ins>+ Controller.prototype.updateShouldListenForPlaybackTargetAvailabilityEvent.call(this);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> updateStatusDisplay: function(event)
</span><span class="cx"> {
</span><del>- this.updateShouldListenForPlaybackTargetAvailabilityEvent();
</del><span class="cx"> this.controls.startPlaybackButton.classList.toggle(this.ClassNames.failed, this.video.error !== null);
</span><span class="cx"> Controller.prototype.updateStatusDisplay.call(this, event);
</span><span class="cx"> },
</span><span class="lines">@@ -629,17 +537,10 @@
</span><span class="cx">
</span><span class="cx"> setShouldListenForPlaybackTargetAvailabilityEvent: function(shouldListen)
</span><span class="cx"> {
</span><del>- if (!window.WebKitPlaybackTargetAvailabilityEvent || this.isListeningForPlaybackTargetAvailabilityEvent == shouldListen)
- return;
-
</del><span class="cx"> if (shouldListen && (this.shouldHaveStartPlaybackButton() || this.video.error))
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- this.isListeningForPlaybackTargetAvailabilityEvent = shouldListen;
- if (shouldListen)
- this.listenFor(this.video, 'webkitplaybacktargetavailabilitychanged', this.handleWirelessTargetAvailableChange);
- else
- this.stopListeningFor(this.video, 'webkitplaybacktargetavailabilitychanged', this.handleWirelessTargetAvailableChange);
</del><ins>+ Controller.prototype.setShouldListenForPlaybackTargetAvailabilityEvent.call(this, shouldListen);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> get pageScaleFactor()
</span></span></pre>
</div>
</div>
</body>
</html>