Title: [116165] trunk
Revision
116165
Author
[email protected]
Date
2012-05-04 14:00:37 -0700 (Fri, 04 May 2012)

Log Message

Full screen will exit during a provisional load of a non-ancestor iframe.
https://bugs.webkit.org/show_bug.cgi?id=85230

Reviewed by Maciej Stachowiak .

Source/WebKit/mac:

Only exit full screen mode if the frame being loaded contains the full
screen element.

* WebView/WebView.mm:
(-[WebView _didStartProvisionalLoadForFrame:]): Give the UIDelegate a first crack at handling the
request to close the full screen window when a provisional load occurs.

Source/WebKit2:

Only exit full screen mode if the frame being loaded contains the full
screen element:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):

Move the full screen exiting logic up into WebFrameLoaderClient in the
WebProcess:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didStartProvisionalLoadForFrame):

Add a WebFullScreenManager "close" method & message:
* UIProcess/WebFullScreenManagerProxy.messages.in:
* WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::WebFullScreenManager::close):
* WebProcess/FullScreen/WebFullScreenManager.h:

Add support for this new message to the WKBundlePage and client:
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp:
(WebKit::InjectedBundlePageFullScreenClient::closeFullScreen):
* WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.h:

Tools:

Add support for the new UIDelegate webView:closeFullScreenWithListener: method:
* DumpRenderTree/mac/UIDelegate.mm:
(-[UIDelegate webView:closeFullScreenWithListener:]):

Add support for the new closeFullScreen injected bundle method:
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::InjectedBundlePage):
(WTR::InjectedBundlePage::closeFullScreen):
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:

LayoutTests:

* fullscreen/non-ancestor-iframe-expected.txt: Added.
* fullscreen/non-ancestor-iframe.html: Added.
* fullscreen/resources/empty.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (116164 => 116165)


--- trunk/LayoutTests/ChangeLog	2012-05-04 20:59:02 UTC (rev 116164)
+++ trunk/LayoutTests/ChangeLog	2012-05-04 21:00:37 UTC (rev 116165)
@@ -1,3 +1,14 @@
+2012-05-03  Jer Noble  <[email protected]>
+
+        Full screen will exit during a provisional load of a non-ancestor iframe.
+        https://bugs.webkit.org/show_bug.cgi?id=85230
+
+        Reviewed by Maciej Stachowiak .
+
+        * fullscreen/non-ancestor-iframe-expected.txt: Added.
+        * fullscreen/non-ancestor-iframe.html: Added.
+        * fullscreen/resources/empty.html: Added.
+
 2012-05-04  Christophe Dumez  <[email protected]>
 
         [soup] URL of the ResourceResponse passed to willSendRequest is incorrect

Added: trunk/LayoutTests/fullscreen/non-ancestor-iframe-expected.txt (0 => 116165)


--- trunk/LayoutTests/fullscreen/non-ancestor-iframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/non-ancestor-iframe-expected.txt	2012-05-04 21:00:37 UTC (rev 116165)
@@ -0,0 +1,7 @@
+This tests that full screen mode will not exit when a non-ancestor iframe is loaded in the page. Click enter full screen to start test.
+
+EVENT(webkitfullscreenchange)
+EVENT(load)
+EXPECTED (document.webkitIsFullScreen == 'true') OK
+END OF TEST
+

Added: trunk/LayoutTests/fullscreen/non-ancestor-iframe.html (0 => 116165)


--- trunk/LayoutTests/fullscreen/non-ancestor-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/non-ancestor-iframe.html	2012-05-04 21:00:37 UTC (rev 116165)
@@ -0,0 +1,28 @@
+<script src=""
+<div>This tests that full screen mode will not exit when a non-ancestor iframe is loaded in the page. Click <button _onclick_="startTest();">enter full screen</button> to start test.</div>
+<div id="target">
+    <iframe id="iframe"></iframe>
+</div>
+<script>
+    var target = document.getElementById('target');
+    var iframe = document.getElementById('iframe');
+
+    waitForEventOnce(document, 'webkitfullscreenchange', function() {
+        waitForEvent(document, 'webkitfullscreenchange', function() {
+           logResult(false, 'Exited full screen'); 
+        });
+        iframe.src = '';
+    });
+
+    waitForEvent(iframe, 'load', function() {
+        testExpected("document.webkitIsFullScreen", true);
+        endTest();
+    });
+
+    var startTest = function() {
+        target.webkitRequestFullscreen();
+    };
+
+    if (window.layoutTestController)
+        runWithKeyDown(startTest);
+</script>
\ No newline at end of file

