<!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>[184366] 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/184366">184366</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-14 20:28:24 -0700 (Thu, 14 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/184359">r184359</a> and <a href="http://trac.webkit.org/projects/webkit/changeset/184362">r184362</a>.
https://bugs.webkit.org/show_bug.cgi?id=145035

Introduced a crash in six media element tests (Requested by
rniwa on #webkit).

Reverted changesets:

&quot;[MediaControls] Refactor media controls &amp; bring improvements
made to iOS controls to Mac.&quot;
https://bugs.webkit.org/show_bug.cgi?id=144973
http://trac.webkit.org/changeset/184359

&quot;Unreviewed build fix after <a href="http://trac.webkit.org/projects/webkit/changeset/184359">r184359</a>; typo.&quot;
http://trac.webkit.org/changeset/184362</pre>

<h3>Modified Paths</h3>
<ul>
<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>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementh">trunk/Source/WebCore/html/HTMLMediaElement.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderMediacpp">trunk/Source/WebCore/rendering/RenderMedia.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderMediah">trunk/Source/WebCore/rendering/RenderMedia.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (184365 => 184366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-15 02:03:23 UTC (rev 184365)
+++ trunk/Source/WebCore/ChangeLog        2015-05-15 03:28:24 UTC (rev 184366)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2015-05-14  Commit Queue  &lt;commit-queue@webkit.org&gt;
+
+        Unreviewed, rolling out r184359 and r184362.
+        https://bugs.webkit.org/show_bug.cgi?id=145035
+
+        Introduced a crash in six media element tests (Requested by
+        rniwa on #webkit).
+
+        Reverted changesets:
+
+        &quot;[MediaControls] Refactor media controls &amp; bring improvements
+        made to iOS controls to Mac.&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=144973
+        http://trac.webkit.org/changeset/184359
+
+        &quot;Unreviewed build fix after r184359; typo.&quot;
+        http://trac.webkit.org/changeset/184362
+
</ins><span class="cx"> 2015-05-14  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed build fix after r184359; typo.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsApplecss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css (184365 => 184366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css        2015-05-15 02:03:23 UTC (rev 184365)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css        2015-05-15 03:28:24 UTC (rev 184366)
</span><span class="lines">@@ -599,9 +599,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> video::-webkit-media-controls-panel .hidden,
</span><del>-audio::-webkit-media-controls-panel .hidden,
-video::-webkit-media-controls-panel .dropped,
-audio::-webkit-media-controls-panel .dropped {
</del><ins>+audio::-webkit-media-controls-panel .hidden {
</ins><span class="cx">     display: none;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsApplejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js (184365 => 184366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js        2015-05-15 02:03:23 UTC (rev 184365)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js        2015-05-15 03:28:24 UTC (rev 184366)
</span><span class="lines">@@ -17,9 +17,6 @@
</span><span class="cx">     this.currentTargetIsWireless = false;
</span><span class="cx">     this.wirelessPlaybackDisabled = false;
</span><span class="cx">     this.isVolumeSliderActive = false;
</span><del>-    this.currentDisplayWidth = 0;
-    this._scrubbing = false;
-    this._pageScaleFactor = 1;
</del><span class="cx"> 
</span><span class="cx">     this.addVideoListeners();
</span><span class="cx">     this.createBase();
</span><span class="lines">@@ -40,9 +37,6 @@
</span><span class="cx">     this.updateHasVideo();
</span><span class="cx">     this.updateWirelessTargetAvailable();
</span><span class="cx">     this.updateWirelessPlaybackStatus();
</span><del>-    this.scheduleUpdateLayoutForDisplayedWidth();
-
-    this.listenFor(this.root, 'resize', this.handleRootResize);
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> /* Enums */
</span><span class="lines">@@ -87,7 +81,6 @@
</span><span class="cx">     SeekDelay: 1500,
</span><span class="cx">     ClassNames: {
</span><span class="cx">         active: 'active',
</span><del>-        dropped: 'dropped',
</del><span class="cx">         exit: 'exit',
</span><span class="cx">         failed: 'failed',
</span><span class="cx">         hidden: 'hidden',
</span><span class="lines">@@ -125,8 +118,6 @@
</span><span class="cx">         right: 39,
</span><span class="cx">         down: 40
</span><span class="cx">     },
</span><del>-    MinimumTimelineWidth: 150,
-    ButtonWidth: 32,
</del><span class="cx"> 
</span><span class="cx">     extend: function(child)
</span><span class="cx">     {
</span><span class="lines">@@ -466,7 +457,8 @@
</span><span class="cx">         inlinePlaybackPlaceholder.setAttribute('pseudo', '-webkit-media-controls-wireless-playback-status');
</span><span class="cx">         if (!Controller.gSimulateOptimizedFullscreenAvailable)
</span><span class="cx">             inlinePlaybackPlaceholder.classList.add(this.ClassNames.hidden);
</span><del>-
</del><ins>+        inlinePlaybackPlaceholder.setAttribute('aria-label', this.UIString('Display Optimized Full Screen'));
+        
</ins><span class="cx">         var inlinePlaybackPlaceholderText = this.controls.inlinePlaybackPlaceholderText = document.createElement('div');
</span><span class="cx">         inlinePlaybackPlaceholderText.setAttribute('pseudo', '-webkit-media-controls-wireless-playback-text');
</span><span class="cx">         
</span><span class="lines">@@ -601,7 +593,6 @@
</span><span class="cx">         else
</span><span class="cx">             this.setControlsType(Controller.InlineControls);
</span><span class="cx"> 
</span><del>-        this.updateLayoutForDisplayedWidth();
</del><span class="cx">         this.setNeedsTimelineMetricsUpdate();
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="lines">@@ -666,15 +657,12 @@
</span><span class="cx">         this.updateFullscreenButtons();
</span><span class="cx">         this.updateWirelessTargetPickerButton();
</span><span class="cx">         this.updateProgress();
</span><del>-        this.updateControls();
</del><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     handleTimeUpdate: function(event)
</span><span class="cx">     {
</span><del>-        if (!this.scrubbing) {
</del><ins>+        if (!this.scrubbing)
</ins><span class="cx">             this.updateTime();
</span><del>-            this.updateProgress();
-        }
</del><span class="cx">         this.drawTimelineBackground();
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="lines">@@ -863,9 +851,6 @@
</span><span class="cx"> 
</span><span class="cx">     handleTimelineInput: function(event)
</span><span class="cx">     {
</span><del>-        if (this.scrubbing)
-            this.video.pause();
-
</del><span class="cx">         this.video.fastSeek(this.controls.timeline.value);
</span><span class="cx">         this.updateControlsWhileScrubbing();
</span><span class="cx">     },
</span><span class="lines">@@ -873,7 +858,6 @@
</span><span class="cx">     handleTimelineChange: function(event)
</span><span class="cx">     {
</span><span class="cx">         this.video.currentTime = this.controls.timeline.value;
</span><del>-        this.updateProgress();
</del><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     handleTimelineDown: function(event)
</span><span class="lines">@@ -1011,7 +995,6 @@
</span><span class="cx">         var shouldBeHidden = !this.video.webkitSupportsFullscreen || !this.hasVideo();
</span><span class="cx">         this.controls.fullscreenButton.classList.toggle(this.ClassNames.hidden, shouldBeHidden);
</span><span class="cx">         this.controls.optimizedFullscreenButton.classList.toggle(this.ClassNames.hidden, shouldBeHidden);
</span><del>-        this.updateLayoutForDisplayedWidth();
</del><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     handleFullscreenButtonClicked: function(event)
</span><span class="lines">@@ -1363,7 +1346,6 @@
</span><span class="cx">         if (this.showInlinePlaybackPlaceholderOnly())
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        this.updateLayoutForDisplayedWidth();
</del><span class="cx">         this.setNeedsTimelineMetricsUpdate();
</span><span class="cx">         this.updateTime(true);
</span><span class="cx">         this.updateProgress(true);
</span><span class="lines">@@ -1380,7 +1362,7 @@
</span><span class="cx"> 
</span><span class="cx">     hideControls: function()
</span><span class="cx">     {
</span><del>-        if (this.controlsAlwaysVisible())
</del><ins>+        if (this.controlsAlwaysVisible() || this._potentiallyScrubbing)
</ins><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         this.updateShouldListenForPlaybackTargetAvailabilityEvent();
</span><span class="lines">@@ -1389,65 +1371,9 @@
</span><span class="cx">             this.controls.panelBackground.classList.remove(this.ClassNames.show);
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    scheduleUpdateLayoutForDisplayedWidth: function()
-    {
-        setTimeout(this.updateLayoutForDisplayedWidth.bind(this), 0);
-    },
-
-    isControlVisible: function(control)
-    {
-        if (!control)
-            return false;
-        if (!this.root.contains(control))
-            return false;
-        return !control.classList.contains(this.ClassNames.hidden)
-    },
-
-    updateLayoutForDisplayedWidth: function()
-    {
-        if (!this.controls || !this.controls.panel)
-            return;
-
-        var visibleWidth = this.controls.panel.getBoundingClientRect().width * this._pageScaleFactor;
-        if (visibleWidth &lt;= 0 || visibleWidth == this.currentDisplayWidth)
-            return;
-
-        this.currentDisplayWidth = visibleWidth;
-
-        // We need to work out how many buttons are available.
-        this.updateWirelessTargetAvailable();
-        this.updateFullscreenButtons();
-
-        // Filter all the buttons which are not explicitly hidden.
-        var buttons = [this.controls.playButton, this.controls.rewindButton, this.controls.captionButton,
-                       this.controls.fullscreenButton, this.controls.optimizedFullscreenButton,
-                       this.controls.wirelessTargetPicker, this.controls.muteBox];
-        var visibleButtons = buttons.filter(this.isControlVisible, this);
-
-        // This tells us how much room we need in order to display every visible button.
-        var visibleButtonWidth = this.ButtonWidth * visibleButtons.length;
-
-        // Check if there is enough room for the scrubber.
-        var shouldDropTimeline = (visibleWidth - visibleButtonWidth) &lt; this.MinimumTimelineWidth;
-        this.controls.currentTime.classList.toggle(this.ClassNames.dropped, shouldDropTimeline);
-        this.controls.thumbnailTrack.classList.toggle(this.ClassNames.dropped, shouldDropTimeline);
-        this.controls.remainingTime.classList.toggle(this.ClassNames.dropped, shouldDropTimeline);
-
-        // Then controls in the following order:
-        var removeOrder = [this.controls.wirelessTargetPicker, this.controls.optimizedFullscreenButton,
-                           this.controls.captionButton, this.controls.muteBox, this.controls.rewindButton,
-                           this.controls.fullscreenButton];
-        removeOrder.forEach(function(control) {
-            var shouldDropControl = visibleWidth &lt; visibleButtonWidth &amp;&amp; this.isControlVisible(control);
-            control.classList.toggle(this.ClassNames.dropped, shouldDropControl);
-            if (shouldDropControl)
-                visibleButtonWidth -= this.ButtonWidth;
-        }, this);
-    },
-
</del><span class="cx">     controlsAlwaysVisible: function()
</span><span class="cx">     {
</span><del>-        return this.isAudio() || this.currentPlaybackTargetIsWireless() || this.scrubbing;
</del><ins>+        return this.isAudio() || this.currentPlaybackTargetIsWireless();
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     controlsAreHidden: function()
</span><span class="lines">@@ -1546,7 +1472,6 @@
</span><span class="cx">             this.controls.captionButton.classList.remove(this.ClassNames.hidden);
</span><span class="cx">         else
</span><span class="cx">             this.controls.captionButton.classList.add(this.ClassNames.hidden);
</span><del>-        this.updateLayoutForDisplayedWidth();
</del><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     updateCaptionContainer: function()
</span><span class="lines">@@ -1819,11 +1744,10 @@
</span><span class="cx"> 
</span><span class="cx">     updateHasAudio: function()
</span><span class="cx">     {
</span><del>-        if (this.video.audioTracks.length &amp;&amp; !this.currentPlaybackTargetIsWireless())
</del><ins>+        if (this.video.audioTracks.length)
</ins><span class="cx">             this.controls.muteBox.classList.remove(this.ClassNames.hidden);
</span><span class="cx">         else
</span><span class="cx">             this.controls.muteBox.classList.add(this.ClassNames.hidden);
</span><del>-        this.updateLayoutForDisplayedWidth();
</del><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     updateHasVideo: function()
</span><span class="lines">@@ -1920,15 +1844,19 @@
</span><span class="cx">                 this.controls.inlinePlaybackPlaceholderTextTop.classList.remove(this.ClassNames.small);
</span><span class="cx">                 this.controls.inlinePlaybackPlaceholderTextBottom.classList.remove(this.ClassNames.small);
</span><span class="cx">             }
</span><del>-            this.controls.volumeBox.classList.add(this.ClassNames.hidden);
-            this.controls.muteBox.classList.add(this.ClassNames.hidden);
</del><ins>+            if (this.isFullScreen())
+                this.controls.volumeBox.style.display = &quot;none&quot;;
+            else
+                this.controls.muteBox.style.display = &quot;none&quot;;
</ins><span class="cx">             this.updateBase();
</span><span class="cx">             this.showControls();
</span><span class="cx">         } else {
</span><span class="cx">             this.controls.inlinePlaybackPlaceholder.classList.add(this.ClassNames.hidden);
</span><span class="cx">             this.controls.wirelessTargetPicker.classList.remove(this.ClassNames.playing);
</span><del>-            this.controls.volumeBox.classList.remove(this.ClassNames.hidden);
-            this.controls.muteBox.classList.remove(this.ClassNames.hidden);
</del><ins>+            if (this.isFullScreen())
+                this.controls.volumeBox.style.display = &quot;-webkit-flex&quot;;
+            else
+                this.controls.muteBox.style.display = &quot;-webkit-flex&quot;;
</ins><span class="cx">         }
</span><span class="cx">         this.updateWirelessTargetPickerButton();
</span><span class="cx">     },
</span><span class="lines">@@ -1945,7 +1873,6 @@
</span><span class="cx">             this.controls.wirelessTargetPicker.classList.remove(this.ClassNames.hidden);
</span><span class="cx">         else
</span><span class="cx">             this.controls.wirelessTargetPicker.classList.add(this.ClassNames.hidden);
</span><del>-        this.updateLayoutForDisplayedWidth();
</del><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     handleWirelessPickerButtonClicked: function(event)
</span><span class="lines">@@ -1991,50 +1918,4 @@
</span><span class="cx">         return this.currentPlaybackTargetIsWireless() &amp;&amp; !this.video.controls;
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    get scrubbing()
-    {
-        return this._scrubbing;
-    },
-
-    set scrubbing(flag)
-    {
-        if (this._scrubbing == flag)
-            return;
-        this._scrubbing = flag;
-
-        if (this._scrubbing)
-            this.wasPlayingWhenScrubbingStarted = !this.video.paused;
-        else if (this.wasPlayingWhenScrubbingStarted &amp;&amp; this.video.paused) {
-            this.video.play();
-            this.resetHideControlsTimer();
-        }
-    },
-
-    get pageScaleFactor()
-    {
-        return this._pageScaleFactor;
-    },
-
-    set pageScaleFactor(newScaleFactor)
-    {
-        if (this._pageScaleFactor === newScaleFactor)
-            return;
-
-        this._pageScaleFactor = newScaleFactor;
-
-        // FIXME: this should react to the scale change by
-        // unscaling the controls panel. However, this
-        // hits a bug with the backdrop blur layer getting
-        // too big and moving to a tiled layer.
-        // https://bugs.webkit.org/show_bug.cgi?id=142317
-    },
-
-    handleRootResize: function(event)
-    {
-        this.updateLayoutForDisplayedWidth();
-        this.setNeedsTimelineMetricsUpdate();
-        this.updateTimelineMetricsIfNeeded();
-        this.drawTimelineBackground();
-    }
-
</del><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsiOSjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js (184365 => 184366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js        2015-05-15 02:03:23 UTC (rev 184365)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js        2015-05-15 03:28:24 UTC (rev 184366)
</span><span class="lines">@@ -16,21 +16,22 @@
</span><span class="cx"> 
</span><span class="cx">     this._timelineIsHidden = false;
</span><span class="cx">     this._currentDisplayWidth = 0;
</span><ins>+    this._potentiallyScrubbing = false;
</ins><span class="cx">     this.scheduleUpdateLayoutForDisplayedWidth();
</span><span class="cx"> 
</span><span class="cx">     host.controlsDependOnPageScaleFactor = true;
</span><span class="cx">     this.doingSetup = false;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+/* Constants */
+ControllerIOS.MinimumTimelineWidth = 200;
+ControllerIOS.ButtonWidth = 42;
+
</ins><span class="cx"> /* Enums */
</span><span class="cx"> ControllerIOS.StartPlaybackControls = 2;
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> ControllerIOS.prototype = {
</span><del>-    /* Constants */
-    MinimumTimelineWidth: 200,
-    ButtonWidth: 42,
-
</del><span class="cx">     addVideoListeners: function() {
</span><span class="cx">         Controller.prototype.addVideoListeners.call(this);
</span><span class="cx"> 
</span><span class="lines">@@ -111,6 +112,10 @@
</span><span class="cx">         var panelBackground = this.controls.panelBackground = document.createElement('div');
</span><span class="cx">         panelBackground.setAttribute('pseudo', '-webkit-media-controls-panel-background');
</span><span class="cx"> 
</span><ins>+        var spacer = this.controls.spacer = document.createElement('div');
+        spacer.setAttribute('pseudo', '-webkit-media-controls-spacer');
+        spacer.classList.add(this.ClassNames.hidden);
+
</ins><span class="cx">         var inlinePlaybackPlaceholderText = this.controls.inlinePlaybackPlaceholderText = document.createElement('div');
</span><span class="cx">         inlinePlaybackPlaceholderText.setAttribute('pseudo', '-webkit-media-controls-wireless-playback-text');
</span><span class="cx"> 
</span><span class="lines">@@ -181,6 +186,7 @@
</span><span class="cx">         this.controls.inlinePlaybackPlaceholderText.appendChild(this.controls.inlinePlaybackPlaceholderTextBottom);
</span><span class="cx">         this.controls.panel.appendChild(this.controls.playButton);
</span><span class="cx">         this.controls.panel.appendChild(this.controls.statusDisplay);
</span><ins>+        this.controls.panel.appendChild(this.controls.spacer);
</ins><span class="cx">         this.controls.panel.appendChild(this.controls.timelineBox);
</span><span class="cx">         this.controls.panel.appendChild(this.controls.wirelessTargetPicker);
</span><span class="cx">         if (!this.isLive) {
</span><span class="lines">@@ -202,6 +208,13 @@
</span><span class="cx">         // Explicitly do nothing to override base-class behavior.
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    showControls: function() {
+        this.updateLayoutForDisplayedWidth();
+        this.updateTime(true);
+        this.updateProgress(true);
+        Controller.prototype.showControls.call(this);
+    },
+
</ins><span class="cx">     addControls: function() {
</span><span class="cx">         this.base.appendChild(this.controls.inlinePlaybackPlaceholder);
</span><span class="cx">         this.base.appendChild(this.controls.panelContainer);
</span><span class="lines">@@ -222,6 +235,11 @@
</span><span class="cx">         this.setNeedsTimelineMetricsUpdate();
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    updateTime: function(forceUpdate) {
+        Controller.prototype.updateTime.call(this, forceUpdate);
+        this.updateProgress();
+    },
+
</ins><span class="cx">     drawTimelineBackground: function() {
</span><span class="cx">         var width = this.timelineWidth * window.devicePixelRatio;
</span><span class="cx">         var height = this.timelineHeight * window.devicePixelRatio;
</span><span class="lines">@@ -475,8 +493,20 @@
</span><span class="cx">         return true;
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    handleTimelineInput: function(event) {
+        if (this._potentiallyScrubbing)
+            this.video.pause();
+        Controller.prototype.handleTimelineInput.call(this, event);
+    },
+
+    handleTimelineChange: function(event) {
+        Controller.prototype.handleTimelineChange.call(this, event);
+        this.updateProgress();
+    },
+
</ins><span class="cx">     handleTimelineTouchStart: function(event) {
</span><del>-        this.scrubbing = true;
</del><ins>+        this._potentiallyScrubbing = true;
+        this.wasPlayingWhenScrubbingStarted = !this.video.paused;
</ins><span class="cx">         this.listenFor(this.controls.timeline, 'touchend', this.handleTimelineTouchEnd);
</span><span class="cx">         this.listenFor(this.controls.timeline, 'touchcancel', this.handleTimelineTouchEnd);
</span><span class="cx">     },
</span><span class="lines">@@ -484,9 +514,18 @@
</span><span class="cx">     handleTimelineTouchEnd: function(event) {
</span><span class="cx">         this.stopListeningFor(this.controls.timeline, 'touchend', this.handleTimelineTouchEnd);
</span><span class="cx">         this.stopListeningFor(this.controls.timeline, 'touchcancel', this.handleTimelineTouchEnd);
</span><del>-        this.scrubbing = false;
</del><ins>+        this._potentiallyScrubbing = false;
+        if (this.wasPlayingWhenScrubbingStarted &amp;&amp; this.video.paused) {
+            this.video.play();
+            this.resetHideControlsTimer();
+        }
</ins><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    handleReadyStateChange: function(event) {
+        Controller.prototype.handleReadyStateChange.call(this, event);
+        this.updateControls();
+    },
+
</ins><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">@@ -523,8 +562,10 @@
</span><span class="cx"> 
</span><span class="cx">         this.updateControls();
</span><span class="cx"> 
</span><del>-        if (isPlaying &amp;&amp; this.isAudio())
</del><ins>+        if (isPlaying &amp;&amp; this.isAudio() &amp;&amp; !this._timelineIsHidden) {
</ins><span class="cx">             this.controls.timelineBox.classList.remove(this.ClassNames.hidden);
</span><ins>+            this.controls.spacer.classList.add(this.ClassNames.hidden);
+        }
</ins><span class="cx"> 
</span><span class="cx">         if (isPlaying)
</span><span class="cx">             this.hasPlayed = true;
</span><span class="lines">@@ -540,6 +581,25 @@
</span><span class="cx">         Controller.prototype.setShouldListenForPlaybackTargetAvailabilityEvent.call(this, shouldListen);
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    get pageScaleFactor()
+    {
+        return this._pageScaleFactor;
+    },
+
+    set pageScaleFactor(newScaleFactor)
+    {
+        if (this._pageScaleFactor === newScaleFactor)
+            return;
+
+        this._pageScaleFactor = newScaleFactor;
+
+        // FIXME: this should react to the scale change by
+        // unscaling the controls panel. However, this
+        // hits a bug with the backdrop blur layer getting
+        // too big and moving to a tiled layer.
+        // https://bugs.webkit.org/show_bug.cgi?id=142317
+    },
+
</ins><span class="cx">     handlePresentationModeChange: function(event)
</span><span class="cx">     {
</span><span class="cx">         var presentationMode = this.presentationMode();
</span><span class="lines">@@ -568,6 +628,69 @@
</span><span class="cx">         this.handlePresentationModeChange(event);
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    scheduleUpdateLayoutForDisplayedWidth: function ()
+    {
+        setTimeout(function () {
+            this.updateLayoutForDisplayedWidth();
+        }.bind(this), 0);
+    },
+
+    updateLayoutForDisplayedWidth: function()
+    {
+        if (!this.controls || !this.controls.panel)
+            return;
+
+        var visibleWidth = this.controls.panel.getBoundingClientRect().width * this._pageScaleFactor;
+        if (visibleWidth &lt;= 0 || visibleWidth == this._currentDisplayWidth)
+            return;
+
+        this._currentDisplayWidth = visibleWidth;
+
+        // We need to work out how many right-hand side buttons are available.
+        this.updateWirelessTargetAvailable();
+        this.updateFullscreenButtons();
+
+        var visibleButtonWidth = ControllerIOS.ButtonWidth; // We always try to show the fullscreen button.
+
+        if (!this.controls.wirelessTargetPicker.classList.contains(this.ClassNames.hidden))
+            visibleButtonWidth += ControllerIOS.ButtonWidth;
+        if (!this.controls.optimizedFullscreenButton.classList.contains(this.ClassNames.hidden))
+            visibleButtonWidth += ControllerIOS.ButtonWidth;
+
+        // Check if there is enough room for the scrubber.
+        if ((visibleWidth - visibleButtonWidth) &lt; ControllerIOS.MinimumTimelineWidth) {
+            this.controls.timelineBox.classList.add(this.ClassNames.hidden);
+            this.controls.spacer.classList.remove(this.ClassNames.hidden);
+            this._timelineIsHidden = true;
+        } else {
+            if (!this.isAudio() || this.hasPlayed) {
+                this.controls.timelineBox.classList.remove(this.ClassNames.hidden);
+                this.controls.spacer.classList.add(this.ClassNames.hidden);
+                this._timelineIsHidden = false;
+            } else
+                this.controls.spacer.classList.remove(this.ClassNames.hidden);
+        }
+
+        // Drop the airplay button if there isn't enough space.
+        if (visibleWidth &lt; visibleButtonWidth) {
+            this.controls.wirelessTargetPicker.classList.add(this.ClassNames.hidden);
+            visibleButtonWidth -= ControllerIOS.ButtonWidth;
+        }
+
+        // Drop the optimized fullscreen button if there still isn't enough space.
+        if (visibleWidth &lt; visibleButtonWidth) {
+            this.controls.optimizedFullscreenButton.classList.add(this.ClassNames.hidden);
+            visibleButtonWidth -= ControllerIOS.ButtonWidth;
+        }
+
+        // And finally, drop the fullscreen button as a last resort.
+        if (visibleWidth &lt; visibleButtonWidth) {
+            this.controls.fullscreenButton.classList.add(this.ClassNames.hidden);
+            visibleButtonWidth -= ControllerIOS.ButtonWidth;
+        } else
+            this.controls.fullscreenButton.classList.remove(this.ClassNames.hidden);
+    },
+
</ins><span class="cx">     controlsAlwaysVisible: function()
</span><span class="cx">     {
</span><span class="cx">         if (this.presentationMode() === 'optimized')
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (184365 => 184366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2015-05-15 02:03:23 UTC (rev 184365)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2015-05-15 03:28:24 UTC (rev 184366)
</span><span class="lines">@@ -261,7 +261,6 @@
</span><span class="cx">     , m_playbackProgressTimer(*this, &amp;HTMLMediaElement::playbackProgressTimerFired)
</span><span class="cx">     , m_scanTimer(*this, &amp;HTMLMediaElement::scanTimerFired)
</span><span class="cx">     , m_seekTaskQueue(document)
</span><del>-    , m_resizeTaskQueue(document)
</del><span class="cx">     , m_playedTimeRanges()
</span><span class="cx">     , m_asyncEventQueue(*this)
</span><span class="cx">     , m_requestedPlaybackRate(1)
</span><span class="lines">@@ -3777,18 +3776,6 @@
</span><span class="cx">     exec-&gt;clearException();
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><del>-
-void HTMLMediaElement::layoutSizeChanged()
-{
-#if ENABLE(MEDIA_CONTROLS_SCRIPT)
-    RefPtr&lt;HTMLMediaElement&gt; strongThis = this;
-    std::function&lt;void()&gt; task = [strongThis] {
-        if (ShadowRoot* root = strongThis-&gt;userAgentShadowRoot())
-            root-&gt;dispatchEvent(Event::create(&quot;resize&quot;, false, false));
-    };
-    m_resizeTaskQueue.enqueueTask(task);
-#endif
-}
</del><span class="cx">     
</span><span class="cx"> void HTMLMediaElement::setSelectedTextTrack(TextTrack* trackToSelect)
</span><span class="cx"> {
</span><span class="lines">@@ -5720,6 +5707,7 @@
</span><span class="cx">         return String();
</span><span class="cx"> 
</span><span class="cx">     return frame-&gt;loader().userAgent(m_currentSrc);
</span><ins>+
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(AVF_CAPTIONS)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (184365 => 184366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.h        2015-05-15 02:03:23 UTC (rev 184365)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h        2015-05-15 03:28:24 UTC (rev 184366)
</span><span class="lines">@@ -459,8 +459,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual MediaProducer::MediaStateFlags mediaState() const override;
</span><span class="cx"> 
</span><del>-    void layoutSizeChanged();
-
</del><span class="cx"> protected:
</span><span class="cx">     HTMLMediaElement(const QualifiedName&amp;, Document&amp;, bool);
</span><span class="cx">     virtual ~HTMLMediaElement();
</span><span class="lines">@@ -750,7 +748,6 @@
</span><span class="cx">     Timer m_playbackProgressTimer;
</span><span class="cx">     Timer m_scanTimer;
</span><span class="cx">     GenericTaskQueue&lt;ScriptExecutionContext&gt; m_seekTaskQueue;
</span><del>-    GenericTaskQueue&lt;ScriptExecutionContext&gt; m_resizeTaskQueue;
</del><span class="cx">     RefPtr&lt;TimeRanges&gt; m_playedTimeRanges;
</span><span class="cx">     GenericEventQueue m_asyncEventQueue;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderMediacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderMedia.cpp (184365 => 184366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderMedia.cpp        2015-05-15 02:03:23 UTC (rev 184365)
+++ trunk/Source/WebCore/rendering/RenderMedia.cpp        2015-05-15 03:28:24 UTC (rev 184366)
</span><span class="lines">@@ -55,15 +55,6 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderMedia::layout()
-{
-    LayoutSize oldSize = size();
-    RenderImage::layout();
-    if (oldSize != size())
-        mediaElement().layoutSizeChanged();
-}
-
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderMediah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderMedia.h (184365 => 184366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderMedia.h        2015-05-15 02:03:23 UTC (rev 184365)
+++ trunk/Source/WebCore/rendering/RenderMedia.h        2015-05-15 03:28:24 UTC (rev 184366)
</span><span class="lines">@@ -41,9 +41,6 @@
</span><span class="cx"> 
</span><span class="cx">     HTMLMediaElement&amp; mediaElement() const { return downcast&lt;HTMLMediaElement&gt;(nodeForNonAnonymous()); }
</span><span class="cx"> 
</span><del>-protected:
-    virtual void layout() override;
-
</del><span class="cx"> private:
</span><span class="cx">     void element() const = delete;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>