Title: [113238] trunk/Source
Revision
113238
Author
jer.no...@apple.com
Date
2012-04-04 14:11:14 -0700 (Wed, 04 Apr 2012)

Log Message

Full Screen mode should cancel before navigation.
https://bugs.webkit.org/show_bug.cgi?id=81295

Reviewed by Anders Carlsson.

Source/WebCore:

No new tests; protect against speculative crasher when a bad client calls the below
functions at inopportune times.

Check that the document is not either detached or in the page cache, and if so, bail out
early:
* dom/Document.cpp:
(WebCore::Document::webkitWillEnterFullScreenForElement):
(WebCore::Document::webkitDidEnterFullScreenForElement):
(WebCore::Document::webkitWillExitFullScreenForElement):
(WebCore::Document::webkitDidExitFullScreenForElement):

Source/WebKit/mac:

When a provisional load is started, if the page is currently in full screen mode, instruct
the full screen controller to close the full screen window immediately.

* WebView/WebFullScreenController.h:
* WebView/WebFullScreenController.mm:
(-[WebFullScreenController isFullScreen]): Added.
* WebView/WebView.mm:
(-[WebView _didStartProvisionalLoadForFrame:]): Close the full screen window controller, if
    present and in full screen mode.

Source/WebKit2:

When a provisional load is started, if the page is currently in full screen mode, instruct
the full screen controller to close the full screen window immediately.

Close the full screen window controller, if present and in full screen mode:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didStartProvisionalLoadForFrame):

Add boilerplate to support passing through isFullScreen() and close() methods from the WebPageProxy
to the WKFullScreenWindowController:
* UIProcess/WebFullScreenManagerProxy.h:
* UIProcess/mac/WKFullScreenWindowController.h:
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController isFullScreen]): Added simple accessor.
* UIProcess/mac/WebFullScreenManagerProxyMac.mm:
(WebKit::WebFullScreenManagerProxy::close): Pass through to the WKFullScreenWindowController.
(WebKit::WebFullScreenManagerProxy::isFullScreen): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113237 => 113238)


--- trunk/Source/WebCore/ChangeLog	2012-04-04 21:06:15 UTC (rev 113237)
+++ trunk/Source/WebCore/ChangeLog	2012-04-04 21:11:14 UTC (rev 113238)
@@ -1,3 +1,21 @@
+2012-03-15  Jer Noble  <jer.no...@apple.com>
+
+        Full Screen mode should cancel before navigation.
+        https://bugs.webkit.org/show_bug.cgi?id=81295
+
+        Reviewed by Anders Carlsson.
+
+        No new tests; protect against speculative crasher when a bad client calls the below
+        functions at inopportune times.
+
+        Check that the document is not either detached or in the page cache, and if so, bail out
+        early:
+        * dom/Document.cpp:
+        (WebCore::Document::webkitWillEnterFullScreenForElement):
+        (WebCore::Document::webkitDidEnterFullScreenForElement):
+        (WebCore::Document::webkitWillExitFullScreenForElement):
+        (WebCore::Document::webkitDidExitFullScreenForElement):
+
 2012-04-04  Emil A Eklund  <e...@chromium.org>
 
         Fix getFilterOutsets parameter types in RenderLayer

Modified: trunk/Source/WebCore/dom/Document.cpp (113237 => 113238)


