A page should exit fullscreen mode if it opens a new popup
authorjochen@chromium.org <jochen@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Oct 2013 22:20:13 +0000 (22:20 +0000)
committerjochen@chromium.org <jochen@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Oct 2013 22:20:13 +0000 (22:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122865

Reviewed by Jer Noble.

Source/WebKit/blackberry:

If a fullscreen page opens a popup, the popup would be hidden and
therefore invisible to the user. To avoid this, exit fullscreen mode
before opening a new window.

* WebCoreSupport/ChromeClientBlackBerry.cpp:
(WebCore::ChromeClientBlackBerry::createWindow):

Source/WebKit/efl:

If a fullscreen page opens a popup, the popup would be hidden and
therefore invisible to the user. To avoid this, exit fullscreen mode
before opening a new window.

* WebCoreSupport/ChromeClientEfl.cpp:
(WebCore::ChromeClientEfl::createWindow):

Source/WebKit/gtk:

If a fullscreen page opens a popup, the popup would be hidden and
therefore invisible to the user. To avoid this, exit fullscreen mode
before opening a new window.

* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::createWindow):

Source/WebKit/mac:

If a fullscreen page opens a popup, the popup would be hidden and
therefore invisible to the user. To avoid this, exit fullscreen mode
before opening a new window.

* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::createWindow):

Source/WebKit/win:

If a fullscreen page opens a popup, the popup would be hidden and
therefore invisible to the user. To avoid this, exit fullscreen mode
before opening a new window.

* WebCoreSupport/WebChromeClient.cpp:
(WebChromeClient::createWindow):

Source/WebKit2:

If a fullscreen page opens a popup, the popup would be hidden and
therefore invisible to the user. To avoid this, exit fullscreen mode
before opening a new window.

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createWindow):

LayoutTests:

* fullscreen/full-screen-exit-when-popup-expected.txt: Added.
* fullscreen/full-screen-exit-when-popup.html: Added.

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

15 files changed:
LayoutTests/ChangeLog
LayoutTests/fullscreen/full-screen-exit-when-popup-expected.txt [new file with mode: 0644]
LayoutTests/fullscreen/full-screen-exit-when-popup.html [new file with mode: 0644]
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

index 99064a3..d4c65d5 100644 (file)
@@ -1,3 +1,13 @@
+2013-10-16  Jochen Eisinger  <jochen@chromium.org>
+
+        A page should exit fullscreen mode if it opens a new popup
+        https://bugs.webkit.org/show_bug.cgi?id=122865
+
+        Reviewed by Jer Noble.
+
+        * fullscreen/full-screen-exit-when-popup-expected.txt: Added.
+        * fullscreen/full-screen-exit-when-popup.html: Added.
+
 2013-10-16  Oliver Hunt  <oliver@apple.com>
 
         Implement spread
diff --git a/LayoutTests/fullscreen/full-screen-exit-when-popup-expected.txt b/LayoutTests/fullscreen/full-screen-exit-when-popup-expected.txt
new file mode 100644 (file)
index 0000000..766a872
--- /dev/null
@@ -0,0 +1,9 @@
+EVENT(webkitfullscreenchange)
+EXPECTED (document.webkitIsFullScreen == 'true') OK
+EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLSpanElement]') OK
+EXPECTED (window.open('about:blank') != 'null') OK
+EVENT(webkitfullscreenchange)
+EXPECTED (document.webkitIsFullScreen == 'false') OK
+EXPECTED (document.webkitCurrentFullScreenElement == 'undefined') OK
+END OF TEST
+
diff --git a/LayoutTests/fullscreen/full-screen-exit-when-popup.html b/LayoutTests/fullscreen/full-screen-exit-when-popup.html
new file mode 100644 (file)
index 0000000..f21e981
--- /dev/null
@@ -0,0 +1,40 @@
+<body>
+<script src="full-screen-test.js"></script>
+<span></span>
+<script>
+    // Bail out early if the full screen API is not enabled or is missing:
+    if (Element.prototype.webkitRequestFullScreen == undefined) {
+        logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
+        endTest();
+    } else {
+        if (window.testRunner) {
+            testRunner.setCanOpenWindows(true);
+            testRunner.setCloseRemainingWindowsWhenComplete(true);
+        }
+        var callback;
+        var fullscreenChanged = function(event)
+        {
+            if (callback)
+                callback(event)
+        };
+        waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
+
+        var spanEnteredFullScreen = function() {
+            testExpected("document.webkitIsFullScreen", true);
+            testExpected("document.webkitCurrentFullScreenElement", span);
+            callback = cancelledFullScreen;
+            testExpected("window.open('about:blank')", null, "!=");
+        };
+
+        var cancelledFullScreen = function() {
+            testExpected("document.webkitIsFullScreen", false);
+            testExpected("document.webkitCurrentFullScreenElement", undefined);
+            endTest();
+        };
+
+        var span = document.getElementsByTagName('span')[0];
+
+        callback = spanEnteredFullScreen;
+        runWithKeyDown(function(){span.webkitRequestFullScreen()});
+    }
+</script>
index 225ac82..64bccc4 100644 (file)
@@ -1,3 +1,17 @@
+2013-10-16  Jochen Eisinger  <jochen@chromium.org>
+
+        A page should exit fullscreen mode if it opens a new popup
+        https://bugs.webkit.org/show_bug.cgi?id=122865
+
+        Reviewed by Jer Noble.
+
+        If a fullscreen page opens a popup, the popup would be hidden and
+        therefore invisible to the user. To avoid this, exit fullscreen mode
+        before opening a new window.
+
+        * WebCoreSupport/ChromeClientBlackBerry.cpp:
+        (WebCore::ChromeClientBlackBerry::createWindow):
+
 2013-10-13  Darin Adler  <darin@apple.com>
 
         Deprecate or remove deleteAllValues functions; there are only a few call sites left
