MediaControls: Reenable resize of controls on pinch zoom
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Jun 2015 00:53:13 +0000 (00:53 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Jun 2015 00:53:13 +0000 (00:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145824
<rdar://problem/21212778>

Reviewed by Darin Adler.

Reinstate the code that updated the scaling of the
controls in response to changes in page scale.
This time around we have to change both the controls
panel, and its blurry background.

* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.set pageScaleFactor): Deleted a comment.
* Modules/mediacontrols/mediaControlsiOS.css:
(video::-webkit-media-controls-panel-background): Set the background to pin
to the bottom of its view.
* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.get pageScaleFactor): Basic getter, copied from mediaControlsApple.
(ControllerIOS.prototype.set pageScaleFactor): The setter that reacts to the page scale
and applies an inverse scaling on the control panel using a transform, and adjusts the
height on the background similarly.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185397 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/mediacontrols/mediaControlsApple.js
Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css
Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js

index 9c27420..4274d52 100644 (file)
@@ -1,3 +1,27 @@
+2015-06-09  Dean Jackson  <dino@apple.com>
+
+        MediaControls: Reenable resize of controls on pinch zoom
+        https://bugs.webkit.org/show_bug.cgi?id=145824
+        <rdar://problem/21212778>
+
+        Reviewed by Darin Adler.
+
+        Reinstate the code that updated the scaling of the
+        controls in response to changes in page scale.
+        This time around we have to change both the controls
+        panel, and its blurry background.
+
+        * Modules/mediacontrols/mediaControlsApple.js:
+        (Controller.prototype.set pageScaleFactor): Deleted a comment.
+        * Modules/mediacontrols/mediaControlsiOS.css:
+        (video::-webkit-media-controls-panel-background): Set the background to pin
+        to the bottom of its view.
+        * Modules/mediacontrols/mediaControlsiOS.js:
+        (ControllerIOS.prototype.get pageScaleFactor): Basic getter, copied from mediaControlsApple.
+        (ControllerIOS.prototype.set pageScaleFactor): The setter that reacts to the page scale
+        and applies an inverse scaling on the control panel using a transform, and adjusts the
+        height on the background similarly.
+
 2015-06-09  Andreas Kling  <akling@apple.com>
 
         GraphicsContext state stack wasting lots of memory when empty.
index 9806538..1447d4c 100644 (file)
@@ -2034,12 +2034,6 @@ Controller.prototype = {
             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)
index b78ed0e..60125d3 100644 (file)
@@ -120,6 +120,8 @@ video::-webkit-media-controls-panel-background {
     transition: opacity 0.25s linear;
     opacity: 0;
     pointer-events: none;
+    bottom: 0;
+    position: absolute;
 }
 
 audio::-webkit-media-controls-panel-background {
index 9d40280..edf3117 100644 (file)
@@ -25,7 +25,6 @@ function ControllerIOS(root, video, host)
 /* Enums */
 ControllerIOS.StartPlaybackControls = 2;
 
-
 ControllerIOS.prototype = {
     /* Constants */
     MinimumTimelineWidth: 200,
@@ -617,6 +616,36 @@ ControllerIOS.prototype = {
         return Controller.prototype.controlsAlwaysVisible.call(this);
     },
 
+    get pageScaleFactor()
+    {
+        return this._pageScaleFactor;
+    },
+
+    set pageScaleFactor(newScaleFactor)
+    {
+        if (!newScaleFactor || this._pageScaleFactor === newScaleFactor)
+            return;
+
+        this._pageScaleFactor = newScaleFactor;
+
+        var scaleValue = 1 / newScaleFactor;
+        var scaleTransform = "scale(" + scaleValue + ")";
+        if (this.controls.startPlaybackButton)
+            this.controls.startPlaybackButton.style.webkitTransform = scaleTransform;
+        if (this.controls.panel) {
+            var bottomAligment = -2 * scaleValue;
+            this.controls.panel.style.bottom = bottomAligment + "px";
+            this.controls.panel.style.paddingBottom = -(newScaleFactor * bottomAligment) + "px";
+            this.controls.panel.style.width = Math.round(newScaleFactor * 100) + "%";
+            this.controls.panel.style.webkitTransform = scaleTransform;
+
+            this.controls.panelBackground.style.height = (50 * scaleValue) + "px";
+
+            this.setNeedsTimelineMetricsUpdate();
+            this.updateProgress();
+            this.scheduleUpdateLayoutForDisplayedWidth();
+        }
+    },
 
 };