Diff
Modified: branches/safari-600.1-branch/Source/WebCore/ChangeLog (172084 => 172085)
--- branches/safari-600.1-branch/Source/WebCore/ChangeLog 2014-08-05 21:37:10 UTC (rev 172084)
+++ branches/safari-600.1-branch/Source/WebCore/ChangeLog 2014-08-05 21:39:21 UTC (rev 172085)
@@ -1,5 +1,33 @@
2014-08-05 Lucas Forschler <lforsch...@apple.com>
+ Merge r171973
+
+ 2014-08-02 Jeremy Jones <jere...@apple.com>
+
+ Support both window and view based video fullscreen.
+ https://bugs.webkit.org/show_bug.cgi?id=135525
+
+ Reviewed by Simon Fraser.
+
+ Presenting in a separate window gives greater flexibility for rotation separately from the app.
+ Presenting in the same window works better if the interface is rehosted in another process.
+
+ * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+ (-[WebVideoFullscreenController enterFullscreen:]): Use clientRect instead of screenRect.
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.h: Add m_window and m_parentView.
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+ (-[WebAVVideoLayer setBounds:]): Parent view might not be fullscreen; use window instead.
+ (WebVideoFullscreenInterfaceAVKit::setupFullscreen): Conditionally create UIWindow and UIViewController for fullscreen.
+ (WebVideoFullscreenInterfaceAVKit::enterFullscreen): Video, not the container should have black background.
+ (WebVideoFullscreenInterfaceAVKit::exitFullscreen): Conditionally translate finalRect.
+ (WebVideoFullscreenInterfaceAVKit::cleanupFullscreen): Clean up UIWindow and force status bar to correct orientation.
+ (WebVideoFullscreenInterfaceAVKit::invalidate): Clean up UIWindow.
+ (WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen): Hide window and exit without animation.
+ * platform/ios/WebVideoFullscreenModelMediaElement.mm:
+ (WebVideoFullscreenModelMediaElement::setVideoFullscreenLayer): Apply frame, because it may have been set before the layer.
+
+2014-08-05 Lucas Forschler <lforsch...@apple.com>
+
Merge r171952
2014-08-01 Beth Dakin <bda...@apple.com>
Modified: branches/safari-600.1-branch/Source/WebCore/platform/RuntimeApplicationChecksIOS.h (172084 => 172085)
--- branches/safari-600.1-branch/Source/WebCore/platform/RuntimeApplicationChecksIOS.h 2014-08-05 21:37:10 UTC (rev 172084)
+++ branches/safari-600.1-branch/Source/WebCore/platform/RuntimeApplicationChecksIOS.h 2014-08-05 21:39:21 UTC (rev 172085)
@@ -29,6 +29,7 @@
// FIXME: We should consider merging this file with RuntimeApplicationChecks.h.
namespace WebCore {
+bool applicationIsAdSheet();
bool applicationIsMobileMail();
bool applicationIsMobileSafari();
bool applicationIsDumpRenderTree();
Modified: branches/safari-600.1-branch/Source/WebCore/platform/RuntimeApplicationChecksIOS.mm (172084 => 172085)
--- branches/safari-600.1-branch/Source/WebCore/platform/RuntimeApplicationChecksIOS.mm 2014-08-05 21:37:10 UTC (rev 172084)
+++ branches/safari-600.1-branch/Source/WebCore/platform/RuntimeApplicationChecksIOS.mm 2014-08-05 21:39:21 UTC (rev 172085)
@@ -31,6 +31,12 @@
namespace WebCore {
+bool applicationIsAdSheet()
+{
+ static bool isAdSheet = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.AdSheetPhone"];
+ return isAdSheet;
+}
+
bool applicationIsMobileMail()
{
static bool isMobileMail = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.mobilemail"];
Modified: branches/safari-600.1-branch/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (172084 => 172085)
--- branches/safari-600.1-branch/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm 2014-08-05 21:37:10 UTC (rev 172084)
+++ branches/safari-600.1-branch/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm 2014-08-05 21:39:21 UTC (rev 172085)
@@ -125,7 +125,7 @@
_interface->setWebVideoFullscreenModel(_model.get());
_model->setMediaElement(_mediaElement.get());
_videoFullscreenLayer = [CALayer layer];
- _interface->setupFullscreen(*_videoFullscreenLayer.get(), _mediaElement->screenRect(), view);
+ _interface->setupFullscreen(*_videoFullscreenLayer.get(), _mediaElement->clientRect(), view);
}
- (void)exitFullscreen
Modified: branches/safari-600.1-branch/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h (172084 => 172085)
--- branches/safari-600.1-branch/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h 2014-08-05 21:37:10 UTC (rev 172084)
+++ branches/safari-600.1-branch/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h 2014-08-05 21:39:21 UTC (rev 172085)
@@ -62,12 +62,16 @@
RetainPtr<WebAVPlayerController> m_playerController;
RetainPtr<AVPlayerViewController> m_playerViewController;
- RetainPtr<UIViewController> m_viewController;
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();
Modified: branches/safari-600.1-branch/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (172084 => 172085)
--- branches/safari-600.1-branch/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm 2014-08-05 21:37:10 UTC (rev 172084)
+++ branches/safari-600.1-branch/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm 2014-08-05 21:39:21 UTC (rev 172085)
@@ -42,6 +42,7 @@
#import <AVKit/AVVideoLayer.h>
#import <CoreMedia/CMTime.h>
#import <UIKit/UIKit.h>
+#import <WebCore/RuntimeApplicationChecksIOS.h>
#import <WebCore/SoftLinking.h>
#import <WebCore/TimeRanges.h>
#import <WebCore/WebCoreThreadRun.h>
@@ -59,6 +60,7 @@
SOFT_LINK_CLASS(AVKit, AVValueTiming)
SOFT_LINK_FRAMEWORK(UIKit)
+SOFT_LINK_CLASS(UIKit, UIApplication)
SOFT_LINK_CLASS(UIKit, UIScreen)
SOFT_LINK_CLASS(UIKit, UIWindow)
SOFT_LINK_CLASS(UIKit, UIView)
@@ -515,7 +517,7 @@
if (![_avPlayerController delegate] || !_avPlayerViewController)
return;
- UIView* rootView = [[_avPlayerViewController parentViewController] view];
+ UIView* rootView = [[_avPlayerViewController view] window];
if (!rootView)
return;
@@ -742,10 +744,16 @@
[CATransaction begin];
[CATransaction setDisableActions:YES];
+ m_parentView = parentView;
- m_viewController = adoptNS([[getUIViewControllerClass() alloc] init]);
- [[m_viewController view] setFrame:parentView.bounds];
- [parentView addSubview:[m_viewController view]];
+ if (!applicationIsAdSheet()) {
+ m_window = adoptNS([[getUIWindowClass() alloc] initWithFrame:[[getUIScreenClass() mainScreen] bounds]]);
+ [m_window setBackgroundColor:[getUIColorClass() clearColor]];
+ m_viewController = adoptNS([[getUIViewControllerClass() alloc] init]);
+ [[m_viewController view] setFrame:[m_window bounds]];
+ [m_window setRootViewController:m_viewController.get()];
+ [m_window makeKeyAndVisible];
+ }
[m_videoLayer removeFromSuperlayer];
@@ -763,10 +771,17 @@
[m_playerViewController setDelegate:playerController()];
[m_videoLayerContainer setPlayerViewController:m_playerViewController.get()];
- [m_viewController addChildViewController:m_playerViewController.get()];
- [[m_viewController view] addSubview:[m_playerViewController view]];
- [m_playerViewController view].frame = initialRect;
+ if (m_viewController) {
+ [m_viewController addChildViewController:m_playerViewController.get()];
+ [[m_viewController view] addSubview:[m_playerViewController view]];
+ [m_playerViewController view].frame = [parentView convertRect:initialRect toView:nil];
+ } else {
+ [parentView addSubview:[m_playerViewController view]];
+ [m_playerViewController view].frame = initialRect;
+ }
+
[[m_playerViewController view] setBackgroundColor:[getUIColorClass() clearColor]];
+ [[m_playerViewController view] setNeedsLayout];
[[m_playerViewController view] layoutIfNeeded];
[CATransaction commit];
@@ -785,7 +800,7 @@
__block RefPtr<WebVideoFullscreenInterfaceAVKit> protect(this);
dispatch_async(dispatch_get_main_queue(), ^{
- [[m_playerViewController view] setBackgroundColor:[getUIColorClass() blackColor]];
+ [m_videoLayerContainer setBackgroundColor:[[getUIColorClass() blackColor] CGColor]];
[m_playerViewController enterFullScreenWithCompletionHandler:^(BOOL, NSError*)
{
[m_playerViewController setShowsPlaybackControls:YES];
@@ -804,11 +819,16 @@
dispatch_async(dispatch_get_main_queue(), ^{
[m_playerViewController setShowsPlaybackControls:NO];
- [m_playerViewController view].frame = finalRect;
+ if (m_viewController)
+ [m_playerViewController view].frame = [m_parentView convertRect:finalRect toView:nil];
+ else
+ [m_playerViewController view].frame = finalRect;
+
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 (m_fullscreenChangeObserver)
m_fullscreenChangeObserver->didExitFullscreen();
@@ -817,15 +837,29 @@
});
}
+@interface UIApplication ()
+-(void)_setStatusBarOrientation:(UIInterfaceOrientation)o;
+@end
+
+@interface UIWindow ()
+-(UIInterfaceOrientation)interfaceOrientation;
+@end
+
void WebVideoFullscreenInterfaceAVKit::cleanupFullscreen()
{
// Retain this to extend object life until async block completes.
__block RefPtr<WebVideoFullscreenInterfaceAVKit> protect(this);
dispatch_async(dispatch_get_main_queue(), ^{
+ if (m_window) {
+ [m_window setHidden:YES];
+ [m_window setRootViewController:nil];
+ [[getUIApplicationClass() sharedApplication] _setStatusBarOrientation:[[m_parentView window] interfaceOrientation]];
+ }
[m_playerViewController setDelegate:nil];
[[m_playerViewController view] removeFromSuperview];
- [m_playerViewController removeFromParentViewController];
+ if (m_viewController)
+ [m_playerViewController removeFromParentViewController];
[m_playerViewController setPlayerController:nil];
m_playerViewController = nil;
[m_videoLayer removeFromSuperlayer];
@@ -835,6 +869,8 @@
m_videoLayerContainer = nil;
[[m_viewController view] removeFromSuperview];
m_viewController = nil;
+ m_window = nil;
+ m_parentView = nil;
if (m_fullscreenChangeObserver)
m_fullscreenChangeObserver->didCleanupFullscreen();
@@ -844,10 +880,14 @@
void WebVideoFullscreenInterfaceAVKit::invalidate()
{
+ [m_window setHidden:YES];
+ [m_window setRootViewController:nil];
+ [m_playerViewController exitFullScreenAnimated:NO completionHandler:nil];
m_playerController = nil;
[m_playerViewController setDelegate:nil];
[[m_playerViewController view] removeFromSuperview];
- [m_playerViewController removeFromParentViewController];
+ if (m_viewController)
+ [m_playerViewController removeFromParentViewController];
[m_playerViewController setPlayerController:nil];
m_playerViewController = nil;
[m_videoLayer removeFromSuperlayer];
@@ -857,6 +897,8 @@
m_videoLayerContainer = nil;
[[m_viewController view] removeFromSuperview];
m_viewController = nil;
+ m_window = nil;
+ m_parentView = nil;
}
void WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen()
@@ -864,7 +906,8 @@
__block RefPtr<WebVideoFullscreenInterfaceAVKit> protect(this);
dispatch_async(dispatch_get_main_queue(), ^{
- [m_playerViewController exitFullScreenWithCompletionHandler:^(BOOL, NSError*) {
+ [m_window setHidden:YES];
+ [m_playerViewController exitFullScreenAnimated:NO completionHandler:^(BOOL, NSError*) {
protect = nullptr;
}];
});
Modified: branches/safari-600.1-branch/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm (172084 => 172085)
--- branches/safari-600.1-branch/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm 2014-08-05 21:37:10 UTC (rev 172084)
+++ branches/safari-600.1-branch/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm 2014-08-05 21:39:21 UTC (rev 172085)
@@ -158,6 +158,7 @@
return;
m_videoFullscreenLayer = videoLayer;
+ [m_videoFullscreenLayer setFrame:m_videoFrame];
__block RefPtr<WebVideoFullscreenModelMediaElement> protect(this);
WebThreadRun(^{
Modified: branches/safari-600.1-branch/Source/WebKit/mac/ChangeLog (172084 => 172085)
--- branches/safari-600.1-branch/Source/WebKit/mac/ChangeLog 2014-08-05 21:37:10 UTC (rev 172084)
+++ branches/safari-600.1-branch/Source/WebKit/mac/ChangeLog 2014-08-05 21:39:21 UTC (rev 172085)
@@ -1,3 +1,20 @@
+2014-08-05 Lucas Forschler <lforsch...@apple.com>
+
+ Merge r171973
+
+ 2014-08-02 Jeremy Jones <jere...@apple.com>
+
+ Support both window and view based video fullscreen.
+ https://bugs.webkit.org/show_bug.cgi?id=135525
+
+ Reviewed by Simon Fraser.
+
+ Parenting in the view instead of the window gives the fullscreen implementation more latitude
+ in how it implements the animation.
+
+ * WebView/WebView.mm:
+ (-[WebView _enterFullscreenForNode:]): Use view instead of window.
+
2014-07-27 Matthew Hanson <matthew_han...@apple.com>
Merge r171635. <rdar://problem/17782407>
Modified: branches/safari-600.1-branch/Source/WebKit/mac/WebView/WebView.mm (172084 => 172085)
--- branches/safari-600.1-branch/Source/WebKit/mac/WebView/WebView.mm 2014-08-05 21:37:10 UTC (rev 172084)
+++ branches/safari-600.1-branch/Source/WebKit/mac/WebView/WebView.mm 2014-08-05 21:39:21 UTC (rev 172085)
@@ -227,7 +227,6 @@
#import "WebVisiblePosition.h"
#import <CFNetwork/CFURLCachePriv.h>
#import <MobileGestalt.h>
-#import <UIKit/UIKit.h>
#import <WebCore/EventNames.h>
#import <WebCore/FontCache.h>
#import <WebCore/GraphicsLayer.h>
@@ -8409,7 +8408,7 @@
_private->fullscreenController = [[WebVideoFullscreenController alloc] init];
[_private->fullscreenController setMediaElement:videoElement];
#if PLATFORM(IOS)
- [_private->fullscreenController enterFullscreen:[(UIView *)[[[self window] hostLayer] delegate] window]];
+ [_private->fullscreenController enterFullscreen:(UIView *)[[[self window] hostLayer] delegate]];
#else
[_private->fullscreenController enterFullscreen:[[self window] screen]];
#endif
Modified: branches/safari-600.1-branch/Source/WebKit2/ChangeLog (172084 => 172085)
--- branches/safari-600.1-branch/Source/WebKit2/ChangeLog 2014-08-05 21:37:10 UTC (rev 172084)
+++ branches/safari-600.1-branch/Source/WebKit2/ChangeLog 2014-08-05 21:39:21 UTC (rev 172085)
@@ -1,5 +1,27 @@
2014-08-05 Lucas Forschler <lforsch...@apple.com>
+ Merge r171973
+
+ 2014-08-02 Jeremy Jones <jere...@apple.com>
+
+ Support both window and view based video fullscreen.
+ https://bugs.webkit.org/show_bug.cgi?id=135525
+
+ Reviewed by Simon Fraser.
+
+ Parenting in the view instead of the window gives the fullscreen implementation more latitude
+ in how it implements the animation.
+
+ * UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
+ (WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID): Use view instead of window.
+ * WebProcess/ios/WebVideoFullscreenManager.mm:
+ (WebKit::clientRectForNode): Use client rect instead of screen rect.
+ (WebKit::WebVideoFullscreenManager::enterFullscreenForNode): ditto
+ (WebKit::WebVideoFullscreenManager::exitFullscreenForNode): ditto
+ (WebKit::screenRectForNode): Deleted.
+
+2014-08-05 Lucas Forschler <lforsch...@apple.com>
+
Merge r171959
2014-08-01 Joseph Pecoraro <pecor...@apple.com>
Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm (172084 => 172085)
--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm 2014-08-05 21:37:10 UTC (rev 172084)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm 2014-08-05 21:39:21 UTC (rev 172085)
@@ -34,7 +34,6 @@
#include "WebVideoFullscreenManagerMessages.h"
#include "WebVideoFullscreenManagerProxyMessages.h"
#include <QuartzCore/CoreAnimation.h>
-#include <UIKit/UIKit.h>
#include <WebKitSystemInterface.h>
#include <WebCore/TimeRanges.h>
@@ -78,7 +77,7 @@
ASSERT(videoLayerID);
m_layerHost = WKMakeRenderLayer(videoLayerID);
UIView *parentView = toRemoteLayerTreeDrawingAreaProxy(m_page->drawingArea())->remoteLayerTreeHost().rootLayer();
- setupFullscreen(*m_layerHost.get(), initialRect, [parentView window]);
+ setupFullscreen(*m_layerHost.get(), initialRect, parentView);
}
void WebVideoFullscreenManagerProxy::setSeekableRangesVector(Vector<std::pair<double, double>>& ranges)
Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm (172084 => 172085)
--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm 2014-08-05 21:37:10 UTC (rev 172084)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm 2014-08-05 21:39:21 UTC (rev 172085)
@@ -50,12 +50,12 @@
namespace WebKit {
-static IntRect screenRectForNode(Node* node)
+static IntRect clientRectForNode(Node* node)
{
if (!node || !node->isElementNode())
return IntRect();
- return toElement(node)->screenRect();
+ return toElement(node)->clientRect();
}
PassRefPtr<WebVideoFullscreenManager> WebVideoFullscreenManager::create(PassRefPtr<WebPage> page)
@@ -97,7 +97,7 @@
m_layerHostingContext = LayerHostingContext::createForExternalHostingProcess();
- m_page->send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(m_layerHostingContext->contextID(), screenRectForNode(node)), m_page->pageID());
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(m_layerHostingContext->contextID(), clientRectForNode(node)), m_page->pageID());
}
void WebVideoFullscreenManager::exitFullscreenForNode(Node* node)
@@ -109,7 +109,7 @@
return;
m_isAnimating = true;
- m_page->send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(screenRectForNode(node)), m_page->pageID());
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(clientRectForNode(node)), m_page->pageID());
}
void WebVideoFullscreenManager::setDuration(double duration)