Title: [113056] trunk/Source
Revision
113056
Author
jer.no...@apple.com
Date
2012-04-03 10:33:50 -0700 (Tue, 03 Apr 2012)

Log Message

ESC key in full screen does not result in webkitFullScreenChange event.
https://bugs.webkit.org/show_bug.cgi?id=82755
<rdar://problem/11093513>

Reviewed by Eric Carlson.

Source/WebCore:

* WebCore.exp.in: Export the WebCore::Document::webkitCancelFullScreen() symbol.

Source/WebKit/mac:

Instead of exiting full screen directly, ask the document to initiate exiting full screen. This ensures
that the entire full screen element stack is cleared and that webkitFullScreenChange events are sent
out correctly.

* WebView/WebFullScreenController.mm:
(-[WebFullScreenController cancelOperation:]):
(-[WebFullScreenController requestExitFullScreen]):

Source/WebKit2:

Instead of exiting full screen directly, ask the document to initiate exiting full screen. This ensures
that the entire full screen element stack is cleared and that webkitFullScreenChange events are sent
out correctly.

Because the WebProcess may be stalled or hung, add a watchdog timer which will force an exit of full
screen if the WebProcess does not respond in a timely manner (defaults to 1s).

Add a new method, requestExitFullScreen, which calls through to the WebProcess and Document:
* UIProcess/WebFullScreenManagerProxy.cpp:
(WebKit::WebFullScreenManagerProxy::requestExitFullScreen):
* UIProcess/WebFullScreenManagerProxy.h:
* WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::WebFullScreenManager::requestExitFullScreen):
* WebProcess/FullScreen/WebFullScreenManager.h:
* WebProcess/FullScreen/WebFullScreenManager.messages.in:

Request that the document exits full screen when the ESC key is pressed:
* UIProcess/mac/WKFullScreenWindowController.h:
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController cancelOperation:]):
(-[WKFullScreenWindowController exitFullScreen]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113055 => 113056)


--- trunk/Source/WebCore/ChangeLog	2012-04-03 17:31:59 UTC (rev 113055)
+++ trunk/Source/WebCore/ChangeLog	2012-04-03 17:33:50 UTC (rev 113056)
@@ -1,3 +1,13 @@
+2012-04-03  Jer Noble  <jer.no...@apple.com>
+
+        ESC key in full screen does not result in webkitFullScreenChange event.
+        https://bugs.webkit.org/show_bug.cgi?id=82755
+        <rdar://problem/11093513>
+
+        Reviewed by Eric Carlson.
+
+        * WebCore.exp.in: Export the WebCore::Document::webkitCancelFullScreen() symbol.
+
 2012-04-03  Ryosuke Niwa  <rn...@webkit.org>
 
         REGRESSION(r80439): Crash in StylePropertySet::borderSpacingValue

Modified: trunk/Source/WebCore/WebCore.exp.in (113055 => 113056)


--- trunk/Source/WebCore/WebCore.exp.in	2012-04-03 17:31:59 UTC (rev 113055)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-04-03 17:33:50 UTC (rev 113056)
@@ -2059,6 +2059,7 @@
 #endif
 
 #if ENABLE(FULLSCREEN_API)
+__ZN7WebCore8Document22webkitCancelFullScreenEv
 __ZN7WebCore8Document33webkitDidExitFullScreenForElementEPNS_7ElementE
 __ZN7WebCore8Document34webkitDidEnterFullScreenForElementEPNS_7ElementE
 __ZN7WebCore8Document34webkitWillExitFullScreenForElementEPNS_7ElementE

Modified: trunk/Source/WebKit/mac/ChangeLog (113055 => 113056)


