Update presentation mode JS API to using 'picture-in-picture'
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Jun 2015 02:57:08 +0000 (02:57 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Jun 2015 02:57:08 +0000 (02:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145826
rdar://problem/2131153

Reviewed by Anders Carlsson.

Update presentation modes to use 'picture-in-picture' in lieu of 'optimized'.

* html/HTMLVideoElement.idl: Update to "picture-in-picture".
* html/HTMLVideoElement.cpp:
(WebCore::presentationModePictureInPicture): Rename static function returning string.
(WebCore::presentationModeOptimized): Deleted.
(WebCore::HTMLVideoElement::webkitSupportsPresentationMode): Use the new static function name.
(WebCore::HTMLVideoElement::webkitSetPresentationMode): Ditto.
(WebCore::HTMLVideoElement::webkitPresentationMode): Ditto.

* Modules/mediacontrols/mediaControlsiOS.js: Update to 'picture-in-picture'.
(ControllerIOS.prototype.configureInlineControls):
(ControllerIOS.prototype.isFullScreen):
(ControllerIOS.prototype.handleOptimizedFullscreenButtonClicked):
(ControllerIOS.prototype.handlePresentationModeChange):
(ControllerIOS.prototype.controlsAlwaysVisible):

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

Source/WebCore/ChangeLog
Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js
Source/WebCore/html/HTMLVideoElement.cpp
Source/WebCore/html/HTMLVideoElement.idl

index c05be11..4e0d2b6 100644 (file)
@@ -1,3 +1,28 @@
+2015-06-10  Jon Lee  <jonlee@apple.com>
+
+        Update presentation mode JS API to using 'picture-in-picture'
+        https://bugs.webkit.org/show_bug.cgi?id=145826
+        rdar://problem/2131153
+
+        Reviewed by Anders Carlsson.
+
+        Update presentation modes to use 'picture-in-picture' in lieu of 'optimized'.
+
+        * html/HTMLVideoElement.idl: Update to "picture-in-picture".
+        * html/HTMLVideoElement.cpp:
+        (WebCore::presentationModePictureInPicture): Rename static function returning string.
+        (WebCore::presentationModeOptimized): Deleted.
+        (WebCore::HTMLVideoElement::webkitSupportsPresentationMode): Use the new static function name.
+        (WebCore::HTMLVideoElement::webkitSetPresentationMode): Ditto.
+        (WebCore::HTMLVideoElement::webkitPresentationMode): Ditto.
+
+        * Modules/mediacontrols/mediaControlsiOS.js: Update to 'picture-in-picture'.
+        (ControllerIOS.prototype.configureInlineControls): 
+        (ControllerIOS.prototype.isFullScreen):
+        (ControllerIOS.prototype.handleOptimizedFullscreenButtonClicked):
+        (ControllerIOS.prototype.handlePresentationModeChange):
+        (ControllerIOS.prototype.controlsAlwaysVisible):
+
 2015-06-10  Boris Smus  <boris@smus.com>
 
         [Mobile Safari, WKWebView] increase DeviceOrientationEvent events emission frequency
index 09305c9..3aa1ecf 100644 (file)
@@ -179,7 +179,7 @@ ControllerIOS.prototype = {
             // Hide the scrubber on audio until the user starts playing.
             this.controls.timelineBox.classList.add(this.ClassNames.hidden);
         } else {
-            if (Controller.gSimulateOptimizedFullscreenAvailable || ('webkitSupportsPresentationMode' in this.video && this.video.webkitSupportsPresentationMode('optimized')))
+            if (Controller.gSimulateOptimizedFullscreenAvailable || ('webkitSupportsPresentationMode' in this.video && this.video.webkitSupportsPresentationMode('picture-in-picture')))
                 this.controls.panel.appendChild(this.controls.optimizedFullscreenButton);
             this.controls.panel.appendChild(this.controls.fullscreenButton);
         }
@@ -392,7 +392,7 @@ ControllerIOS.prototype = {
 
     isFullScreen: function()
     {
-        return this.video.webkitDisplayingFullscreen && this.presentationMode() != 'optimized';
+        return this.video.webkitDisplayingFullscreen && this.presentationMode() != 'picture-in-picture';
     },
 
     handleFullscreenButtonClicked: function(event) {
@@ -432,10 +432,10 @@ ControllerIOS.prototype = {
         if (!('webkitSetPresentationMode' in this.video))
             return;
 
-        if (this.presentationMode() === 'optimized')
+        if (this.presentationMode() === 'picture-in-picture')
             this.video.webkitSetPresentationMode('inline');
         else
-            this.video.webkitSetPresentationMode('optimized');
+            this.video.webkitSetPresentationMode('picture-in-picture');
     },
 
     handleOptimizedFullscreenTouchStart: function() {
@@ -570,7 +570,7 @@ ControllerIOS.prototype = {
 
                 this.controls.optimizedFullscreenButton.classList.remove(this.ClassNames.returnFromOptimized);
                 break;
-            case 'optimized':
+            case 'picture-in-picture':
                 var backgroundImage = "url('" + this.host.mediaUIImageData("optimized-fullscreen-placeholder") + "')";
                 this.controls.inlinePlaybackPlaceholder.style.backgroundImage = backgroundImage;
                 this.controls.inlinePlaybackPlaceholder.setAttribute('aria-label', "video playback placeholder");
@@ -608,7 +608,7 @@ ControllerIOS.prototype = {
 
     controlsAlwaysVisible: function()
     {
-        if (this.presentationMode() === 'optimized')
+        if (this.presentationMode() === 'picture-in-picture')
             return true;
 
         return Controller.prototype.controlsAlwaysVisible.call(this);
index 8a2fbb4..178a633 100644 (file)
@@ -351,10 +351,10 @@ static const AtomicString& presentationModeFullscreen()
     return fullscreen;
 }
 
-static const AtomicString& presentationModeOptimized()
+static const AtomicString& presentationModePictureInPicture()
 {
-    static NeverDestroyed<AtomicString> optimized("optimized", AtomicString::ConstructFromLiteral);
-    return optimized;
+    static NeverDestroyed<AtomicString> pictureInPicture("picture-in-picture", AtomicString::ConstructFromLiteral);
+    return pictureInPicture;
 }
 
 static const AtomicString& presentationModeInline()
@@ -368,7 +368,7 @@ bool HTMLVideoElement::webkitSupportsPresentationMode(const String& mode) const
     if (mode == presentationModeFullscreen())
         return mediaSession().fullscreenPermitted(*this) && supportsFullscreen();
 
-    if (mode == presentationModeOptimized())
+    if (mode == presentationModePictureInPicture())
         return wkIsOptimizedFullscreenSupported() && mediaSession().allowsAlternateFullscreen(*this) && supportsFullscreen();
 
     if (mode == presentationModeInline())
@@ -391,7 +391,7 @@ void HTMLVideoElement::webkitSetPresentationMode(const String& mode)
 
     if (mode == presentationModeFullscreen())
         enterFullscreen(VideoFullscreenModeStandard);
-    else if (mode == presentationModeOptimized())
+    else if (mode == presentationModePictureInPicture())
         enterFullscreen(VideoFullscreenModeOptimized);
 }
 
@@ -403,7 +403,7 @@ String HTMLVideoElement::webkitPresentationMode() const
         return presentationModeFullscreen();
 
     if (mode & VideoFullscreenModeOptimized)
-        return presentationModeOptimized();
+        return presentationModePictureInPicture();
 
     if (mode == VideoFullscreenModeNone)
         return presentationModeInline();
index 2c56ccc..8cd0e4b 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 // FIXME: This should be Conditional=VIDEO_PRESENTATION_MODE.
-enum VideoPresentationMode { "fullscreen", "optimized", "inline" };
+enum VideoPresentationMode { "fullscreen", "picture-in-picture", "inline" };
 
 [
     Conditional=VIDEO,