--- trunk/Source/WebCore/dom/Document.cpp	2012-04-04 21:06:15 UTC (rev 113237)
+++ trunk/Source/WebCore/dom/Document.cpp	2012-04-04 21:11:14 UTC (rev 113238)
@@ -5378,6 +5378,9 @@
 
 void Document::webkitWillEnterFullScreenForElement(Element* element)
 {
+    if (!attached() || inPageCache())
+        return;
+
     ASSERT(element);
 
     // Protect against being called after the document has been removed from the page.
@@ -5414,7 +5417,10 @@
 {
     if (!m_fullScreenElement)
         return;
-    
+
+    if (!attached() || inPageCache())
+        return;
+
     m_fullScreenElement->didBecomeFullscreenElement();
 
     m_fullScreenChangeDelayTimer.startOneShot(0);
@@ -5425,6 +5431,9 @@
     if (!m_fullScreenElement)
         return;
 
+    if (!attached() || inPageCache())
+        return;
+
     m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
     
     m_fullScreenElement->willStopBeingFullscreenElement();
@@ -5432,6 +5441,9 @@
 
 void Document::webkitDidExitFullScreenForElement(Element*)
 {
+    if (!attached() || inPageCache())
+        return;
+
     m_areKeysEnabledInFullScreen = false;
     
     if (m_fullScreenRenderer)

Modified: trunk/Source/WebKit/mac/ChangeLog (113237 => 113238)


--- trunk/Source/WebKit/mac/ChangeLog	2012-04-04 21:06:15 UTC (rev 113237)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-04-04 21:11:14 UTC (rev 113238)
@@ -1,3 +1,20 @@
+2012-03-15  Jer Noble  <jer.no...@apple.com>
+
+        Full Screen mode should cancel before navigation.
+        https://bugs.webkit.org/show_bug.cgi?id=81295
+
+        Reviewed by Anders Carlsson.
+
+        When a provisional load is started, if the page is currently in full screen mode, instruct
+        the full screen controller to close the full screen window immediately.
+
+        * WebView/WebFullScreenController.h:
+        * WebView/WebFullScreenController.mm:
+        (-[WebFullScreenController isFullScreen]): Added.
+        * WebView/WebView.mm:
+        (-[WebView _didStartProvisionalLoadForFrame:]): Close the full screen window controller, if
+            present and in full screen mode.
+
 2012-04-03  Keishi Hattori  <kei...@webkit.org>
 
         Disable ENABLE_DATALIST for now

Modified: trunk/Source/WebKit/mac/WebView/WebFullScreenController.h (113237 => 113238)


--- trunk/Source/WebKit/mac/WebView/WebFullScreenController.h	2012-04-04 21:06:15 UTC (rev 113237)
+++ trunk/Source/WebKit/mac/WebView/WebFullScreenController.h	2012-04-04 21:11:14 UTC (rev 113238)
@@ -59,6 +59,8 @@
 - (WebView*)webView;
 - (void)setWebView:(WebView*)webView;
 
+- (BOOL)isFullScreen;
+
 - (void)setElement:(PassRefPtr<WebCore::Element>)element;
 - (WebCore::Element*)element;
 

Modified: trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm (113237 => 113238)


--- trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm	2012-04-04 21:06:15 UTC (rev 113237)
+++ trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm	2012-04-04 21:11:14 UTC (rev 113238)
@@ -150,6 +150,11 @@
     _element = element;
 }
 
+- (BOOL)isFullScreen
+{
+    return _isFullScreen;
+}
+
 #pragma mark -
 #pragma mark NSWindowController overrides
 

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (113237 => 113238)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2012-04-04 21:06:15 UTC (rev 113237)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2012-04-04 21:11:14 UTC (rev 113238)
@@ -1831,6 +1831,11 @@
     }
 
     [NSApp setWindowsNeedUpdate:YES];
+
+#if ENABLE(FULLSCREEN_API)
+    if (_private->newFullscreenController && [_private->newFullscreenController isFullScreen])
+        [_private->newFullscreenController close];
+#endif
 }
 
 - (void)_didCommitLoadForFrame:(WebFrame *)frame

Modified: trunk/Source/WebKit2/ChangeLog (113237 => 113238)


--- trunk/Source/WebKit2/ChangeLog	2012-04-04 21:06:15 UTC (rev 113237)
+++ trunk/Source/WebKit2/ChangeLog	2012-04-04 21:11:14 UTC (rev 113238)
@@ -1,3 +1,27 @@
+2012-03-15  Jer Noble  <jer.no...@apple.com>
+
+        Full Screen mode should cancel before navigation.
+        https://bugs.webkit.org/show_bug.cgi?id=81295
+
+        Reviewed by Anders Carlsson.
+
+        When a provisional load is started, if the page is currently in full screen mode, instruct
+        the full screen controller to close the full screen window immediately.
+
+        Close the full screen window controller, if present and in full screen mode:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): 
+
+        Add boilerplate to support passing through isFullScreen() and close() methods from the WebPageProxy
+        to the WKFullScreenWindowController:
+        * UIProcess/WebFullScreenManagerProxy.h:
+        * UIProcess/mac/WKFullScreenWindowController.h:
+        * UIProcess/mac/WKFullScreenWindowController.mm:
+        (-[WKFullScreenWindowController isFullScreen]): Added simple accessor.
+        * UIProcess/mac/WebFullScreenManagerProxyMac.mm:
+        (WebKit::WebFullScreenManagerProxy::close): Pass through to the WKFullScreenWindowController.
+        (WebKit::WebFullScreenManagerProxy::isFullScreen): Ditto.
+
 2012-04-04  Jesus Sanchez-Palencia  <jesus.palen...@openbossa.org>
 
         WKTR needs to implement layoutTestController.setPageVisibility()

Modified: trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h (113237 => 113238)


--- trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h	2012-04-04 21:06:15 UTC (rev 113237)
+++ trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h	2012-04-04 21:11:14 UTC (rev 113238)
@@ -73,6 +73,8 @@
     void invalidate();
 
     void setWebView(PlatformWebView*);