--- trunk/Source/WebKit/mac/ChangeLog	2012-04-03 17:31:59 UTC (rev 113055)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-04-03 17:33:50 UTC (rev 113056)
@@ -1,3 +1,19 @@
+2012-04-03  Jer Noble  <jer.no...@apple.com>
+
+        ESC key in full screen does not result in webkitFullScreenChange event.
+        https://bugs.webkit.org/show_bug.cgi?id=82755
+        <rdar://problem/11093513>
+
+        Reviewed by Eric Carlson.
+
+        Instead of exiting full screen directly, ask the document to initiate exiting full screen. This ensures
+        that the entire full screen element stack is cleared and that webkitFullScreenChange events are sent
+        out correctly.
+
+        * WebView/WebFullScreenController.mm:
+        (-[WebFullScreenController cancelOperation:]):
+        (-[WebFullScreenController requestExitFullScreen]):
+
 2012-04-01  Jon Lee  <jon...@apple.com>
 
         Rename notification properties and functions

Modified: trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm (113055 => 113056)


--- trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm	2012-04-03 17:31:59 UTC (rev 113055)
+++ trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm	2012-04-03 17:33:50 UTC (rev 113056)
@@ -155,7 +155,7 @@
 
 - (void)cancelOperation:(id)sender
 {
-    [self performSelector:@selector(exitFullScreen) withObject:nil afterDelay:0];
+    [self performSelector:@selector(requestExitFullScreen) withObject:nil afterDelay:0];
 }
 
 #pragma mark -
@@ -290,6 +290,13 @@
         [_scaleAnimation.get() stopAnimation];
 }
 
+- (void)requestExitFullScreen
+{
+    if (!_element)
+        return;
+    _element->document()->webkitCancelFullScreen();
+}
+
 - (void)exitFullScreen
 {
     if (!_isFullScreen)

Modified: trunk/Source/WebKit2/ChangeLog (113055 => 113056)


--- trunk/Source/WebKit2/ChangeLog	2012-04-03 17:31:59 UTC (rev 113055)
+++ trunk/Source/WebKit2/ChangeLog	2012-04-03 17:33:50 UTC (rev 113056)
@@ -1,3 +1,33 @@
+2012-04-03  Jer Noble  <jer.no...@apple.com>
+
+        ESC key in full screen does not result in webkitFullScreenChange event.
+        https://bugs.webkit.org/show_bug.cgi?id=82755
+        <rdar://problem/11093513>
+
+        Reviewed by Eric Carlson.
+
+        Instead of exiting full screen directly, ask the document to initiate exiting full screen. This ensures
+        that the entire full screen element stack is cleared and that webkitFullScreenChange events are sent
+        out correctly.
+
+        Because the WebProcess may be stalled or hung, add a watchdog timer which will force an exit of full
+        screen if the WebProcess does not respond in a timely manner (defaults to 1s).
+
+        Add a new method, requestExitFullScreen, which calls through to the WebProcess and Document:
+        * UIProcess/WebFullScreenManagerProxy.cpp:
+        (WebKit::WebFullScreenManagerProxy::requestExitFullScreen):
+        * UIProcess/WebFullScreenManagerProxy.h:
+        * WebProcess/FullScreen/WebFullScreenManager.cpp:
+        (WebKit::WebFullScreenManager::requestExitFullScreen):
+        * WebProcess/FullScreen/WebFullScreenManager.h:
+        * WebProcess/FullScreen/WebFullScreenManager.messages.in:
+
+        Request that the document exits full screen when the ESC key is pressed:
+        * UIProcess/mac/WKFullScreenWindowController.h:
+        * UIProcess/mac/WKFullScreenWindowController.mm:
+        (-[WKFullScreenWindowController cancelOperation:]):
+        (-[WKFullScreenWindowController exitFullScreen]):
+
 2012-04-03  Balazs Kelemen  <kbal...@webkit.org>
 
         [Qt][WK2] ASSERT(!(outputBytes.size() % sizeof(UChar))) in PluginProcessProxyQt.cpp

Modified: trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp (113055 => 113056)


--- trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp	2012-04-03 17:31:59 UTC (rev 113055)
+++ trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp	2012-04-03 17:33:50 UTC (rev 113056)
@@ -89,6 +89,11 @@
     m_page->process()->send(Messages::WebFullScreenManager::SetAnimatingFullScreen(animating), m_page->pageID());
 }
 
