Title: [175279] trunk/Source
Revision
175279
Author
[email protected]
Date
2014-10-28 16:14:42 -0700 (Tue, 28 Oct 2014)

Log Message

Add optimized fullscreen mode.
https://bugs.webkit.org/show_bug.cgi?id=138044

Patch by Jeremy Jones <[email protected]> on 2014-10-28
Source/WebCore:

Reviewed by Jer Noble.

Enable different types of fullscreen video behavior.
Add an enum parameter to enterVideoFullscreenForVideoElement for alternate types of fullscreen.
Add gesture for alternate fullscreen.

* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::enterFullscreenOptimized): added
* Modules/mediacontrols/MediaControlsHost.h: added enterFullscreenOptimized
* Modules/mediacontrols/MediaControlsHost.idl: added enterFullscreenOptimized
* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.handleBaseGestureChange): recognize alternate gesture
* WebCore.exp.in: added parameter to setupFullscreen
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::removedFrom) : replace m_isInVideoFullscreen with m_videoFullscreenType
(WebCore::HTMLMediaElement::stop) : ditto
(WebCore::HTMLMediaElement::isFullscreen) : ditto
(WebCore::HTMLMediaElement::enterFullscreen): add parameter to enterVideoFullscreenForVideoElement
(WebCore::HTMLMediaElement::exitFullscreen): replace m_isInVideoFullscreen with m_videoFullscreenType
(WebCore::HTMLMediaElement::enterFullscreenOptimized): added
* html/HTMLMediaElement.h: added enterFullscreenOptimized
* page/ChromeClient.h:
(WebCore::ChromeClient::enterVideoFullscreenForVideoElement): added parameter
* platform/ios/WebVideoFullscreenControllerAVKit.h: add parameter
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(-[WebVideoFullscreenController enterFullscreen:type:]): add parameter
(-[WebVideoFullscreenController enterFullscreen:]): Deleted.
* platform/ios/WebVideoFullscreenInterfaceAVKit.h: reorder protected to after public
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(-[WebAVPlayerController player]): this stub is now required
(-[WebAVPlayerController layoutSublayersOfLayer:]): this is a better way to update video frames
(WebVideoFullscreenInterfaceAVKit::setupFullscreen): implement optimized fullscreen interface
(WebVideoFullscreenInterfaceAVKit::enterFullscreen): ditto
(WebVideoFullscreenInterfaceAVKit::exitFullscreen): ditto
(WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen): ditto

Source/WebKit/mac:

Reviewed by Jer Noble.

Enable different types of fullscreen video behavior.
Add an enum parameter to enterVideoFullscreenForVideoElement for alternate types of fullscreen.

* WebCoreSupport/WebChromeClient.h: Add fullscreenType parameter
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::enterVideoFullscreenForVideoElement): ditto
* WebView/WebView.mm:
(-[WebView _enterVideoFullscreenForVideoElement:type:]): ditto
(-[WebView _enterVideoFullscreenForVideoElement:]): Deleted.
* WebView/WebViewInternal.h: ditto

Source/WebKit2:

Reviewed by Anders Carlsson.

Enable different types of fullscreen video behavior.
Add an enum parameter to enterVideoFullscreenForVideoElement for alternate types of fullscreen.

* UIProcess/ios/WebVideoFullscreenManagerProxy.h: Add fullscreenType parameter
* UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in: ditto
* UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
(WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID): ditto
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::enterVideoFullscreenForVideoElement): ditto
* WebProcess/WebCoreSupport/WebChromeClient.h: ditto
* WebProcess/ios/WebVideoFullscreenManager.h: ditto
* WebProcess/ios/WebVideoFullscreenManager.mm:
(WebKit::WebVideoFullscreenManager::enterVideoFullscreenForVideoElement): ditto
(WebKit::WebVideoFullscreenManager::didCleanupFullscreen): ditto

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (175278 => 175279)


--- trunk/Source/WebCore/ChangeLog	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebCore/ChangeLog	2014-10-28 23:14:42 UTC (rev 175279)
@@ -1,3 +1,44 @@
+2014-10-28  Jeremy Jones  <[email protected]>
+
+        Add optimized fullscreen mode.
+        https://bugs.webkit.org/show_bug.cgi?id=138044
+
+        Reviewed by Jer Noble.
+
+        Enable different types of fullscreen video behavior.
+        Add an enum parameter to enterVideoFullscreenForVideoElement for alternate types of fullscreen.
+        Add gesture for alternate fullscreen.
+
+        * Modules/mediacontrols/MediaControlsHost.cpp:
+        (WebCore::MediaControlsHost::enterFullscreenOptimized): added
+        * Modules/mediacontrols/MediaControlsHost.h: added enterFullscreenOptimized
+        * Modules/mediacontrols/MediaControlsHost.idl: added enterFullscreenOptimized
+        * Modules/mediacontrols/mediaControlsiOS.js:
+        (ControllerIOS.prototype.handleBaseGestureChange): recognize alternate gesture
+        * WebCore.exp.in: added parameter to setupFullscreen
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::removedFrom) : replace m_isInVideoFullscreen with m_videoFullscreenType
+        (WebCore::HTMLMediaElement::stop) : ditto
+        (WebCore::HTMLMediaElement::isFullscreen) : ditto
+        (WebCore::HTMLMediaElement::enterFullscreen): add parameter to enterVideoFullscreenForVideoElement
+        (WebCore::HTMLMediaElement::exitFullscreen): replace m_isInVideoFullscreen with m_videoFullscreenType
+        (WebCore::HTMLMediaElement::enterFullscreenOptimized): added
+        * html/HTMLMediaElement.h: added enterFullscreenOptimized
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::enterVideoFullscreenForVideoElement): added parameter
+        * platform/ios/WebVideoFullscreenControllerAVKit.h: add parameter
+        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+        (-[WebVideoFullscreenController enterFullscreen:type:]): add parameter
+        (-[WebVideoFullscreenController enterFullscreen:]): Deleted.
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.h: reorder protected to after public
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+        (-[WebAVPlayerController player]): this stub is now required
+        (-[WebAVPlayerController layoutSublayersOfLayer:]): this is a better way to update video frames
+        (WebVideoFullscreenInterfaceAVKit::setupFullscreen): implement optimized fullscreen interface 
+        (WebVideoFullscreenInterfaceAVKit::enterFullscreen): ditto
+        (WebVideoFullscreenInterfaceAVKit::exitFullscreen): ditto
+        (WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen): ditto
+
 2014-10-28  Chris Dumez  <[email protected]>
 
         Clean up virtual functions in accessibility/

Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp (175278 => 175279)


