<!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>[163094] trunk/Source/WebCore</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/163094">163094</a></dd>
<dt>Author</dt> <dd>jer.noble@apple.com</dd>
<dt>Date</dt> <dd>2014-01-30 11:30:37 -0800 (Thu, 30 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[MediaControls][iOS] Add a &quot;start load&quot; button.
https://bugs.webkit.org/show_bug.cgi?id=127861

Reviewed by Eric Carlson.

Add a &quot;start load&quot; button which replaces the controls on platforms
where inline playback is not allowed, or when playback without a
user gesture is not allowed.

Add an accessor to MediaControlsHost to query whether inline playback is allowed.:
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::mediaPlaybackAllowsInline):
* Modules/mediacontrols/MediaControlsHost.h:
* Modules/mediacontrols/MediaControlsHost.idl:
* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::mediaSession):

Update the base controller to allow more functions to be overridden:
* Modules/mediacontrols/mediaControlsApple.js:
(Controller):
(Controller.prototype.shouldHaveAnyUI):
(Controller.prototype.updateBase):
(Controller.prototype.setControlsType):
(Controller.prototype.updateControls):
(Controller.prototype.handleFullscreenChange):

Add the new button, and allow for switching between &quot;start&quot;, &quot;inline&quot;, and &quot;fullscreen&quot; controls:
* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.addVideoListeners):
(ControllerIOS.prototype.removeVideoListeners):
(ControllerIOS.prototype.createBase):
(ControllerIOS.prototype.shouldHaveStartPlaybackButton):
(ControllerIOS.prototype.shouldHaveControls):
(ControllerIOS.prototype.shouldHaveAnyUI):
(ControllerIOS.prototype.createControls):
(ControllerIOS.prototype.setControlsType):
(ControllerIOS.prototype.addStartPlaybackControls):
(ControllerIOS.prototype.removeStartPlaybackControls):
(ControllerIOS.prototype.updateControls):
(ControllerIOS.prototype.handleStartPlaybackButtonTouchStart):
(ControllerIOS.prototype.handleStartPlaybackButtonTouchEnd):
(ControllerIOS.prototype.handleStartPlaybackButtonTouchCancel):
(ControllerIOS.prototype.handleReadyStateChange):