Added: trunk/LayoutTests/fullscreen/resources/empty.html (0 => 116165)


--- trunk/LayoutTests/fullscreen/resources/empty.html	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/resources/empty.html	2012-05-04 21:00:37 UTC (rev 116165)
@@ -0,0 +1 @@
+<body></body>

Modified: trunk/Source/WebKit/mac/ChangeLog (116164 => 116165)


--- trunk/Source/WebKit/mac/ChangeLog	2012-05-04 20:59:02 UTC (rev 116164)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-05-04 21:00:37 UTC (rev 116165)
@@ -1,5 +1,19 @@
 2012-05-04  Jer Noble  <[email protected]>
 
+        Full screen will exit during a provisional load of a non-ancestor iframe.
+        https://bugs.webkit.org/show_bug.cgi?id=85230
+
+        Reviewed by Maciej Stachowiak .
+
+        Only exit full screen mode if the frame being loaded contains the full 
+        screen element.
+
+        * WebView/WebView.mm:
+        (-[WebView _didStartProvisionalLoadForFrame:]): Give the UIDelegate a first crack at handling the
+        request to close the full screen window when a provisional load occurs.
+
+2012-05-04  Jer Noble  <[email protected]>
+
         Move WebKitFullScreenListener into its own file.
         https://bugs.webkit.org/show_bug.cgi?id=85640
 

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (116164 => 116165)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2012-05-04 20:59:02 UTC (rev 116164)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2012-05-04 21:00:37 UTC (rev 116165)
@@ -32,6 +32,7 @@
 #import "WebViewData.h"
 
 #import "DOMCSSStyleDeclarationInternal.h"
+#import "DOMDocumentInternal.h"
 #import "DOMNodeInternal.h"
 #import "DOMRangeInternal.h"
 #import "WebAlternativeTextClient.h"
@@ -71,6 +72,7 @@
 #import "WebInspector.h"
 #import "WebInspectorClient.h"
 #import "WebKitErrors.h"
+#import "WebKitFullScreenListener.h"
 #import "WebKitLogging.h"
 #import "WebKitNSStringExtras.h"
 #import "WebKitStatisticsPrivate.h"
@@ -1851,8 +1853,16 @@
     [NSApp setWindowsNeedUpdate:YES];
 
 #if ENABLE(FULLSCREEN_API)
-    if (_private->newFullscreenController && [_private->newFullscreenController isFullScreen])
-        [_private->newFullscreenController close];
+    if (Element* element = core([frame DOMDocument])->webkitCurrentFullScreenElement()) {
+        SEL selector = @selector(webView:closeFullScreenWithListener:);
+        if (_private->UIDelegate && [_private->UIDelegate respondsToSelector:selector]) {
+            WebKitFullScreenListener *listener = [[WebKitFullScreenListener alloc] initWithElement:element];
+            CallUIDelegate(self, selector, listener);
+            [listener release];
+        } else if (_private->newFullscreenController && [_private->newFullscreenController isFullScreen]) {
+            [_private->newFullscreenController close];
+        }
+    }
 #endif
 }
 

Modified: trunk/Source/WebKit2/ChangeLog (116164 => 116165)


--- trunk/Source/WebKit2/ChangeLog	2012-05-04 20:59:02 UTC (rev 116164)
+++ trunk/Source/WebKit2/ChangeLog	2012-05-04 21:00:37 UTC (rev 116165)
@@ -1,3 +1,32 @@
+2012-04-30  Jer Noble  <[email protected]>
+
+        Full screen will exit during a provisional load of a non-ancestor iframe.
+        https://bugs.webkit.org/show_bug.cgi?id=85230
+
+        Reviewed by Maciej Stachowiak .
+
+        Only exit full screen mode if the frame being loaded contains the full 
+        screen element:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):
+
+        Move the full screen exiting logic up into WebFrameLoaderClient in the
+        WebProcess:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
+
+        Add a WebFullScreenManager "close" method & message:
+        * UIProcess/WebFullScreenManagerProxy.messages.in:
+        * WebProcess/FullScreen/WebFullScreenManager.cpp:
+        (WebKit::WebFullScreenManager::close):
+        * WebProcess/FullScreen/WebFullScreenManager.h:
+
+        Add support for this new message to the WKBundlePage and client:
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+        * WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp:
+        (WebKit::InjectedBundlePageFullScreenClient::closeFullScreen):
+        * WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.h:
+
 2012-05-04  Anders Carlsson  <[email protected]>
 
         TiledCoreAnimationDrawingArea should handle visibility changes

Modified: trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.messages.in (116164 => 116165)


--- trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.messages.in	2012-05-04 20:59:02 UTC (rev 116164)
+++ trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.messages.in	2012-05-04 21:00:37 UTC (rev 116165)
@@ -27,5 +27,6 @@
     ExitFullScreen()
     BeganEnterFullScreen(WebCore::IntRect initialRect, WebCore::IntRect finalRect)
     BeganExitFullScreen(WebCore::IntRect initialRect, WebCore::IntRect finalRect)
+    Close()
 }
 #endif

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (116164 => 116165)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-05-04 20:59:02 UTC (rev 116164)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-05-04 21:00:37 UTC (rev 116165)
@@ -1786,11 +1786,6 @@
 
     frame->didStartProvisionalLoad(url);
     m_loaderClient.didStartProvisionalLoadForFrame(this, frame, userData.get());
-
-#if ENABLE(FULLSCREEN_API)
-    if (m_fullScreenManager && m_fullScreenManager->isFullScreen())
-        m_fullScreenManager->close();
-#endif
 }
 
 void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String& url, CoreIPC::ArgumentDecoder* arguments)

Modified: trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp (116164 => 116165)


--- trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp	2012-05-04 20:59:02 UTC (rev 116164)
+++ trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp	2012-05-04 21:00:37 UTC (rev 116165)
@@ -146,6 +146,11 @@
     m_element->document()->webkitCancelFullScreen();
 }
 
+void WebFullScreenManager::close()
+{
+    m_page->injectedBundleFullScreenClient().closeFullScreen(m_page.get());
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(FULLSCREEN_API)

Modified: trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h (116164 => 116165)


--- trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h	2012-05-04 20:59:02 UTC (rev 116164)
+++ trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h	2012-05-04 21:00:37 UTC (rev 116165)
@@ -65,6 +65,8 @@
 
     WebCore::Element* element();
 
+    void close();
+
 protected:
     WebFullScreenManager(WebPage*);
 

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h (116164 => 116165)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h	2012-05-04 20:59:02 UTC (rev 116164)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h	2012-05-04 21:00:37 UTC (rev 116165)
@@ -322,6 +322,7 @@
 typedef void (*WKBundlePageExitFullScreenForElement)(WKBundlePageRef page, WKBundleNodeHandleRef element);
 typedef void (*WKBundlePageBeganEnterFullScreen)(WKBundlePageRef page, WKRect initialFrame, WKRect finalFrame);
 typedef void (*WKBundlePageBeganExitFullScreen)(WKBundlePageRef page, WKRect initialFrame, WKRect finalFrame);
+typedef void (*WKBundlePageCloseFullScreen)(WKBundlePageRef page);
 
 struct WKBundlePageFullScreenClient {
     int                                                                 version;
@@ -335,6 +336,7 @@
     // Version 1:
     WKBundlePageBeganEnterFullScreen                                    beganEnterFullScreen;
     WKBundlePageBeganExitFullScreen                                     beganExitFullScreen;
+    WKBundlePageCloseFullScreen                                         closeFullScreen;
 };
 typedef struct WKBundlePageFullScreenClient WKBundlePageFullScreenClient;
 

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp (116164 => 116165)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp	2012-05-04 20:59:02 UTC (rev 116164)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp	2012-05-04 21:00:37 UTC (rev 116165)
@@ -88,6 +88,14 @@
         page->send(Messages::WebFullScreenManagerProxy::BeganExitFullScreen(initialFrame, finalFrame));
 }
 