--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp	2014-10-28 23:14:42 UTC (rev 175279)
@@ -187,6 +187,13 @@
     if (m_textTrackContainer)
         m_textTrackContainer->exitedFullscreen();
 }
+    
+void MediaControlsHost::enterFullscreenOptimized()
+{
+#if ENABLE(OPTIMIZED_FULLSCREEN)
+    m_mediaElement->enterFullscreenOptimized();
+#endif
+}
 
 void MediaControlsHost::updateCaptionDisplaySizes()
 {

Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h (175278 => 175279)


--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h	2014-10-28 23:14:42 UTC (rev 175279)
@@ -70,6 +70,7 @@
     void updateCaptionDisplaySizes();
     void enteredFullscreen();
     void exitedFullscreen();
+    void enterFullscreenOptimized();
 
     String externalDeviceDisplayName() const;
     String externalDeviceType() const;

Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl (175278 => 175279)


--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl	2014-10-28 23:14:42 UTC (rev 175279)
@@ -55,4 +55,5 @@
     void updateTextTrackContainer();
     void enteredFullscreen();
     void exitedFullscreen();
+    void enterFullscreenOptimized();
 };

Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js (175278 => 175279)


--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js	2014-10-28 23:14:42 UTC (rev 175279)
@@ -330,12 +330,17 @@
             return;
 
         var velocity = Math.abs(event.scale - 1) / duration;
-
-        if (event.scale < 1.25 || velocity < 2)
+        
+        if (velocity < 2)
             return;
 