Add the new art:
* Modules/mediacontrols/mediaControlsiOS.css:
(audio::-webkit-media-controls-start-playback-button):
(audio::-webkit-media-controls-start-playback-button.failed):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsMediaControlsHostcpp">trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsMediaControlsHosth">trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsMediaControlsHostidl">trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsmediaControlsApplejs">trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsmediaControlsiOScss">trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsmediaControlsiOSjs">trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementh">trunk/Source/WebCore/html/HTMLMediaElement.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163093 => 163094)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-30 19:29:48 UTC (rev 163093)
+++ trunk/Source/WebCore/ChangeLog        2014-01-30 19:30:37 UTC (rev 163094)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2014-01-30  Jer Noble  &lt;jer.noble@apple.com&gt;
+
+        [MediaControls][iOS] Add a &quot;start load&quot; button.
+        https://bugs.webkit.org/show_bug.cgi?id=127861
+
+        Reviewed by Eric Carlson.
+
+        Add a &quot;start load&quot; button which replaces the controls on platforms
+        where inline playback is not allowed, or when playback without a
+        user gesture is not allowed.
+
+        Add an accessor to MediaControlsHost to query whether inline playback is allowed.:
+        * Modules/mediacontrols/MediaControlsHost.cpp:
+        (WebCore::MediaControlsHost::mediaPlaybackAllowsInline):
+        * Modules/mediacontrols/MediaControlsHost.h:
+        * Modules/mediacontrols/MediaControlsHost.idl:
+        * html/HTMLMediaElement.h:
+        (WebCore::HTMLMediaElement::mediaSession):
+
+        Update the base controller to allow more functions to be overridden:
+        * Modules/mediacontrols/mediaControlsApple.js:
+        (Controller):
+        (Controller.prototype.shouldHaveAnyUI):
+        (Controller.prototype.updateBase):
+        (Controller.prototype.setControlsType):
+        (Controller.prototype.updateControls):
+        (Controller.prototype.handleFullscreenChange):
+
+        Add the new button, and allow for switching between &quot;start&quot;, &quot;inline&quot;, and &quot;fullscreen&quot; controls:
+        * Modules/mediacontrols/mediaControlsiOS.js:
+        (ControllerIOS.prototype.addVideoListeners):
+        (ControllerIOS.prototype.removeVideoListeners):
+        (ControllerIOS.prototype.createBase):
+        (ControllerIOS.prototype.shouldHaveStartPlaybackButton):
+        (ControllerIOS.prototype.shouldHaveControls):
+        (ControllerIOS.prototype.shouldHaveAnyUI):
+        (ControllerIOS.prototype.createControls):
+        (ControllerIOS.prototype.setControlsType):
+        (ControllerIOS.prototype.addStartPlaybackControls):
+        (ControllerIOS.prototype.removeStartPlaybackControls):
+        (ControllerIOS.prototype.updateControls):
+        (ControllerIOS.prototype.handleStartPlaybackButtonTouchStart):
+        (ControllerIOS.prototype.handleStartPlaybackButtonTouchEnd):
+        (ControllerIOS.prototype.handleStartPlaybackButtonTouchCancel):
+        (ControllerIOS.prototype.handleReadyStateChange):
+
+        Add the new art:
+        * Modules/mediacontrols/mediaControlsiOS.css:
+        (audio::-webkit-media-controls-start-playback-button):
+        (audio::-webkit-media-controls-start-playback-button.failed):
+
</ins><span class="cx"> 2014-01-30  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WebKit2 View Gestures (Swipe): Provide a way for clients to provide views to swipe
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsMediaControlsHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp (163093 => 163094)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp        2014-01-30 19:29:48 UTC (rev 163093)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp        2014-01-30 19:30:37 UTC (rev 163094)
</span><span class="lines">@@ -148,6 +148,11 @@
</span><span class="cx">         m_textTrackContainer-&gt;updateDisplay();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool MediaControlsHost::mediaPlaybackAllowsInline() const
+{
+    return !m_mediaElement-&gt;mediaSession().requiresFullscreenForVideoPlayback(*m_mediaElement);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsMediaControlsHosth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h (163093 => 163094)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h        2014-01-30 19:29:48 UTC (rev 163093)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h        2014-01-30 19:30:37 UTC (rev 163094)
</span><span class="lines">@@ -58,6 +58,7 @@
</span><span class="cx">     void setSelectedTextTrack(TextTrack*);
</span><span class="cx">     Element* textTrackContainer();
</span><span class="cx">     void updateTextTrackContainer();
</span><ins>+    bool mediaPlaybackAllowsInline() const;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     MediaControlsHost(HTMLMediaElement*);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsMediaControlsHostidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl (163093 => 163094)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl        2014-01-30 19:29:48 UTC (rev 163093)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl        2014-01-30 19:30:37 UTC (rev 163094)
</span><span class="lines">@@ -36,4 +36,5 @@
</span><span class="cx">     void setSelectedTextTrack(TextTrack track);
</span><span class="cx">     readonly attribute HTMLElement textTrackContainer;
</span><span class="cx">     void updateTextTrackContainer();
</span><ins>+    readonly attribute boolean mediaPlaybackAllowsInline;
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsApplejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js (163093 => 163094)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js        2014-01-30 19:29:48 UTC (rev 163093)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js        2014-01-30 19:30:37 UTC (rev 163094)
</span><span class="lines">@@ -14,9 +14,8 @@
</span><span class="cx">     this.addVideoListeners();
</span><span class="cx">     this.createBase();
</span><span class="cx">     this.createControls();
</span><del>-    this.setControlsType(this.isFullScreen() ? Controller.FullScreenControls : Controller.InlineControls);
-
</del><span class="cx">     this.updateBase();
</span><ins>+    this.updateControls();
</ins><span class="cx">     this.updateDuration();
</span><span class="cx">     this.updateTime();
</span><span class="cx">     this.updateReadyState();
</span><span class="lines">@@ -238,6 +237,11 @@
</span><span class="cx">             base.appendChild(this.host.textTrackContainer);
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    shouldHaveAnyUI: function()
+    {
+        return this.shouldHaveControls() || (this.video.textTracks &amp;&amp; this.video.textTracks.length);
+    },
+
</ins><span class="cx">     shouldHaveControls: function()
</span><span class="cx">     {
</span><span class="cx">         return this.video.controls || this.isFullScreen();
</span><span class="lines">@@ -245,12 +249,14 @@
</span><span class="cx"> 
</span><span class="cx">     updateBase: function()
</span><span class="cx">     {
</span><del>-        if (this.shouldHaveControls() || (this.video.textTracks &amp;&amp; this.video.textTracks.length)) {
-            if (!this.base.parentNode)
</del><ins>+        if (this.shouldHaveAnyUI()) {
+            if (!this.base.parentNode) {
</ins><span class="cx">                 this.root.appendChild(this.base);
</span><ins>+            }
</ins><span class="cx">         } else {
</span><del>-            if (this.base.parentNode)
</del><ins>+            if (this.base.parentNode) {
</ins><span class="cx">                 this.base.parentNode.removeChild(this.base);
</span><ins>+            }
</ins><span class="cx">         }
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="lines">@@ -371,12 +377,13 @@
</span><span class="cx">     {
</span><span class="cx">         if (type === this.controlsType)
</span><span class="cx">             return;
</span><ins>+        this.controlsType = type;
</ins><span class="cx"> 
</span><span class="cx">         this.disconnectControls();
</span><span class="cx"> 
</span><span class="cx">         if (type === Controller.InlineControls)
</span><span class="cx">             this.configureInlineControls();
</span><del>-        else
</del><ins>+        else if (type == Controller.FullScreenControls)
</ins><span class="cx">             this.configureFullScreenControls();
</span><span class="cx"> 
</span><span class="cx">         if (this.shouldHaveControls())
</span><span class="lines">@@ -438,6 +445,15 @@
</span><span class="cx">         this.controls.timelineBox.appendChild(this.controls.remainingTime);
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    updateControls: function()
+    {
+        if (this.isFullScreen())
+            this.setControlsType(Controller.FullScreenControls);
+        else
+            this.setControlsType(Controller.InlineControls);
+
+    },
+
</ins><span class="cx">     handleLoadStart: function(event)
</span><span class="cx">     {
</span><span class="cx">         this.controls.statusDisplay.innerText = this.UIString('Loading');
</span><span class="lines">@@ -542,15 +558,14 @@
</span><span class="cx">     handleFullscreenChange: function(event)
</span><span class="cx">     {
</span><span class="cx">         this.updateBase();
</span><ins>+        this.updateControls();
</ins><span class="cx"> 
</span><span class="cx">         if (this.isFullScreen()) {
</span><span class="cx">             this.controls.fullscreenButton.classList.add(this.ClassNames.exit);
</span><span class="cx">             this.controls.fullscreenButton.setAttribute('aria-label', this.UIString('Exit Full Screen'));
</span><del>-            this.setControlsType(Controller.FullScreenControls);
</del><span class="cx">         } else {
</span><span class="cx">             this.controls.fullscreenButton.classList.remove(this.ClassNames.exit);
</span><span class="cx">             this.controls.fullscreenButton.setAttribute('aria-label', this.UIString('Display Full Screen'));
</span><del>-            this.setControlsType(Controller.InlineControls);
</del><span class="cx">         }
</span><span class="cx">     },
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsiOScss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css (163093 => 163094)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css        2014-01-30 19:29:48 UTC (rev 163093)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css        2014-01-30 19:30:37 UTC (rev 163094)
</span><span class="lines">@@ -105,6 +105,28 @@
</span><span class="cx">     display: none !important;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+video::-webkit-media-controls-start-playback-button,
+audio::-webkit-media-controls-start-playback-button {
+    -webkit-appearance: none;
+    display: block;
+    padding: 0;
+    border: 0;
+    position: absolute;
+    width: 150px;
+    height: 150px;
+    left: calc(50% - 75px);
+    top: calc(50% - 75px);
+    background-origin: content-box;
+    background-repeat: no-repeat;
+    background-position: center;
+    background-image: url('data:image/svg+xml,&lt;svg width=&quot;140&quot; height=&quot;140&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;circle r=&quot;70&quot; cy=&quot;70&quot; cx=&quot;70&quot; fill=&quot;rgba(247, 247, 247, .82)&quot;/&gt;&lt;path d=&quot;M 48,34 v 72 l 62,-35.5 z&quot; fill=&quot;rgba(129, 129, 129, .9)&quot;/&gt;&lt;/svg&gt;');
+}
+
+video::-webkit-media-controls-start-playback-button.failed,
+audio::-webkit-media-controls-start-playback-button.failed {
+    background-image: url('data:image/svg+xml,&lt;svg width=&quot;140&quot; height=&quot;140&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;circle r=&quot;70&quot; cy=&quot;70&quot; cx=&quot;70&quot; fill=&quot;rgba(247, 247, 247, .82)&quot;/&gt;&lt;g fill=&quot;rgba(129, 129, 129, .9)&quot;&gt;&lt;path d=&quot;M 48,34 v 17 l 47,28 l 15,-8.5 z&quot;/&gt;&lt;path d=&quot;M 16,36 l 110,64 l -2,4 l -110,-64 z&quot;/&gt;&lt;path d=&quot;M 48,63 v 43 l 37,-21.5 z&quot;/&gt;&lt;/g&gt;&lt;/svg&gt;');
+}
+
</ins><span class="cx"> video::-webkit-media-controls-play-button,
</span><span class="cx"> audio::-webkit-media-controls-play-button,
</span><span class="cx"> video::-webkit-media-controls-fullscreen-button,
</span><span class="lines">@@ -123,7 +145,7 @@
</span><span class="cx"> video::-webkit-media-controls-play-button:active,
</span><span class="cx"> audio::-webkit-media-controls-play-button:active,
</span><span class="cx"> video::-webkit-media-controls-fullscreen-button:active,
</span><del>-audio::-webkit-media-controls-fullscreen-button:active, {
</del><ins>+audio::-webkit-media-controls-fullscreen-button:active {
</ins><span class="cx">     background-color: white;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsiOSjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js (163093 => 163094)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js        2014-01-30 19:29:48 UTC (rev 163093)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js        2014-01-30 19:30:37 UTC (rev 163094)
</span><span class="lines">@@ -8,6 +8,9 @@
</span><span class="cx">     Controller.call(this, root, video, host);
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+/* Enums */
+ControllerIOS.StartPlaybackControls = 2;
+
</ins><span class="cx"> ControllerIOS.prototype = {
</span><span class="cx">     inheritFrom: function(parent) {
</span><span class="cx">         for (var property in parent) {
</span><span class="lines">@@ -16,18 +19,67 @@
</span><span class="cx">         }
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    addVideoListeners: function() {
+        Controller.prototype.addVideoListeners.call(this);
+
+        this.listenFor(this.video, 'webkitbeginfullscreen', this.handleFullscreenChange);
+        this.listenFor(this.video, 'webkitendfullscreen', this.handleFullscreenChange);
+    },
+
+    removeVideoListeners: function() {
+        Controller.prototype.removeVideoListeners.call(this);
+
+        this.stopListeningFor(this.video, 'webkitbeginfullscreen', this.handleFullscreenChange);
+        this.stopListeningFor(this.video, 'webkitendfullscreen', this.handleFullscreenChange);
+    },
+
+
</ins><span class="cx">     createBase: function() {
</span><span class="cx">         Controller.prototype.createBase.call(this);
</span><span class="cx"> 
</span><ins>+        var startPlaybackButton = this.controls.startPlaybackButton = document.createElement('button');
+        startPlaybackButton.setAttribute('pseudo', '-webkit-media-controls-start-playback-button');
+        startPlaybackButton.setAttribute('aria-label', this.UIString('Start Playback'));
+
</ins><span class="cx">         this.listenFor(this.base, 'touchstart', this.handleWrapperTouchStart);
</span><span class="cx">         this.stopListeningFor(this.base, 'mousemove', this.handleWrapperMouseMove);
</span><span class="cx">         this.stopListeningFor(this.base, 'mouseout', this.handleWrapperMouseOut);
</span><ins>+    },
</ins><span class="cx"> 
</span><ins>+    shouldHaveStartPlaybackButton: function() {
+        if (this.video.error)
+            return true;
+
+        if (this.isFullScreen())
+            return false;
+
+        if (!this.host.mediaPlaybackAllowsInline)
+            return true;
+
+        if (this.video.readyState &lt;= HTMLMediaElement.HAVE_METADATA)
+            return true;
+
+        return false;
</ins><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    shouldHaveControls: function() {
+        if (this.shouldHaveStartPlaybackButton())
+            return false;
+
+        return Controller.prototype.shouldHaveControls.call(this);
+    },
+
+    shouldHaveAnyUI: function() {
+        return this.shouldHaveStartPlaybackButton() || Controller.prototype.shouldHaveAnyUI.call(this);
+    },
+
</ins><span class="cx">     createControls: function() {
</span><span class="cx">         Controller.prototype.createControls.call(this);
</span><span class="cx"> 
</span><ins>+        this.listenFor(this.controls.startPlaybackButton, 'touchstart', this.handleStartPlaybackButtonTouchStart);
+        this.listenFor(this.controls.startPlaybackButton, 'touchend', this.handleStartPlaybackButtonTouchEnd);
+        this.listenFor(this.controls.startPlaybackButton, 'touchcancel', this.handleStartPlaybackButtonTouchCancel);
+
</ins><span class="cx">         this.listenFor(this.controls.panel, 'touchstart', this.handlePanelTouchStart);
</span><span class="cx">         this.listenFor(this.controls.panel, 'touchend', this.handlePanelTouchEnd);
</span><span class="cx">         this.listenFor(this.controls.panel, 'touchcancel', this.handlePanelTouchCancel);
</span><span class="lines">@@ -40,6 +92,26 @@
</span><span class="cx">         this.stopListeningFor(this.controls.playButton, 'click', this.handlePlayButtonClicked);
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    setControlsType: function(type) {
+        if (type === this.controlsType)
+            return;
+        Controller.prototype.setControlsType.call(this, type);
+
+        if (type === ControllerIOS.StartPlaybackControls)
+            this.addStartPlaybackControls();
+        else
+            this.removeStartPlaybackControls();
+    },
+
+    addStartPlaybackControls: function() {
+        this.base.appendChild(this.controls.startPlaybackButton);
+    },
+
+    removeStartPlaybackControls: function() {
+        if (this.controls.startPlaybackButton.parentNode)
+            this.controls.startPlaybackButton.parentNode.removeChild(this.controls.startPlaybackButton);
+    },
+
</ins><span class="cx">     configureInlineControls: function() {
</span><span class="cx">         this.controls.panel.appendChild(this.controls.playButton);
</span><span class="cx">         this.controls.panel.appendChild(this.controls.statusDisplay);
</span><span class="lines">@@ -55,6 +127,16 @@
</span><span class="cx">         // Do nothing
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    updateControls: function() {
+        if (this.shouldHaveStartPlaybackButton())
+            this.setControlsType(ControllerIOS.StartPlaybackControls);
+        else if (this.isFullScreen())
+            this.setControlsType(Controller.FullScreenControls);
+        else
+            this.setControlsType(Controller.InlineControls);
+
+    },
+
</ins><span class="cx">     handlePlayButtonTouchStart: function() {
</span><span class="cx">         this.controls.playButton.classList.add('active');
</span><span class="cx">     },
</span><span class="lines">@@ -131,6 +213,29 @@
</span><span class="cx">         event.stopPropagation();
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    handleStartPlaybackButtonTouchStart: function(event) {
+        this.controls.fullscreenButton.classList.add('active');
+    },
+
+    handleStartPlaybackButtonTouchEnd: function(event) {
+        this.controls.fullscreenButton.classList.remove('active');
+        if (this.video.error)
+            return;
+
+        this.video.play();
+        event.stopPropagation();
+    },
+
+    handleStartPlaybackButtonTouchCancel: function(event) {
+        this.controls.fullscreenButton.classList.remove('active');
+        event.stopPropagation();
+    },
+
+    handleReadyStateChange: function(event) {
+        Controller.prototype.handleReadyStateChange.call(this, event);
+        this.updateControls();
+    },
+
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> ControllerIOS.prototype.inheritFrom(Object.create(Controller.prototype));
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (163093 => 163094)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.h        2014-01-30 19:29:48 UTC (rev 163093)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h        2014-01-30 19:30:37 UTC (rev 163094)
</span><span class="lines">@@ -427,6 +427,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     MediaPlayer::Preload preloadValue() const { return m_preload; }
</span><ins>+    HTMLMediaSession&amp; mediaSession() const { return *m_mediaSession; }
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     HTMLMediaElement(const QualifiedName&amp;, Document&amp;, bool);
</span><span class="lines">@@ -454,8 +455,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual RenderPtr&lt;RenderElement&gt; createElementRenderer(PassRef&lt;RenderStyle&gt;) override;
</span><span class="cx"> 
</span><del>-    HTMLMediaSession&amp; mediaSession() const { return *m_mediaSession; }
-
</del><span class="cx"> private:
</span><span class="cx">     void createMediaPlayer();
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>