<!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>[181091] 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/181091">181091</a></dd>
<dt>Author</dt> <dd>dino@apple.com</dd>
<dt>Date</dt> <dd>2015-03-05 11:52:10 -0800 (Thu, 05 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS Media] Use a blurry background for media controls
https://bugs.webkit.org/show_bug.cgi?id=142316
&lt;rdar://problem/14911098&gt;

Reviewed by Eric Carlson.

Start using the -webkit-appearance media-controls-light-bar-background
in order to get the blurry background of media controls.

* Modules/mediacontrols/mediaControlsApple.js: Keep the panel and the
panel background in sync when it comes to hiding and showing. It would
be better if this could be done on a container element in the future.
(Controller.prototype.handlePanelTransitionEnd):
(Controller.prototype.setPlaying):
(Controller.prototype.showControls):
(Controller.prototype.hideControls):

* Modules/mediacontrols/mediaControlsiOS.css: New background container
with the special appearance. I also renamed &quot;composited-parent&quot; to
&quot;container&quot;, which makes more sense.
(video::-webkit-media-controls-panel-container):
(audio::-webkit-media-controls-panel-container):
(video::-webkit-media-controls-panel-background):
(audio::-webkit-media-controls-panel-background):
(video::-webkit-media-controls-panel-background.paused):
(video::-webkit-media-controls-panel):
(audio::-webkit-media-controls-panel):
(video::-webkit-media-controls-panel.paused):
(audio::-webkit-media-controls-optimized-fullscreen-button):
(audio::-webkit-media-controls-timeline):
(audio::-webkit-media-controls-timeline::-webkit-slider-thumb):
(video::-webkit-media-controls-panel-composited-parent): Deleted.
(video::-webkit-media-controls-panel:hover): Deleted.

* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.createControls): Create the new background element.
(ControllerIOS.prototype.addControls):
(ControllerIOS.prototype.set pageScaleFactor): Temporarily disable
this because the background disappears when the zoom factor
is too high - we start tiling the background. This will be addressed
by https://bugs.webkit.org/show_bug.cgi?id=142317.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181090 => 181091)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-05 19:51:05 UTC (rev 181090)
+++ trunk/Source/WebCore/ChangeLog        2015-03-05 19:52:10 UTC (rev 181091)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2015-03-04  Dean Jackson  &lt;dino@apple.com&gt;
+
+        [iOS Media] Use a blurry background for media controls
+        https://bugs.webkit.org/show_bug.cgi?id=142316
+        &lt;rdar://problem/14911098&gt;
+
+        Reviewed by Eric Carlson.
+
+        Start using the -webkit-appearance media-controls-light-bar-background
+        in order to get the blurry background of media controls.
+
+        * Modules/mediacontrols/mediaControlsApple.js: Keep the panel and the
+        panel background in sync when it comes to hiding and showing. It would
+        be better if this could be done on a container element in the future.
+        (Controller.prototype.handlePanelTransitionEnd):
+        (Controller.prototype.setPlaying):
+        (Controller.prototype.showControls):
+        (Controller.prototype.hideControls):
+
+        * Modules/mediacontrols/mediaControlsiOS.css: New background container
+        with the special appearance. I also renamed &quot;composited-parent&quot; to
+        &quot;container&quot;, which makes more sense.
+        (video::-webkit-media-controls-panel-container):
+        (audio::-webkit-media-controls-panel-container):
+        (video::-webkit-media-controls-panel-background):
+        (audio::-webkit-media-controls-panel-background):
+        (video::-webkit-media-controls-panel-background.paused):
+        (video::-webkit-media-controls-panel):
+        (audio::-webkit-media-controls-panel):
+        (video::-webkit-media-controls-panel.paused):
+        (audio::-webkit-media-controls-optimized-fullscreen-button):
+        (audio::-webkit-media-controls-timeline):
+        (audio::-webkit-media-controls-timeline::-webkit-slider-thumb):
+        (video::-webkit-media-controls-panel-composited-parent): Deleted.
+        (video::-webkit-media-controls-panel:hover): Deleted.
+
+        * Modules/mediacontrols/mediaControlsiOS.js:
+        (ControllerIOS.prototype.createControls): Create the new background element.
+        (ControllerIOS.prototype.addControls):
+        (ControllerIOS.prototype.set pageScaleFactor): Temporarily disable
+        this because the background disappears when the zoom factor
+        is too high - we start tiling the background. This will be addressed
+        by https://bugs.webkit.org/show_bug.cgi?id=142317.
+
</ins><span class="cx"> 2015-03-05  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Mechanical text-related cleanup
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsApplejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js (181090 => 181091)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js        2015-03-05 19:51:05 UTC (rev 181090)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js        2015-03-05 19:52:10 UTC (rev 181091)
</span><span class="lines">@@ -718,10 +718,15 @@
</span><span class="cx">     handlePanelTransitionEnd: function(event)
</span><span class="cx">     {
</span><span class="cx">         var opacity = window.getComputedStyle(this.controls.panel).opacity;
</span><del>-        if (parseInt(opacity) &gt; 0)
</del><ins>+        if (parseInt(opacity) &gt; 0) {
</ins><span class="cx">             this.controls.panel.classList.remove(this.ClassNames.hidden);
</span><del>-        else
</del><ins>+            if (this.controls.panelBackground)
+                this.controls.panelBackground.classList.remove(this.ClassNames.hidden);
+        } else {
</ins><span class="cx">             this.controls.panel.classList.add(this.ClassNames.hidden);
</span><ins>+            if (this.controls.panelBackground)
+                this.controls.panelBackground.classList.add(this.ClassNames.hidden);
+        }
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     handlePanelClick: function(event)
</span><span class="lines">@@ -1183,10 +1188,14 @@
</span><span class="cx"> 
</span><span class="cx">         if (!isPlaying) {
</span><span class="cx">             this.controls.panel.classList.add(this.ClassNames.paused);
</span><ins>+            if (this.controls.panelBackground)
+                this.controls.panelBackground.classList.add(this.ClassNames.paused);
</ins><span class="cx">             this.controls.playButton.classList.add(this.ClassNames.paused);
</span><span class="cx">             this.controls.playButton.setAttribute('aria-label', this.UIString('Play'));
</span><span class="cx">         } else {
</span><span class="cx">             this.controls.panel.classList.remove(this.ClassNames.paused);
</span><ins>+            if (this.controls.panelBackground)
+                this.controls.panelBackground.classList.remove(this.ClassNames.paused);
</ins><span class="cx">             this.controls.playButton.classList.remove(this.ClassNames.paused);
</span><span class="cx">             this.controls.playButton.setAttribute('aria-label', this.UIString('Pause'));
</span><span class="cx">             this.resetHideControlsTimer();
</span><span class="lines">@@ -1203,11 +1212,18 @@
</span><span class="cx"> 
</span><span class="cx">         this.controls.panel.classList.add(this.ClassNames.show);
</span><span class="cx">         this.controls.panel.classList.remove(this.ClassNames.hidden);
</span><ins>+
+        if (this.controls.panelBackground) {
+            this.controls.panelBackground.classList.add(this.ClassNames.show);
+            this.controls.panelBackground.classList.remove(this.ClassNames.hidden);
+        }
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     hideControls: function()
</span><span class="cx">     {
</span><span class="cx">         this.controls.panel.classList.remove(this.ClassNames.show);
</span><ins>+        if (this.controls.panelBackground)
+            this.controls.panelBackground.classList.remove(this.ClassNames.show);
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     controlsAreHidden: function()
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsiOScss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css (181090 => 181091)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css        2015-03-05 19:51:05 UTC (rev 181090)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css        2015-03-05 19:52:10 UTC (rev 181091)
</span><span class="lines">@@ -93,17 +93,49 @@
</span><span class="cx">     -webkit-flex: 1 1 auto;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-video::-webkit-media-controls-panel-composited-parent {
</del><ins>+video::-webkit-media-controls-panel-container {
</ins><span class="cx">     -webkit-transform: translateZ(0);
</span><span class="cx">     width: 100%;
</span><span class="cx">     direction: ltr;
</span><ins>+    height: 50px;
+    position: absolute;
+    bottom: 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+audio::-webkit-media-controls-panel-container {
+    -webkit-transform: translateZ(0);
+    width: 100%;
+    direction: ltr;
+    height: 39px;
+    position: absolute;
+    bottom: 0;
+}
+
+video::-webkit-media-controls-panel-background {
+    -webkit-transform: translateZ(0);
+    width: 101%; /* Due to some rounding issues we make this a little bit wider than should be necessary. */
+    height: 51px; /* And taller. */
+    -webkit-appearance: media-controls-light-bar-background;
+    transition: opacity 0.25s linear;
+    opacity: 0;
+}
+
+audio::-webkit-media-controls-panel-background {
+    display: none;
+}
+
+video::-webkit-media-controls-panel-background.show,
+video::-webkit-media-controls-panel-background.paused {
+    opacity: 1;
+}
+
</ins><span class="cx"> audio::-webkit-media-controls-panel,
</span><span class="cx"> video::-webkit-media-controls-panel {
</span><span class="cx">     box-sizing: border-box;
</span><span class="cx">     position: absolute;
</span><span class="cx">     bottom: 0;
</span><ins>+    width: 100%;
+    padding: 0;
</ins><span class="cx"> 
</span><span class="cx">     -webkit-user-select: none;
</span><span class="cx"> 
</span><span class="lines">@@ -124,22 +156,17 @@
</span><span class="cx"> 
</span><span class="cx"> video::-webkit-media-controls-panel {
</span><span class="cx">     height: 50px;
</span><del>-    width: 100%;
</del><span class="cx">     opacity: 0;
</span><del>-    padding: 0;
-    background-color: rgba(255, 255, 255, 0.6);
</del><ins>+    -webkit-transform: translate3d(0, 0, 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> audio::-webkit-media-controls-panel {
</span><span class="cx">     height: 39px;
</span><del>-    width: 100%;
-    padding: 0;
</del><span class="cx">     background-color: rgba(228, 228, 228, 1);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> video::-webkit-media-controls-panel.show,
</span><del>-video::-webkit-media-controls-panel.paused,
-video::-webkit-media-controls-panel:hover {
</del><ins>+video::-webkit-media-controls-panel.paused {
</ins><span class="cx">     opacity: 1;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -203,6 +230,7 @@
</span><span class="cx">     background-position: 50% 50%;
</span><span class="cx">     mix-blend-mode: plus-darker;
</span><span class="cx">     opacity: 0.55;
</span><ins>+    -webkit-transform: translate3d(0, 0, 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> video::-webkit-media-controls-play-button:active,
</span><span class="lines">@@ -332,6 +360,7 @@
</span><span class="cx">     border: none !important;
</span><span class="cx">     border-radius: 0 !important;
</span><span class="cx">     box-sizing: content-box !important;
</span><ins>+    -webkit-transform: translate3d(0, 0, 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> audio::-webkit-media-controls-timeline::-webkit-slider-runnable-track,
</span><span class="lines">@@ -352,10 +381,6 @@
</span><span class="cx">     background-position: 0px 18px;
</span><span class="cx">     background-color: transparent !important;
</span><span class="cx">     border: none !important;
</span><del>-
-    /* rotateZ() forces the layer into compositing mode. Slider
-       thumbs are small, so forcing a compositing layer is inexpensive,
-       and it keeps the slider from having to repaint while sliding. */
</del><span class="cx">     -webkit-transform: rotateZ(0deg);
</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 (181090 => 181091)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js        2015-03-05 19:51:05 UTC (rev 181090)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js        2015-03-05 19:52:10 UTC (rev 181091)
</span><span class="lines">@@ -158,9 +158,12 @@
</span><span class="cx">     createControls: function() {
</span><span class="cx">         Controller.prototype.createControls.call(this);
</span><span class="cx"> 
</span><del>-        var panelCompositedParent = this.controls.panelCompositedParent = document.createElement('div');
-        panelCompositedParent.setAttribute('pseudo', '-webkit-media-controls-panel-composited-parent');
</del><ins>+        var panelContainer = this.controls.panelContainer = document.createElement('div');
+        panelContainer.setAttribute('pseudo', '-webkit-media-controls-panel-container');
</ins><span class="cx"> 
</span><ins>+        var panelBackground = this.controls.panelBackground = document.createElement('div');
+        panelBackground.setAttribute('pseudo', '-webkit-media-controls-panel-background');
+
</ins><span class="cx">         var spacer = this.controls.spacer = document.createElement('div');
</span><span class="cx">         spacer.setAttribute('pseudo', '-webkit-media-controls-spacer');
</span><span class="cx">         spacer.classList.add(this.ClassNames.hidden);
</span><span class="lines">@@ -272,8 +275,9 @@
</span><span class="cx"> 
</span><span class="cx">     addControls: function() {
</span><span class="cx">         this.base.appendChild(this.controls.inlinePlaybackPlaceholder);
</span><del>-        this.base.appendChild(this.controls.panelCompositedParent);
-        this.controls.panelCompositedParent.appendChild(this.controls.panel);
</del><ins>+        this.base.appendChild(this.controls.panelContainer);
+        this.controls.panelContainer.appendChild(this.controls.panelBackground);
+        this.controls.panelContainer.appendChild(this.controls.panel);
</ins><span class="cx">         this.setNeedsTimelineMetricsUpdate();
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="lines">@@ -649,22 +653,11 @@
</span><span class="cx"> 
</span><span class="cx">         this._pageScaleFactor = newScaleFactor;
</span><span class="cx"> 
</span><del>-        if (newScaleFactor) {
-            var scaleValue = 1 / newScaleFactor;
-            var scaleTransform = &quot;scale(&quot; + scaleValue + &quot;)&quot;;
-            if (this.controls.startPlaybackButton)
-                this.controls.startPlaybackButton.style.webkitTransform = scaleTransform;
-            if (this.controls.panel) {
-                var bottomAligment = -2 * scaleValue;
-                this.controls.panel.style.bottom = bottomAligment + &quot;px&quot;;
-                this.controls.panel.style.paddingBottom = -(newScaleFactor * bottomAligment) + &quot;px&quot;;
-                this.controls.panel.style.width = Math.ceil(newScaleFactor * 100) + &quot;%&quot;;
-                this.controls.panel.style.webkitTransform = scaleTransform;
-                this.setNeedsTimelineMetricsUpdate();
-                this.updateProgress();
-                this.scheduleUpdateLayoutForDisplayedWidth();
-            }
-        }
</del><ins>+        // 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">     },
</span><span class="cx"> 
</span><span class="cx">     handlePresentationModeChange: function(event)
</span></span></pre>
</div>
</div>

</body>
</html>