-        delete this.gestureStartTime;
-        this.video.webkitEnterFullscreen();
+        if (event.scale >= 1.25) {
+            delete this.gestureStartTime;
+            this.video.webkitEnterFullscreen();
+        } else if (event.scale <= 0.75) {
+            delete this.gestureStartTime;
+            this.host.enterFullscreenOptimized();
+        }
     },
 
     handleBaseGestureEnd: function(event) {

Modified: trunk/Source/WebCore/WebCore.exp.in (175278 => 175279)


--- trunk/Source/WebCore/WebCore.exp.in	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-10-28 23:14:42 UTC (rev 175279)
@@ -3461,7 +3461,7 @@
 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit14exitFullscreenENS_7IntRectE
 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit14setCurrentTimeEdd
 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit15enterFullscreenEv
-__ZN7WebCore32WebVideoFullscreenInterfaceAVKit15setupFullscreenER7CALayerNS_7IntRectEP6UIView
+__ZN7WebCore32WebVideoFullscreenInterfaceAVKit15setupFullscreenER7CALayerNS_7IntRectEP6UIViewNS_16HTMLMediaElement19VideoFullscreenModeE
 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit17cleanupFullscreenEv
 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit17setSeekableRangesERKNS_10TimeRangesE
 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit18setVideoDimensionsEbff

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (175278 => 175279)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2014-10-28 23:14:42 UTC (rev 175279)
@@ -273,6 +273,7 @@
     , m_clockTimeAtLastUpdateEvent(0)
     , m_lastTimeUpdateEventMovieTime(MediaTime::positiveInfiniteTime())
     , m_loadState(WaitingForSource)
+    , m_videoFullscreenMode(VideoFullscreenModeNone)
 #if PLATFORM(IOS)
     , m_videoFullscreenGravity(MediaPlayer::VideoGravityResizeAspect)
 #endif
@@ -302,7 +303,6 @@
     , m_sentEndEvent(false)
     , m_pausedInternal(false)
     , m_sendProgressEvents(true)
-    , m_isInVideoFullscreen(false)
     , m_closedCaptionsVisible(false)
     , m_webkitLegacyClosedCaptionOverride(false)
     , m_completelyLoaded(false)
@@ -679,7 +679,7 @@
             mediaControls()->hide();
         if (m_networkState > NETWORK_EMPTY)
             pause();
-        if (m_isInVideoFullscreen)
+        if (m_videoFullscreenMode != VideoFullscreenModeNone)
             exitFullscreen();
 
         if (m_player) {
@@ -4670,7 +4670,7 @@
 void HTMLMediaElement::stop()
 {
     LOG(Media, "HTMLMediaElement::stop(%p)", this);
-    if (m_isInVideoFullscreen)
+    if (m_videoFullscreenMode != VideoFullscreenModeNone)
         exitFullscreen();
     
     m_inActiveDocument = false;
@@ -4765,7 +4765,7 @@
 #if ENABLE(VIDEO_TRACK)
 bool HTMLMediaElement::requiresTextTrackRepresentation() const
 {
-    return m_isInVideoFullscreen && m_player ? m_player->requiresTextTrackRepresentation() : false;
+    return (m_videoFullscreenMode != VideoFullscreenModeNone) && m_player ? m_player->requiresTextTrackRepresentation() : false;
 }
 
 void HTMLMediaElement::setTextTrackRepresentation(TextTrackRepresentation* representation)
@@ -4857,7 +4857,7 @@
     
 bool HTMLMediaElement::isFullscreen() const
 {
-    if (m_isInVideoFullscreen)
+    if (m_videoFullscreenMode != VideoFullscreenModeNone)
         return true;
     
 #if ENABLE(FULLSCREEN_API)
@@ -4878,10 +4878,11 @@
         enterFullscreen();
 }
 
-void HTMLMediaElement::enterFullscreen()
+void HTMLMediaElement::enterFullscreen(VideoFullscreenMode mode)
 {
     LOG(Media, "HTMLMediaElement::enterFullscreen(%p)", this);
-    if (m_isInVideoFullscreen)
+    ASSERT(mode != VideoFullscreenModeNone);
+    if (m_videoFullscreenMode != VideoFullscreenModeNone)
         return;
 
 #if ENABLE(FULLSCREEN_API)
@@ -4891,18 +4892,23 @@
     }
 #endif
 
-    m_isInVideoFullscreen = true;
+    m_videoFullscreenMode = mode;
     if (hasMediaControls())
         mediaControls()->enteredFullscreen();
     if (document().page() && is<HTMLVideoElement>(*this)) {
         HTMLVideoElement& asVideo = downcast<HTMLVideoElement>(*this);
         if (document().page()->chrome().client().supportsVideoFullscreen()) {
-            document().page()->chrome().client().enterVideoFullscreenForVideoElement(&asVideo);
+            document().page()->chrome().client().enterVideoFullscreenForVideoElement(&asVideo, m_videoFullscreenMode);
             scheduleEvent(eventNames().webkitbeginfullscreenEvent);
         }
     }
 }
 
+void HTMLMediaElement::enterFullscreen()
+{
+    enterFullscreen(VideoFullscreenModeStandard);
+}
+
 void HTMLMediaElement::exitFullscreen()
 {
     LOG(Media, "HTMLMediaElement::exitFullscreen(%p)", this);
@@ -4914,8 +4920,8 @@
         return;
     }
 #endif
-    ASSERT(m_isInVideoFullscreen);
-    m_isInVideoFullscreen = false;
+    ASSERT(m_videoFullscreenMode != VideoFullscreenModeNone);
+    m_videoFullscreenMode = VideoFullscreenModeNone;
     if (hasMediaControls())
         mediaControls()->exitedFullscreen();
     if (document().page() && is<HTMLVideoElement>(*this)) {
@@ -4929,6 +4935,11 @@
     }
 }
 
+void HTMLMediaElement::enterFullscreenOptimized()
+{
+    enterFullscreen(VideoFullscreenModeOptimized);
+}
+
 void HTMLMediaElement::didBecomeFullscreenElement()
 {
     if (hasMediaControls())
@@ -6002,6 +6013,9 @@
     if (m_player && m_player->isCurrentPlaybackTargetWireless())
         return true;
 #endif
+    if (m_videoFullscreenMode == VideoFullscreenModeOptimized)
+        return true;
+    
     return false;
 }
 

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (175278 => 175279)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2014-10-28 23:14:42 UTC (rev 175279)
@@ -391,8 +391,11 @@
     
     WEBCORE_EXPORT virtual bool isFullscreen() const override;
     void toggleFullscreenState();
+    enum VideoFullscreenMode { VideoFullscreenModeNone, VideoFullscreenModeStandard, VideoFullscreenModeOptimized };
+    void enterFullscreen(VideoFullscreenMode);
     virtual void enterFullscreen() override;
     WEBCORE_EXPORT void exitFullscreen();
+    void enterFullscreenOptimized();
 
     virtual bool hasClosedCaptions() const override;
     virtual bool closedCaptionsVisible() const override;
@@ -768,6 +771,7 @@
     RefPtr<HTMLSourceElement> m_currentSourceNode;
     RefPtr<Node> m_nextChildNodeToConsider;
 
+    VideoFullscreenMode m_videoFullscreenMode;
 #if PLATFORM(IOS)
     RetainPtr<PlatformLayer> m_videoFullscreenLayer;
     FloatRect m_videoFullscreenFrame;
@@ -831,7 +835,6 @@
     // support progress events so setting m_sendProgressEvents disables them 
     bool m_sendProgressEvents : 1;
 
-    bool m_isInVideoFullscreen : 1;
     bool m_closedCaptionsVisible : 1;
     bool m_webkitLegacyClosedCaptionOverride : 1;
     bool m_completelyLoaded : 1;

Modified: trunk/Source/WebCore/page/ChromeClient.h (175278 => 175279)


--- trunk/Source/WebCore/page/ChromeClient.h	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebCore/page/ChromeClient.h	2014-10-28 23:14:42 UTC (rev 175279)
@@ -28,6 +28,7 @@
 #include "FocusDirection.h"
 #include "FrameLoader.h"
 #include "GraphicsContext.h"
+#include "HTMLMediaElement.h"
 #include "HostWindow.h"
 #include "LayerFlushThrottleState.h"
 #include "PopupMenu.h"
@@ -338,7 +339,7 @@
 #endif
 
     virtual bool supportsVideoFullscreen() { return false; }
-    virtual void enterVideoFullscreenForVideoElement(HTMLVideoElement*) { }
+    virtual void enterVideoFullscreenForVideoElement(HTMLVideoElement*, HTMLMediaElement::VideoFullscreenMode) { }
     virtual void exitVideoFullscreen() { }
     virtual bool requiresFullscreenForVideoPlayback() { return false; } 
 

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h (175278 => 175279)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h	2014-10-28 23:14:42 UTC (rev 175279)
@@ -35,7 +35,7 @@
 WEBCORE_EXPORT @interface WebVideoFullscreenController : NSObject
 - (void)setVideoElement:(WebCore::HTMLVideoElement*)videoElement;
 - (WebCore::HTMLVideoElement*)videoElement;
-- (void)enterFullscreen:(UIView *)view;
+- (void)enterFullscreen:(UIView *)view mode:(WebCore::HTMLMediaElement::VideoFullscreenMode)mode;
 - (void)exitFullscreen;
 - (void)requestHideAndExitFullscreen;
 @end

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (175278 => 175279)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm	2014-10-28 23:14:42 UTC (rev 175279)
@@ -114,7 +114,7 @@
     return _videoElement.get();
 }
 