+    bool isFullScreen();
+    void close();
 
     void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
     void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (113237 => 113238)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-04-04 21:06:15 UTC (rev 113237)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-04-04 21:11:14 UTC (rev 113238)
@@ -1779,6 +1779,11 @@
 
     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/UIProcess/gtk/WebFullScreenManagerProxyGtk.cpp (113237 => 113238)


--- trunk/Source/WebKit2/UIProcess/gtk/WebFullScreenManagerProxyGtk.cpp	2012-04-04 21:06:15 UTC (rev 113237)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebFullScreenManagerProxyGtk.cpp	2012-04-04 21:11:14 UTC (rev 113238)
@@ -38,6 +38,17 @@
     m_webView = 0;
 }
 
+void WebFullScreenManagerProxy::close()
+{
+    notImplemented();
+}
+
+bool WebFullScreenManagerProxy::isFullScreen()
+{
+    notImplemented();
+    return false;
+}
+
 void WebFullScreenManagerProxy::enterFullScreen()
 {
     if (!m_webView)

Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h (113237 => 113238)


--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h	2012-04-04 21:06:15 UTC (rev 113237)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h	2012-04-04 21:11:14 UTC (rev 113238)
@@ -61,6 +61,8 @@
 - (WKView*)webView;
 - (void)setWebView:(WKView*)webView;
 
+- (BOOL)isFullScreen;
+
 - (void)enterFullScreen:(NSScreen *)screen;
 - (void)exitFullScreen;
 - (void)close;

Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm (113237 => 113238)


--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2012-04-04 21:06:15 UTC (rev 113237)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2012-04-04 21:11:14 UTC (rev 113238)
@@ -131,6 +131,11 @@
     _webView = webView;
 }
 
+- (BOOL)isFullScreen
+{
+    return _isFullScreen;
+}
+
 #pragma mark -
 #pragma mark NSWindowController overrides
 

Modified: trunk/Source/WebKit2/UIProcess/mac/WebFullScreenManagerProxyMac.mm (113237 => 113238)


--- trunk/Source/WebKit2/UIProcess/mac/WebFullScreenManagerProxyMac.mm	2012-04-04 21:06:15 UTC (rev 113237)
+++ trunk/Source/WebKit2/UIProcess/mac/WebFullScreenManagerProxyMac.mm	2012-04-04 21:11:14 UTC (rev 113238)
@@ -46,6 +46,20 @@
     m_webView = 0;
 }
 
+void WebFullScreenManagerProxy::close()
+{
+    if (!m_webView)
+        return;
+    [[m_webView fullScreenWindowController] close];
+}
+
+bool WebFullScreenManagerProxy::isFullScreen()
+{
+    if (!m_webView)
+        return false;
+    return [[m_webView fullScreenWindowController] isFullScreen];
+}
+
 void WebFullScreenManagerProxy::enterFullScreen()
 {
     if (!m_webView)

Modified: trunk/Source/WebKit2/UIProcess/qt/WebFullScreenManagerProxyQt.cpp (113237 => 113238)


--- trunk/Source/WebKit2/UIProcess/qt/WebFullScreenManagerProxyQt.cpp	2012-04-04 21:06:15 UTC (rev 113237)
+++ trunk/Source/WebKit2/UIProcess/qt/WebFullScreenManagerProxyQt.cpp	2012-04-04 21:11:14 UTC (rev 113238)
@@ -38,6 +38,17 @@
     m_webView = 0;
 }
 
+void WebFullScreenManagerProxy::close()
+{
+    notImplemented();
+}
+
+bool WebFullScreenManagerProxy::isFullScreen()
+{
+    notImplemented();
+    return false;
+}
+
 void WebFullScreenManagerProxy::enterFullScreen()
 {
     notImplemented();

Modified: trunk/Source/WebKit2/UIProcess/win/WebFullScreenManagerProxyWin.cpp (113237 => 113238)


--- trunk/Source/WebKit2/UIProcess/win/WebFullScreenManagerProxyWin.cpp	2012-04-04 21:06:15 UTC (rev 113237)
+++ trunk/Source/WebKit2/UIProcess/win/WebFullScreenManagerProxyWin.cpp	2012-04-04 21:11:14 UTC (rev 113238)
@@ -45,6 +45,18 @@
     m_webView = 0;
 }
 
+void WebFullScreenManagerProxy::close()
+{
+    if (!m_webView)
+        return;
+    m_webView->fullScreenController()->close();
+}
+
+bool WebFullScreenManagerProxy::isFullScreen()
+{
+    return m_webView->fullScreenController()->isFullScreen();
+}
+
 void WebFullScreenManagerProxy::enterFullScreen()
 {
     if (!m_webView)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to