+void WebFullScreenManagerProxy::requestExitFullScreen()
+{
+    m_page->process()->send(Messages::WebFullScreenManager::RequestExitFullScreen(), m_page->pageID());
+}
+
 void WebFullScreenManagerProxy::supportsFullScreen(bool withKeyboard, bool& supports)
 {
     supports = true;

Modified: trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h (113055 => 113056)


--- trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h	2012-04-03 17:31:59 UTC (rev 113055)
+++ trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h	2012-04-03 17:33:50 UTC (rev 113056)
@@ -82,6 +82,7 @@
     void willExitFullScreen();
     void didExitFullScreen();
     void setAnimatingFullScreen(bool);
+    void requestExitFullScreen();
 
 private:
     WebFullScreenManagerProxy(WebPageProxy*);

Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h (113055 => 113056)


--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h	2012-04-03 17:31:59 UTC (rev 113055)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h	2012-04-03 17:33:50 UTC (rev 113056)
@@ -50,6 +50,7 @@
     RetainPtr<NSWindow> _backgroundWindow;
     NSRect _initialFrame;
     NSRect _finalFrame;
+    RetainPtr<NSTimer> _watchdogTimer;
     
     BOOL _isEnteringFullScreen;
     BOOL _isExitingFullScreen;

Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm (113055 => 113056)


--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2012-04-03 17:31:59 UTC (rev 113055)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2012-04-03 17:33:50 UTC (rev 113056)
@@ -51,6 +51,7 @@
 static RetainPtr<NSWindow> createBackgroundFullscreenWindow(NSRect frame);
 
 static const CFTimeInterval defaultAnimationDuration = 0.5;
+static const NSTimeInterval DefaultWatchdogTimerInterval = 1;
 
 @interface WKFullScreenWindowController(Private)<NSAnimationDelegate>
 - (void)_updateMenuAndDockForFullScreen;
@@ -135,7 +136,12 @@
 
 - (void)cancelOperation:(id)sender
 {
-    [self performSelector:@selector(exitFullScreen) withObject:nil afterDelay:0];
+    [self _manager]->requestExitFullScreen();
+
+    // If the page doesn't respond in DefaultWatchdogTimerInterval seconds, it could be because
+    // the WebProcess has hung, so exit anyway.
+    if (!_watchdogTimer)
+        _watchdogTimer = adoptNS([NSTimer scheduledTimerWithTimeInterval:DefaultWatchdogTimerInterval target:self selector:@selector(exitFullScreen) userInfo:nil repeats:NO]);
 }
 
 #pragma mark -
@@ -275,6 +281,11 @@
 
 - (void)exitFullScreen
 {
+    if (_watchdogTimer) {
+        [_watchdogTimer.get() invalidate];
+        _watchdogTimer.clear();
+    }
+
     if (!_isFullScreen)
         return;
     _isFullScreen = NO;

Modified: trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp (113055 => 113056)


--- trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp	2012-04-03 17:31:59 UTC (rev 113055)
+++ trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp	2012-04-03 17:33:50 UTC (rev 113056)
@@ -140,6 +140,12 @@
     m_element->document()->setAnimatingFullScreen(animating);
 }
 
+void WebFullScreenManager::requestExitFullScreen()
+{
+    ASSERT(m_element);
+    m_element->document()->webkitCancelFullScreen();
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(FULLSCREEN_API)

Modified: trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h (113055 => 113056)


--- trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h	2012-04-03 17:31:59 UTC (rev 113055)
+++ trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h	2012-04-03 17:33:50 UTC (rev 113056)
@@ -69,6 +69,7 @@
     WebFullScreenManager(WebPage*);
 
     void setAnimatingFullScreen(bool);
+    void requestExitFullScreen();
 
     void didReceiveWebFullScreenManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 

Modified: trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.messages.in (113055 => 113056)


--- trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.messages.in	2012-04-03 17:31:59 UTC (rev 113055)
+++ trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.messages.in	2012-04-03 17:33:50 UTC (rev 113056)
@@ -22,6 +22,7 @@
 
 #if ENABLE(FULLSCREEN_API)
 messages -> WebFullScreenManager {
+    RequestExitFullScreen()
     WillEnterFullScreen()
     DidEnterFullScreen()
     WillExitFullScreen()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to