-- (void)enterFullscreen:(UIView *)view
+- (void)enterFullscreen:(UIView *)view mode:(HTMLMediaElement::VideoFullscreenMode)mode
 {
     [self retain]; // Balanced by -release in didExitFullscreen:
     
@@ -125,7 +125,7 @@
     _interface->setWebVideoFullscreenModel(_model.get());
     _model->setVideoElement(_videoElement.get());
     _videoFullscreenLayer = [CALayer layer];
-    _interface->setupFullscreen(*_videoFullscreenLayer.get(), _videoElement->clientRect(), view);
+    _interface->setupFullscreen(*_videoFullscreenLayer.get(), _videoElement->clientRect(), view, mode);
 }
 
 - (void)exitFullscreen

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h (175278 => 175279)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h	2014-10-28 23:14:42 UTC (rev 175279)
@@ -30,6 +30,7 @@
 #if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000
 
 #include <WebCore/EventListener.h>
+#include <WebCore/HTMLMediaElement.h>
 #include <WebCore/PlatformLayer.h>
 #include <WebCore/WebVideoFullscreenInterface.h>
 #include <wtf/RefPtr.h>
@@ -63,23 +64,7 @@
 class WebVideoFullscreenInterfaceAVKit
     : public WebVideoFullscreenInterface
     , public RefCounted<WebVideoFullscreenInterfaceAVKit> {
-        
-    RetainPtr<WebAVPlayerController> m_playerController;
-    RetainPtr<AVPlayerViewController> m_playerViewController;
-    RetainPtr<CALayer> m_videoLayer;
-    RetainPtr<WebAVVideoLayer> m_videoLayerContainer;
-    WebVideoFullscreenModel* m_videoFullscreenModel;
-    WebVideoFullscreenChangeObserver* m_fullscreenChangeObserver;
 
-    // These are only used when fullscreen is presented in a separate window.
-    RetainPtr<UIWindow> m_window;
-    RetainPtr<UIViewController> m_viewController;
-    RetainPtr<UIView> m_parentView;
-
-    WebAVPlayerController *playerController();
-    
-    void doEnterFullscreen();
-        
 public:
     WEBCORE_EXPORT WebVideoFullscreenInterfaceAVKit();
     virtual ~WebVideoFullscreenInterfaceAVKit() { }
@@ -95,13 +80,34 @@
     WEBCORE_EXPORT virtual void setAudioMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) override;
     WEBCORE_EXPORT virtual void setLegibleMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) override;
     WEBCORE_EXPORT virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, WTF::String localizedDeviceName) override;
-
-    WEBCORE_EXPORT virtual void setupFullscreen(PlatformLayer&, IntRect initialRect, UIView *);
+    
+    WEBCORE_EXPORT virtual void setupFullscreen(PlatformLayer&, IntRect initialRect, UIView *, HTMLMediaElement::VideoFullscreenMode);
     WEBCORE_EXPORT virtual void enterFullscreen();
     WEBCORE_EXPORT virtual void exitFullscreen(IntRect finalRect);
     WEBCORE_EXPORT virtual void cleanupFullscreen();
     WEBCORE_EXPORT virtual void invalidate();
     WEBCORE_EXPORT virtual void requestHideAndExitFullscreen();