index 71c72d8..bc87cf7 100644 (file)
@@ -233,6 +233,11 @@ Page* ChromeClientBlackBerry::createWindow(Frame* frame, const FrameLoadRequest&
         return 0;
 #endif
 
+#if ENABLE(FULLSCREEN_API)
+    if (Element* element = frame->document() ? frame->document()->webkitCurrentFullScreenElement() : 0)
+        frame->document()->webkitCancelFullScreen();
+#endif
+
     int x = features.xSet ? features.x : 0;
     int y = features.ySet ? features.y : 0;
     int width = features.widthSet? features.width : -1;
index 73900d5..f8f09d9 100644 (file)
@@ -1,3 +1,17 @@
+2013-10-16  Jochen Eisinger  <jochen@chromium.org>
+
+        A page should exit fullscreen mode if it opens a new popup
+        https://bugs.webkit.org/show_bug.cgi?id=122865
+
+        Reviewed by Jer Noble.
+
+        If a fullscreen page opens a popup, the popup would be hidden and
+        therefore invisible to the user. To avoid this, exit fullscreen mode
+        before opening a new window.
+
+        * WebCoreSupport/ChromeClientEfl.cpp:
+        (WebCore::ChromeClientEfl::createWindow):
+
 2013-10-07  Sam Weinig  <sam@webkit.org>
 
         Consolidate findString functions
index 1564f71..0bb72d2 100644 (file)
@@ -150,8 +150,13 @@ void ChromeClientEfl::unfocus()
     evas_object_focus_set(m_view, EINA_FALSE);
 }
 
-Page* ChromeClientEfl::createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures& features, const NavigationAction&)
+Page* ChromeClientEfl::createWindow(Frame* frame, const FrameLoadRequest&, const WindowFeatures& features, const NavigationAction&)
 {
+#if ENABLE(FULLSCREEN_API)
+    if (frame->document() && frame->document()->webkitCurrentFullScreenElement())
+        frame->document()->webkitCancelFullScreen();
+#endif
+
     Evas_Object* newView = ewk_view_window_create(m_view, EINA_TRUE, &features);
     if (!newView)
         return 0;
index dc11512..fa825e7 100644 (file)
@@ -1,3 +1,17 @@
+2013-10-16  Jochen Eisinger  <jochen@chromium.org>
+
+        A page should exit fullscreen mode if it opens a new popup
+        https://bugs.webkit.org/show_bug.cgi?id=122865
+
+        Reviewed by Jer Noble.
+
+        If a fullscreen page opens a popup, the popup would be hidden and
+        therefore invisible to the user. To avoid this, exit fullscreen mode
+        before opening a new window.
+
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::createWindow):
+
 2013-10-09  Mario Sanchez Prada  <mario.prada@samsung.com>
 
         [ATK] Implement new API in AtkText: atk_text_get_string_at_offset()