+void InjectedBundlePageFullScreenClient::closeFullScreen(WebPage *page)
+{
+    if (m_client.closeFullScreen)
+        m_client.closeFullScreen(toAPI(page));
+    else
+        page->send(Messages::WebFullScreenManagerProxy::Close());
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(FULLSCREEN_API)

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.h (116164 => 116165)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.h	2012-05-04 20:59:02 UTC (rev 116164)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.h	2012-05-04 21:00:37 UTC (rev 116165)
@@ -49,6 +49,7 @@
     void exitFullScreenForElement(WebPage*, WebCore::Element*);
     void beganEnterFullScreen(WebPage*, WebCore::IntRect& initialFrame, WebCore::IntRect& finalFrame);
     void beganExitFullScreen(WebPage*, WebCore::IntRect& initialFrame, WebCore::IntRect& finalFrame);
+    void closeFullScreen(WebPage*);
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (116164 => 116165)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2012-05-04 20:59:02 UTC (rev 116164)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2012-05-04 21:00:37 UTC (rev 116165)
@@ -43,6 +43,7 @@
 #include "WebEvent.h"
 #include "WebFrame.h"
 #include "WebFrameNetworkingContext.h"
+#include "WebFullScreenManager.h"
 #include "WebNavigationDataStore.h"
 #include "WebPage.h"
 #include "WebPageProxyMessages.h"
@@ -390,6 +391,11 @@
     if (!webPage)
         return;
 
+#if ENABLE(FULLSCREEN_API)
+    if (m_frame->coreFrame()->document()->webkitIsFullScreen())
+        webPage->fullScreenManager()->close();
+#endif
+
     webPage->findController().hideFindUI();
     webPage->sandboxExtensionTracker().didStartProvisionalLoad(m_frame);
 

Modified: trunk/Tools/ChangeLog (116164 => 116165)


--- trunk/Tools/ChangeLog	2012-05-04 20:59:02 UTC (rev 116164)
+++ trunk/Tools/ChangeLog	2012-05-04 21:00:37 UTC (rev 116165)
@@ -1,3 +1,20 @@
+2012-04-30  Jer Noble  <[email protected]>
+
+        Full screen will exit during a provisional load of a non-ancestor iframe.
+        https://bugs.webkit.org/show_bug.cgi?id=85230
+
+        Reviewed by Maciej Stachowiak .
+
+        Add support for the new UIDelegate webView:closeFullScreenWithListener: method:
+        * DumpRenderTree/mac/UIDelegate.mm:
+        (-[UIDelegate webView:closeFullScreenWithListener:]):
+
+        Add support for the new closeFullScreen injected bundle method:
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::InjectedBundlePage):
+        (WTR::InjectedBundlePage::closeFullScreen):
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
+
 2012-05-04  Ojan Vafai  <[email protected]>
 
         Fix test naming to be camel-case like the methods they are testing.

Modified: trunk/Tools/DumpRenderTree/mac/UIDelegate.mm (116164 => 116165)


--- trunk/Tools/DumpRenderTree/mac/UIDelegate.mm	2012-05-04 20:59:02 UTC (rev 116164)
+++ trunk/Tools/DumpRenderTree/mac/UIDelegate.mm	2012-05-04 21:00:37 UTC (rev 116165)
@@ -276,6 +276,12 @@
         [self performSelector:@selector(exitFullScreenWithListener:) withObject:listener afterDelay:0];
 }
 
+- (void)webView:(WebView *)sender closeFullScreenWithListener:(NSObject<WebKitFullScreenListener>*)listener
+{
+    [listener webkitWillExitFullScreen];
+    [listener webkitDidExitFullScreen];
+}
+
 - (BOOL)webView:(WebView *)webView didPressMissingPluginButton:(DOMElement *)element
 {
     printf("MISSING PLUGIN BUTTON PRESSED\n");

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (116164 => 116165)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-05-04 20:59:02 UTC (rev 116164)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-05-04 21:00:37 UTC (rev 116165)
@@ -313,6 +313,7 @@
         exitFullScreenForElement,
         beganEnterFullScreen,
         beganExitFullScreen,
+        closeFullScreen,
     };
     WKBundlePageSetFullScreenClient(m_page, &fullScreenClient);
 #endif
@@ -1243,6 +1244,17 @@
     if (InjectedBundle::shared().layoutTestController()->shouldDumpFullScreenCallbacks())
         InjectedBundle::shared().stringBuilder()->append("beganExitFullScreen()\n");
 }
+
+void InjectedBundlePage::closeFullScreen(WKBundlePageRef pageRef)
+{
+    if (InjectedBundle::shared().layoutTestController()->shouldDumpFullScreenCallbacks())
+        InjectedBundle::shared().stringBuilder()->append("closeFullScreen()\n");
+
+    if (!InjectedBundle::shared().layoutTestController()->hasCustomFullScreenBehavior()) {
+        WKBundlePageWillExitFullScreen(pageRef);
+        WKBundlePageDidExitFullScreen(pageRef);
+    }
+}
 #endif
 
 static bool compareByTargetName(WKBundleBackForwardListItemRef item1, WKBundleBackForwardListItemRef item2)

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h (116164 => 116165)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h	2012-05-04 20:59:02 UTC (rev 116164)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h	2012-05-04 21:00:37 UTC (rev 116165)
@@ -126,6 +126,7 @@
     static void exitFullScreenForElement(WKBundlePageRef, WKBundleNodeHandleRef element);
     static void beganEnterFullScreen(WKBundlePageRef, WKRect initialFrame, WKRect finalFrame);
     static void beganExitFullScreen(WKBundlePageRef, WKRect initialFrame, WKRect finalFrame);
+    static void closeFullScreen(WKBundlePageRef);
 #endif
 
     // Editor client
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to