+    
+protected:
+        
+    RetainPtr<WebAVPlayerController> m_playerController;
+    RetainPtr<AVPlayerViewController> m_playerViewController;
+    RetainPtr<CALayer> m_videoLayer;
+    RetainPtr<WebAVVideoLayer> m_videoLayerContainer;
+    WebVideoFullscreenModel* m_videoFullscreenModel;
+    WebVideoFullscreenChangeObserver* m_fullscreenChangeObserver;
+
+    // These are only used when fullscreen is presented in a separate window.
+    RetainPtr<UIWindow> m_window;
+    RetainPtr<UIViewController> m_viewController;
+    RetainPtr<UIView> m_parentView;
+    HTMLMediaElement::VideoFullscreenMode m_mode;
+    bool m_exitRequested;
+    bool m_exitCompleted;
+
+    WebAVPlayerController *playerController();
+    
+    void doEnterFullscreen();
 };
 
 }

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (175278 => 175279)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm	2014-10-28 23:14:42 UTC (rev 175279)
@@ -157,6 +157,10 @@
     [super dealloc];
 }
 
+- (AVPlayer*) player {
+    return nil;
+}
+
 - (id)forwardingTargetForSelector:(SEL)selector
 {
     UNUSED_PARAM(selector);
@@ -460,6 +464,18 @@
     return [NSSet setWithObjects:@"externalPlaybackActive", nil];
 }
 
+- (void)layoutSublayersOfLayer:(CALayer *)layer
+{
+    CGRect layerBounds = [layer bounds];
+    self.delegate->setVideoLayerFrame(CGRectMake(0, 0, CGRectGetWidth(layerBounds), CGRectGetHeight(layerBounds)));
+    
+    [CATransaction begin];
+    for (CALayer *sublayer in [layer sublayers]) {
+        [sublayer setAnchorPoint:CGPointMake(0.5, 0.5)];
+        [sublayer setPosition:CGPointMake(CGRectGetMidX(layerBounds), CGRectGetMidY(layerBounds))];
+    }
+    [CATransaction commit];
+}
 @end
 
 @interface WebAVMediaSelectionOption : NSObject
@@ -772,12 +788,15 @@
     });
 }
 