index f69b46b..e4b1b5e 100644 (file)
@@ -204,6 +204,11 @@ Page* ChromeClient::createWindow(Frame* frame, const FrameLoadRequest& frameLoad
 {
     WebKitWebView* webView = 0;
 
+#if ENABLE(FULLSCREEN_API)
+    if (frame->document() && frame->document()->webkitCurrentFullScreenElement())
+        frame->document()->webkitCancelFullScreen();
+#endif
+
     g_signal_emit_by_name(m_webView, "create-web-view", kit(frame), &webView);
 
     if (!webView)
index 1815b31..0ee3bed 100644 (file)
@@ -1,3 +1,17 @@
+2013-10-16  Jochen Eisinger  <jochen@chromium.org>
+
+        A page should exit fullscreen mode if it opens a new popup
+        https://bugs.webkit.org/show_bug.cgi?id=122865
+
+        Reviewed by Jer Noble.
+
+        If a fullscreen page opens a popup, the popup would be hidden and
+        therefore invisible to the user. To avoid this, exit fullscreen mode
+        before opening a new window.
+
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::createWindow):
+
 2013-10-15  Dean Jackson  <dino@apple.com>
 
         Add ENABLE_WEB_ANIMATIONS flag
index 91bf38f..0e996ad 100644 (file)
@@ -219,6 +219,11 @@ Page* WebChromeClient::createWindow(Frame* frame, const FrameLoadRequest&, const
 {
     id delegate = [m_webView UIDelegate];
     WebView *newWebView;
+
+#if ENABLE(FULLSCREEN_API)
+    if (frame->document() && frame->document()->webkitCurrentFullScreenElement())
+        frame->document()->webkitCancelFullScreen();
+#endif
     
     if ([delegate respondsToSelector:@selector(webView:createWebViewWithRequest:windowFeatures:)]) {
         NSNumber *x = features.xSet ? [[NSNumber alloc] initWithFloat:features.x] : nil;
index 33e68fc..bf380f6 100644 (file)
@@ -1,3 +1,17 @@
+2013-10-16  Jochen Eisinger  <jochen@chromium.org>
+
+        A page should exit fullscreen mode if it opens a new popup
+        https://bugs.webkit.org/show_bug.cgi?id=122865
+
+        Reviewed by Jer Noble.
+
+        If a fullscreen page opens a popup, the popup would be hidden and
+        therefore invisible to the user. To avoid this, exit fullscreen mode
+        before opening a new window.
+
+        * WebCoreSupport/WebChromeClient.cpp:
+        (WebChromeClient::createWindow):
+
 2013-10-15  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Remove Windows old front-end related code
index e1e9446..1f4e9a9 100644 (file)
@@ -194,12 +194,17 @@ static COMPtr<IPropertyBag> createWindowFeaturesPropertyBag(const WindowFeatures
     return COMPtr<IPropertyBag>(AdoptCOM, COMPropertyBag<COMVariant>::adopt(map));
 }
 
-Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures& features, const NavigationAction& navigationAction)
+Page* WebChromeClient::createWindow(Frame* frame, const FrameLoadRequest&, const WindowFeatures& features, const NavigationAction& navigationAction)
 {
     COMPtr<IWebUIDelegate> delegate = uiDelegate();
     if (!delegate)
         return 0;
 
+#if ENABLE(FULLSCREEN_API)
+    if (frame->document() && frame->document()->webkitCurrentFullScreenElement())
+        frame->document()->webkitCancelFullScreen();
+#endif
+
     COMPtr<WebMutableURLRequest> request = adoptCOM(WebMutableURLRequest::createInstance(ResourceRequest(navigationAction.url())));
 
     COMPtr<IWebUIDelegatePrivate2> delegatePrivate(Query, delegate);
index df3964f..6302dea 100644 (file)
@@ -1,3 +1,17 @@
+2013-10-16  Jochen Eisinger  <jochen@chromium.org>
+
+        A page should exit fullscreen mode if it opens a new popup
+        https://bugs.webkit.org/show_bug.cgi?id=122865
+
+        Reviewed by Jer Noble.
+
+        If a fullscreen page opens a popup, the popup would be hidden and
+        therefore invisible to the user. To avoid this, exit fullscreen mode
+        before opening a new window.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::createWindow):
+
 2013-10-16  Brady Eidson  <beidson@apple.com>
 
         Blind attempt to fix non-DATABASE_PROCESS builds.
index d48189d..f2542e0 100644 (file)
@@ -185,11 +185,16 @@ void WebChromeClient::focusedFrameChanged(Frame* frame)
     WebProcess::shared().parentProcessConnection()->send(Messages::WebPageProxy::FocusedFrameChanged(webFrame ? webFrame->frameID() : 0), m_page->pageID());
 }
 
-Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest& request, const WindowFeatures& windowFeatures, const NavigationAction& navigationAction)
+Page* WebChromeClient::createWindow(Frame* frame, const FrameLoadRequest& request, const WindowFeatures& windowFeatures, const NavigationAction& navigationAction)
 {
     uint32_t modifiers = static_cast<uint32_t>(InjectedBundleNavigationAction::modifiersForNavigationAction(navigationAction));
     int32_t mouseButton = static_cast<int32_t>(InjectedBundleNavigationAction::mouseButtonForNavigationAction(navigationAction));
 
+#if ENABLE(FULLSCREEN_API)
+    if (frame->document() && frame->document()->webkitCurrentFullScreenElement())
+        frame->document()->webkitCancelFullScreen();
+#endif
+
     uint64_t newPageID = 0;
     WebPageCreationParameters parameters;
     if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::CreateNewPage(request.resourceRequest(), windowFeatures, modifiers, mouseButton), Messages::WebPageProxy::CreateNewPage::Reply(newPageID, parameters), m_page->pageID()))