2011-03-17 Jer Noble <jer.noble@apple.com>
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Mar 2011 21:45:04 +0000 (21:45 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Mar 2011 21:45:04 +0000 (21:45 +0000)
        Reviewed by Maciej Stachowiak.

        WebKit2: Cancelling full screen early leaves full screen window up.
        https://bugs.webkit.org/show_bug.cgi?id=56589

        No new tests, as WebKitTestRunner does not currently support the new Full Screen API.

        Notify the UIProcess when it needs to tear down its layer hosting view, turn off
        the background layer when not in accelerated rendering mode and don't swap out
        the web view unnecessarily

        * UIProcess/mac/WKFullScreenWindowController.mm:
        (-[WKFullScreenWindowController beganExitFullScreenAnimation]): Check before swapping _webView.
        (-[WKFullScreenWindowController enterAcceleratedCompositingMode:]): Add the _layerHostingView
            to the full screen window's animationView, not its contentsView.
        (-[WKFullScreenWindowController exitAcceleratedCompositingMode]): Hide the background layer.
        * WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm:
        (WebKit::WebFullScreenManagerMac::setRootFullScreenLayer): If given a null rootLayer, tell
            the client to exit accelerated mode.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm
Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm

index 2aad854..077d87c 100644 (file)
@@ -1,3 +1,25 @@
+2011-03-17  Jer Noble  <jer.noble@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        WebKit2: Cancelling full screen early leaves full screen window up.
+        https://bugs.webkit.org/show_bug.cgi?id=56589
+
+        No new tests, as WebKitTestRunner does not currently support the new Full Screen API.
+
+        Notify the UIProcess when it needs to tear down its layer hosting view, turn off
+        the background layer when not in accelerated rendering mode and don't swap out 
+        the web view unnecessarily 
+
+        * UIProcess/mac/WKFullScreenWindowController.mm:
+        (-[WKFullScreenWindowController beganExitFullScreenAnimation]): Check before swapping _webView.
+        (-[WKFullScreenWindowController enterAcceleratedCompositingMode:]): Add the _layerHostingView
+            to the full screen window's animationView, not its contentsView.
+        (-[WKFullScreenWindowController exitAcceleratedCompositingMode]): Hide the background layer.
+        * WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm:
+        (WebKit::WebFullScreenManagerMac::setRootFullScreenLayer): If given a null rootLayer, tell
+            the client to exit accelerated mode.
+
 2011-03-24  Enrica Casucci  <enrica@apple.com>
 
         Reviewed by Alexey Proskuryakov.
index 5f0e62d..91eeaf6 100644 (file)
@@ -238,7 +238,7 @@ using namespace WebCore;
     if (completed) {                
         // Swap the webView placeholder into place.
         if (!_webViewPlaceholder)
-            _webViewPlaceholder.adoptNS([[NSView alloc] init]);        
+            _webViewPlaceholder.adoptNS([[NSView alloc] init]);
         [self _swapView:_webView with:_webViewPlaceholder.get()];
         
         // Then insert the WebView into the full screen window
@@ -286,7 +286,8 @@ using namespace WebCore;
     [webWindow setCollectionBehavior:behavior];
     
     // Swap the webView back into its original position:
-    [self _swapView:_webViewPlaceholder.get() with:_webView];
+    if ([_webView window] == [self window])
+        [self _swapView:_webViewPlaceholder.get() with:_webView];
     
     [CATransaction begin];
     [CATransaction setAnimationDuration:[self _animationDuration]];
@@ -329,7 +330,8 @@ using namespace WebCore;
     
     [CATransaction begin];
     [CATransaction setDisableActions:YES];
-    [[[self window] contentView] addSubview:_layerHostingView.get()];
+    WKFullScreenWindow* window = [self _fullScreenWindow];
+    [[window animationView] addSubview:_layerHostingView.get()];
     
     // Create a root layer that will back the NSView.
     RetainPtr<CALayer> rootLayer(AdoptNS, [[CALayer alloc] init]);
@@ -342,7 +344,7 @@ using namespace WebCore;
     
     [_layerHostingView.get() setLayer:rootLayer.get()];
     [_layerHostingView.get() setWantsLayer:YES];
-    
+    [[window backgroundLayer] setHidden:NO];
     [CATransaction commit];
 }
 
@@ -351,9 +353,13 @@ using namespace WebCore;
     if (!_layerHostingView)
         return;
     
+    [CATransaction begin];
+    [CATransaction setDisableActions:YES];
     [_layerHostingView.get() removeFromSuperview];
     [_layerHostingView.get() setLayer:nil];
     [_layerHostingView.get() setWantsLayer:NO];
+    [[[self _fullScreenWindow] backgroundLayer] setHidden:YES];
+    [CATransaction commit];
     
     _layerHostingView = 0;
 }
index 4df8ff5..b5edc76 100644 (file)
@@ -136,6 +136,15 @@ void WebFullScreenManagerMac::setRootFullScreenLayer(WebCore::GraphicsLayer* lay
         return;
     m_fullScreenRootLayer = layer;
 
+    if (!m_fullScreenRootLayer) {
+        m_page->send(Messages::WebFullScreenManagerProxy::ExitAcceleratedCompositingMode());
+        if (m_rootLayer) {
+            m_rootLayer->removeAllChildren();
+            m_rootLayer = 0;
+        }
+        return;
+    }
+
     if (!m_rootLayer) {
         mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort();
         m_remoteLayerClient = WKCARemoteLayerClientMakeWithServerPort(serverPort);