-void WebVideoFullscreenInterfaceAVKit::setupFullscreen(PlatformLayer& videoLayer, WebCore::IntRect initialRect, UIView* parentView)
+void WebVideoFullscreenInterfaceAVKit::setupFullscreen(PlatformLayer& videoLayer, WebCore::IntRect initialRect, UIView* parentView, HTMLMediaElement::VideoFullscreenMode mode)
 {
     __block RefPtr<WebVideoFullscreenInterfaceAVKit> protect(this);
     
+    ASSERT(mode != HTMLMediaElement::VideoFullscreenModeNone);
     m_videoLayer = &videoLayer;
     
+    m_mode = mode;
+    
     dispatch_async(dispatch_get_main_queue(), ^{
 
         [CATransaction begin];
@@ -839,19 +858,58 @@
 {
     __block RefPtr<WebVideoFullscreenInterfaceAVKit> protect(this);
     
+    m_exitCompleted = false;
+    m_exitRequested = false;
+    
     dispatch_async(dispatch_get_main_queue(), ^{
         [m_videoLayerContainer setBackgroundColor:[[getUIColorClass() blackColor] CGColor]];
-        [m_playerViewController enterFullScreenWithCompletionHandler:^(BOOL, NSError*)
-        {
-            [m_playerViewController setShowsPlaybackControls:YES];
-
-            WebThreadRun(^{
-                if (m_fullscreenChangeObserver)
-                    m_fullscreenChangeObserver->didEnterFullscreen();
-
-                protect = nullptr;
-            });
-        }];
+#if ENABLE(OPTIMIZED_FULLSCREEN)
+        if (m_mode == HTMLMediaElement::VideoFullscreenModeOptimized) {
+            [m_playerViewController startOptimizedFullscreenWithStartCompletionHandler:^(BOOL success, NSError *) {
+                
+                [m_playerViewController setShowsPlaybackControls:YES];
+                
+                WebThreadRun(^{
+                    [m_window setHidden:YES];
+                    if (m_fullscreenChangeObserver)
+                        m_fullscreenChangeObserver->didEnterFullscreen();
+                    
+                    if (!success) {
+                        if (m_videoFullscreenModel)
+                            m_videoFullscreenModel->requestExitFullscreen();
+                        protect = nullptr;
+                    }
+                });
+            } stopCompletionHandler:^(AVPlayerViewControllerOptimizedFullscreenStopReason) {
+                m_exitCompleted = true;
+                if (m_exitRequested) {
+                    [m_videoLayerContainer setBackgroundColor:[[getUIColorClass() clearColor] CGColor]];
+                    [[m_playerViewController view] setBackgroundColor:[getUIColorClass() clearColor]];
+                    WebThreadRun(^{
+                        if (m_fullscreenChangeObserver)
+                            m_fullscreenChangeObserver->didExitFullscreen();
+                        protect = nullptr;
+                    });
+                } else {
+                    if (m_videoFullscreenModel)
+                        m_videoFullscreenModel->requestExitFullscreen();
+                }
+            }];
+        } else
+#endif
+        if (m_mode == HTMLMediaElement::VideoFullscreenModeStandard) {
+            [m_playerViewController enterFullScreenWithCompletionHandler:^(BOOL, NSError*)
+            {
+                [m_playerViewController setShowsPlaybackControls:YES];
+                
+                WebThreadRun(^{
+                    if (m_fullscreenChangeObserver)
+                        m_fullscreenChangeObserver->didEnterFullscreen();
+                    
+                    protect = nullptr;
+                });
+            }];
+        }
     });
 }
 
@@ -859,6 +917,16 @@
 {
     __block RefPtr<WebVideoFullscreenInterfaceAVKit> protect(this);
     
+    m_exitRequested = true;
+    if (m_exitCompleted) {
+        WebThreadRun(^{
+            if (m_fullscreenChangeObserver)
+                m_fullscreenChangeObserver->didExitFullscreen();
+            protect = nullptr;
+        });
+        return;
+    }
+    
     m_playerController = nil;
     
     dispatch_async(dispatch_get_main_queue(), ^{
@@ -871,16 +939,26 @@
         if ([m_videoLayerContainer videoLayerGravity] != AVVideoLayerGravityResizeAspect)
             [m_videoLayerContainer setVideoLayerGravity:AVVideoLayerGravityResizeAspect];
         [[m_playerViewController view] layoutIfNeeded];
-        [m_playerViewController exitFullScreenWithCompletionHandler:^(BOOL, NSError*) {
-            [m_videoLayerContainer setBackgroundColor:[[getUIColorClass() clearColor] CGColor]];
-            [[m_playerViewController view] setBackgroundColor:[getUIColorClass() clearColor]];
+        
+#if ENABLE(OPTIMIZED_FULLSCREEN)
+        if (m_mode == HTMLMediaElement::VideoFullscreenModeOptimized) {
+            [m_window setHidden:NO];
+            [m_playerViewController stopOptimizedFullscreen];
+        } else
+#endif
+        if (m_mode == HTMLMediaElement::VideoFullscreenModeStandard) {
+            [m_playerViewController exitFullScreenWithCompletionHandler:^(BOOL, NSError*) {
+                m_exitCompleted = true;
+                [m_videoLayerContainer setBackgroundColor:[[getUIColorClass() clearColor] CGColor]];
+                [[m_playerViewController view] setBackgroundColor:[getUIColorClass() clearColor]];
+                WebThreadRun(^{
+                    if (m_fullscreenChangeObserver)
+                        m_fullscreenChangeObserver->didExitFullscreen();
+                    protect = nullptr;
+                });
 
-            WebThreadRun(^{
-                if (m_fullscreenChangeObserver)
-                    m_fullscreenChangeObserver->didExitFullscreen();
-                protect = nullptr;
-            });
-        }];
+            }];
+        }
     });
 }
 
@@ -952,8 +1030,10 @@
 
 void WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen()
 {
+    if (m_mode == HTMLMediaElement::VideoFullscreenModeOptimized)
+        return;
+    
     __block RefPtr<WebVideoFullscreenInterfaceAVKit> protect(this);
-
     dispatch_async(dispatch_get_main_queue(), ^{
         [m_window setHidden:YES];
         [m_playerViewController exitFullScreenAnimated:NO completionHandler:^(BOOL, NSError*) {

Modified: trunk/Source/WebKit/mac/ChangeLog (175278 => 175279)


--- trunk/Source/WebKit/mac/ChangeLog	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-10-28 23:14:42 UTC (rev 175279)
@@ -1,3 +1,21 @@
+2014-10-28  Jeremy Jones  <[email protected]>
+
+        Add optimized fullscreen mode.
+        https://bugs.webkit.org/show_bug.cgi?id=138044
+
+        Reviewed by Jer Noble.
+
+        Enable different types of fullscreen video behavior.
+        Add an enum parameter to enterVideoFullscreenForVideoElement for alternate types of fullscreen.
+
+        * WebCoreSupport/WebChromeClient.h: Add fullscreenType parameter
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::enterVideoFullscreenForVideoElement): ditto
+        * WebView/WebView.mm:
+        (-[WebView _enterVideoFullscreenForVideoElement:type:]): ditto
+        (-[WebView _enterVideoFullscreenForVideoElement:]): Deleted.
+        * WebView/WebViewInternal.h: ditto
+
 2014-10-27  Beth Dakin  <[email protected]>
 
         Provide a way for WebKit1 clients to override default action menu items

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h (175278 => 175279)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h	2014-10-28 23:14:42 UTC (rev 175279)
@@ -182,7 +182,7 @@
 
 #if ENABLE(VIDEO)
     virtual bool supportsVideoFullscreen() override;
-    virtual void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement*) override;
+    virtual void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement*, WebCore::HTMLMediaElement::VideoFullscreenMode) override;
     virtual void exitVideoFullscreen() override;
 #endif
     

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm (175278 => 175279)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm	2014-10-28 23:14:42 UTC (rev 175279)
@@ -953,10 +953,11 @@
     return true;
 }
 
-void WebChromeClient::enterVideoFullscreenForVideoElement(HTMLVideoElement* videoElement)
+void WebChromeClient::enterVideoFullscreenForVideoElement(HTMLVideoElement* videoElement, HTMLMediaElement::VideoFullscreenMode mode)
 {
+    ASSERT(mode != HTMLMediaElement::VideoFullscreenModeNone);
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    [m_webView _enterVideoFullscreenForVideoElement:videoElement];
+    [m_webView _enterVideoFullscreenForVideoElement:videoElement mode:mode];
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (175278 => 175279)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2014-10-28 23:14:42 UTC (rev 175279)
@@ -8374,7 +8374,7 @@
 #endif
 
 #if ENABLE(VIDEO)
-- (void)_enterVideoFullscreenForVideoElement:(WebCore::HTMLVideoElement*)videoElement
+- (void)_enterVideoFullscreenForVideoElement:(WebCore::HTMLVideoElement*)videoElement mode:(WebCore::HTMLMediaElement::VideoFullscreenMode)mode
 {
     if (_private->fullscreenController) {
         if ([_private->fullscreenController videoElement] == videoElement) {
@@ -8394,7 +8394,7 @@
         _private->fullscreenController = [[WebVideoFullscreenController alloc] init];
         [_private->fullscreenController setVideoElement:videoElement];
 #if PLATFORM(IOS)
-        [_private->fullscreenController enterFullscreen:(UIView *)[[[self window] hostLayer] delegate]];
+        [_private->fullscreenController enterFullscreen:(UIView *)[[[self window] hostLayer] delegate] mode:mode];
 #else
         [_private->fullscreenController enterFullscreen:[[self window] screen]];
 #endif
@@ -8412,7 +8412,7 @@
     _private->fullscreenController = nil;
 }
 
-#endif // ENABLE(VIDEO) && !PLATFORM(IOS)
+#endif // ENABLE(VIDEO)
 
 #if ENABLE(FULLSCREEN_API) && !PLATFORM(IOS)
 - (BOOL)_supportsFullScreenForElement:(const WebCore::Element*)element withKeyboard:(BOOL)withKeyboard

Modified: trunk/Source/WebKit/mac/WebView/WebViewInternal.h (175278 => 175279)


--- trunk/Source/WebKit/mac/WebView/WebViewInternal.h	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebKit/mac/WebView/WebViewInternal.h	2014-10-28 23:14:42 UTC (rev 175279)
@@ -37,6 +37,7 @@
 #import <WebCore/AlternativeTextClient.h>
 #import <WebCore/FindOptions.h>
 #import <WebCore/FloatRect.h>
+#import <WebCore/HTMLMediaElement.h>
 #import <WebCore/LayoutMilestones.h>
 #import <WebCore/TextAlternativeWithRange.h>
 #import <WebCore/WebCoreKeyboardUIMode.h>
@@ -239,7 +240,7 @@
 - (void)_preferencesChanged:(WebPreferences *)preferences;
 
 #if ENABLE(VIDEO) && defined(__cplusplus)
-- (void)_enterVideoFullscreenForVideoElement:(WebCore::HTMLVideoElement*)videoElement;
+- (void)_enterVideoFullscreenForVideoElement:(WebCore::HTMLVideoElement*)videoElement mode:(WebCore::HTMLMediaElement::VideoFullscreenMode)mode;
 - (void)_exitVideoFullscreen;
 #endif
 

Modified: trunk/Source/WebKit2/ChangeLog (175278 => 175279)


--- trunk/Source/WebKit2/ChangeLog	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebKit2/ChangeLog	2014-10-28 23:14:42 UTC (rev 175279)
@@ -1,3 +1,25 @@
+2014-10-28  Jeremy Jones  <[email protected]>
+
+        Add optimized fullscreen mode.
+        https://bugs.webkit.org/show_bug.cgi?id=138044
+
+        Reviewed by Anders Carlsson.
+
+        Enable different types of fullscreen video behavior.
+        Add an enum parameter to enterVideoFullscreenForVideoElement for alternate types of fullscreen.
+
+        * UIProcess/ios/WebVideoFullscreenManagerProxy.h: Add fullscreenType parameter
+        * UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in: ditto
+        * UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
+        (WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID): ditto
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::enterVideoFullscreenForVideoElement): ditto
+        * WebProcess/WebCoreSupport/WebChromeClient.h: ditto
+        * WebProcess/ios/WebVideoFullscreenManager.h: ditto
+        * WebProcess/ios/WebVideoFullscreenManager.mm:
+        (WebKit::WebVideoFullscreenManager::enterVideoFullscreenForVideoElement): ditto
+        (WebKit::WebVideoFullscreenManager::didCleanupFullscreen): ditto
+
 2014-10-28  Dan Bernstein  <[email protected]>
 
         Added a Radar reference to a comment.

Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h (175278 => 175279)


--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h	2014-10-28 23:14:42 UTC (rev 175279)
@@ -55,7 +55,7 @@
     virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override;
 
     // Translate to FullscreenInterface
-    void setupFullscreenWithID(uint32_t, WebCore::IntRect initialRect, float hostingDeviceScaleFactor);
+    void setupFullscreenWithID(uint32_t, WebCore::IntRect initialRect, float hostingDeviceScaleFactor, uint32_t videoFullscreenMode);
     void setSeekableRangesVector(Vector<std::pair<double, double>>&);
     void setExternalPlaybackProperties(bool enabled, uint32_t targetType, String localizedDeviceName);
     

Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in (175278 => 175279)


--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in	2014-10-28 23:14:42 UTC (rev 175279)
@@ -31,7 +31,7 @@
     SetExternalPlaybackProperties(bool enabled, uint32_t targetType, String localizedDeviceName);
     SetDuration(double duration)
     SetRate(bool isPlaying, double rate)
-    SetupFullscreenWithID(uint32_t videoLayerID, WebCore::IntRect initialRect, float hostingScaleFactor)
+    SetupFullscreenWithID(uint32_t videoLayerID, WebCore::IntRect initialRect, float hostingScaleFactor, uint32_t videoFullscreenMode)
     EnterFullscreen()
     ExitFullscreen(WebCore::IntRect finalRect)
     CleanupFullscreen()

Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm (175278 => 175279)


--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm	2014-10-28 23:14:42 UTC (rev 175279)
@@ -81,7 +81,7 @@
     m_layerHost.clear();
 }
 
-void WebVideoFullscreenManagerProxy::setupFullscreenWithID(uint32_t videoLayerID, WebCore::IntRect initialRect, float hostingDeviceScaleFactor)
+void WebVideoFullscreenManagerProxy::setupFullscreenWithID(uint32_t videoLayerID, WebCore::IntRect initialRect, float hostingDeviceScaleFactor, uint32_t videoFullscreenMode)
 {
     ASSERT(videoLayerID);
     m_layerHost = WKMakeRenderLayer(videoLayerID);
@@ -92,7 +92,8 @@
     }
 
     UIView *parentView = downcast<RemoteLayerTreeDrawingAreaProxy>(*m_page->drawingArea()).remoteLayerTreeHost().rootLayer();
-    setupFullscreen(*m_layerHost.get(), initialRect, parentView);
+    HTMLMediaElement::VideoFullscreenMode mode = static_cast<HTMLMediaElement::VideoFullscreenMode>(videoFullscreenMode);
+    setupFullscreen(*m_layerHost.get(), initialRect, parentView, mode);
 }
     
 void WebVideoFullscreenManagerProxy::setSeekableRangesVector(Vector<std::pair<double, double>>& ranges)

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (175278 => 175279)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2014-10-28 23:14:42 UTC (rev 175279)
@@ -905,9 +905,10 @@
     return m_page->videoFullscreenManager()->supportsVideoFullscreen();
 }
 
-void WebChromeClient::enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement* videoElement)
+void WebChromeClient::enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement* videoElement, WebCore::HTMLMediaElement::VideoFullscreenMode mode)
 {
-    m_page->videoFullscreenManager()->enterVideoFullscreenForVideoElement(videoElement);
+    ASSERT(mode != HTMLMediaElement::VideoFullscreenModeNone);
+    m_page->videoFullscreenManager()->enterVideoFullscreenForVideoElement(videoElement, mode);
 }
 
 void WebChromeClient::exitVideoFullscreen()

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (175278 => 175279)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2014-10-28 23:14:42 UTC (rev 175279)
@@ -254,7 +254,7 @@
 
 #if PLATFORM(IOS)
     virtual bool supportsVideoFullscreen();
-    virtual void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement*);
+    virtual void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement*, WebCore::HTMLMediaElement::VideoFullscreenMode);
     virtual void exitVideoFullscreen();
 #endif
 

