Title: [185653] trunk
Revision
185653
Author
[email protected]
Date
2015-06-17 09:18:04 -0700 (Wed, 17 Jun 2015)

Log Message

[Cocoa] Expose UIDelegate::UIClient::close via WKUIDelegate
https://bugs.webkit.org/show_bug.cgi?id=145957

Reviewed by Darin Adler.

Source/WebKit2:

* UIProcess/API/Cocoa/WKUIDelegate.h: Added -webViewDidClose: to the protocol.
* UIProcess/Cocoa/UIDelegate.h: Added a webViewDidClose boolean to the delegate methods struct.
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate): Initialize the webViewDidClose boolean.
(WebKit::UIDelegate::UIClient::close): Changed to call the new delegate method. Left behind
code that calls the old private method if it’s implemented.

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm:
(-[OpenAndCloseWindowUIDelegate webViewDidClose:]): Renamed from -_webViewClose:.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (185652 => 185653)


--- trunk/Source/WebKit2/ChangeLog	2015-06-17 16:13:49 UTC (rev 185652)
+++ trunk/Source/WebKit2/ChangeLog	2015-06-17 16:18:04 UTC (rev 185653)
@@ -1,3 +1,17 @@
+2015-06-17  Dan Bernstein  <[email protected]>
+
+        [Cocoa] Expose UIDelegate::UIClient::close via WKUIDelegate
+        https://bugs.webkit.org/show_bug.cgi?id=145957
+
+        Reviewed by Darin Adler.
+
+        * UIProcess/API/Cocoa/WKUIDelegate.h: Added -webViewDidClose: to the protocol.
+        * UIProcess/Cocoa/UIDelegate.h: Added a webViewDidClose boolean to the delegate methods struct.
+        * UIProcess/Cocoa/UIDelegate.mm:
+        (WebKit::UIDelegate::setDelegate): Initialize the webViewDidClose boolean.
+        (WebKit::UIDelegate::UIClient::close): Changed to call the new delegate method. Left behind
+        code that calls the old private method if it’s implemented.
+
 2015-06-17  Carlos Garcia Campos  <[email protected]>
 
         [GTK] WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER doesn't disable memory cache when set before the web process is launched

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegate.h (185652 => 185653)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegate.h	2015-06-17 16:13:49 UTC (rev 185652)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegate.h	2015-06-17 16:18:04 UTC (rev 185653)
@@ -57,6 +57,13 @@
  */
 - (WK_NULLABLE WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures;
 
+/*! @abstract Notifies your app that the DOM window object's close() method completed successfully.
+  @param webView The web view invoking the delegate method.
+  @discussion Your app should remove the web view from the view hierarchy and update
+  the UI as needed, such as by closing the containing browser tab or window.
+  */
+- (void)webViewDidClose:(WKWebView *)webView;
+
 /*! @abstract Displays a _javascript_ alert panel.
  @param webView The web view invoking the delegate method.
  @param message The message to display.

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h (185652 => 185653)


--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h	2015-06-17 16:13:49 UTC (rev 185652)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h	2015-06-17 16:18:04 UTC (rev 185653)
@@ -88,6 +88,7 @@
         bool webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler : 1;
         bool webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded : 1;
         bool webViewPrintFrame : 1;
+        bool webViewDidClose : 1;
         bool webViewClose : 1;
         bool webViewFullscreenMayReturnToInline : 1;
         bool webViewDidEnterFullscreen : 1;

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm (185652 => 185653)


--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm	2015-06-17 16:13:49 UTC (rev 185652)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm	2015-06-17 16:18:04 UTC (rev 185653)
@@ -71,6 +71,7 @@
     m_delegateMethods.webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler = [delegate respondsToSelector:@selector(_webView:decideDatabaseQuotaForSecurityOrigin:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:)];
     m_delegateMethods.webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded = [delegate respondsToSelector:@selector(_webView:decideWebApplicationCacheQuotaForSecurityOrigin:currentQuota:totalBytesNeeded:decisionHandler:)];
     m_delegateMethods.webViewPrintFrame = [delegate respondsToSelector:@selector(_webView:printFrame:)];
+    m_delegateMethods.webViewDidClose = [delegate respondsToSelector:@selector(webViewDidClose:)];
     m_delegateMethods.webViewClose = [delegate respondsToSelector:@selector(_webViewClose:)];
     m_delegateMethods.webViewFullscreenMayReturnToInline = [delegate respondsToSelector:@selector(_webViewFullscreenMayReturnToInline:)];
     m_delegateMethods.webViewDidEnterFullscreen = [delegate respondsToSelector:@selector(_webViewDidEnterFullscreen:)];
@@ -232,14 +233,23 @@
 
 void UIDelegate::UIClient::close(WebKit::WebPageProxy*)
 {
-    if (!m_uiDelegate.m_delegateMethods.webViewClose)
+    if (m_uiDelegate.m_delegateMethods.webViewClose) {
+        auto delegate = m_uiDelegate.m_delegate.get();
+        if (!delegate)
+            return;
+
+        [(id <WKUIDelegatePrivate>)delegate _webViewClose:m_uiDelegate.m_webView];
         return;
+    }
 
+    if (!m_uiDelegate.m_delegateMethods.webViewDidClose)
+        return;
+
     auto delegate = m_uiDelegate.m_delegate.get();
     if (!delegate)
         return;
 
-    [(id <WKUIDelegatePrivate>)delegate _webViewClose:m_uiDelegate.m_webView];
+    [delegate webViewDidClose:m_uiDelegate.m_webView];
 }
 
 void UIDelegate::UIClient::fullscreenMayReturnToInline(WebKit::WebPageProxy*)

Modified: trunk/Tools/ChangeLog (185652 => 185653)


--- trunk/Tools/ChangeLog	2015-06-17 16:13:49 UTC (rev 185652)
+++ trunk/Tools/ChangeLog	2015-06-17 16:18:04 UTC (rev 185653)
@@ -1,3 +1,13 @@
+2015-06-17  Dan Bernstein  <[email protected]>
+
+        [Cocoa] Expose UIDelegate::UIClient::close via WKUIDelegate
+        https://bugs.webkit.org/show_bug.cgi?id=145957
+
+        Reviewed by Darin Adler.
+
+        * TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm:
+        (-[OpenAndCloseWindowUIDelegate webViewDidClose:]): Renamed from -_webViewClose:.
+
 2015-06-15  Chris Fleizach  <[email protected]>
 
         AX:  iOS accessibility tests are not running because we need WKTR support

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm (185652 => 185653)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm	2015-06-17 16:13:49 UTC (rev 185652)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm	2015-06-17 16:18:04 UTC (rev 185653)
@@ -45,7 +45,7 @@
 
 @implementation OpenAndCloseWindowUIDelegate
 
-- (void)_webViewClose:(WKWebView *)webView
+- (void)webViewDidClose:(WKWebView *)webView
 {
     EXPECT_EQ(openedWebView, webView);
     isDone = true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to