Modified: trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h (175278 => 175279)


--- trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h	2014-10-28 23:14:42 UTC (rev 175279)
@@ -29,6 +29,7 @@
 
 #include "MessageReceiver.h"
 #include <WebCore/EventListener.h>
+#include <WebCore/HTMLMediaElement.h>
 #include <WebCore/PlatformCALayer.h>
 #include <WebCore/WebVideoFullscreenInterface.h>
 #include <WebCore/WebVideoFullscreenModelVideoElement.h>
@@ -59,7 +60,7 @@
     void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&);
     
     bool supportsVideoFullscreen() const;
-    void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement*);
+    void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement*, WebCore::HTMLMediaElement::VideoFullscreenMode);
     void exitVideoFullscreen();
     
 protected:
@@ -92,6 +93,7 @@
     
     bool m_isAnimating;
     bool m_targetIsFullscreen;
+    WebCore::HTMLMediaElement::VideoFullscreenMode m_fullscreenMode;
     bool m_isFullscreen;
 };
     

Modified: trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm (175278 => 175279)


--- trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm	2014-10-28 22:42:37 UTC (rev 175278)
+++ trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm	2014-10-28 23:14:42 UTC (rev 175279)
@@ -85,11 +85,14 @@
     return Settings::avKitEnabled();
 }
 
-void WebVideoFullscreenManager::enterVideoFullscreenForVideoElement(HTMLVideoElement* videoElement)
+void WebVideoFullscreenManager::enterVideoFullscreenForVideoElement(HTMLVideoElement* videoElement, HTMLMediaElement::VideoFullscreenMode mode)
 {
+    ASSERT(mode != HTMLMediaElement::VideoFullscreenModeNone);
+
     m_videoElement = videoElement;
 
     m_targetIsFullscreen = true;
+    m_fullscreenMode = mode;
 
     if (m_isAnimating)
         return;
@@ -99,7 +102,7 @@
 
     m_layerHostingContext = LayerHostingContext::createForExternalHostingProcess();
     
-    m_page->send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(m_layerHostingContext->contextID(), clientRectForElement(videoElement), m_page->deviceScaleFactor()), m_page->pageID());
+    m_page->send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(m_layerHostingContext->contextID(), clientRectForElement(videoElement), m_page->deviceScaleFactor(), m_fullscreenMode), m_page->pageID());
 }
 
 void WebVideoFullscreenManager::exitVideoFullscreen()
@@ -235,7 +238,7 @@
     // enter fullscreen now if it was previously requested during an animation.
     __block RefPtr<WebVideoFullscreenModelVideoElement> protect(this);
     WebThreadRun(^ {
-        enterVideoFullscreenForVideoElement(m_videoElement.get());
+        enterVideoFullscreenForVideoElement(m_videoElement.get(), m_fullscreenMode);
         protect.clear();
     });
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to