[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

weinig at apple.com weinig at apple.com
Wed Dec 22 14:27:59 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 788b9710aafa658028d4e6a55c80864713a415f9
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Oct 9 21:58:16 2010 +0000

    Add WebKit2 version of runBeforeUnloadConfirmPanelWithMessage
    <rdar://problem/8447690>
    https://bugs.webkit.org/show_bug.cgi?id=47459
    
    Reviewed by Dan Bernstein.
    
    WebKit2:
    
    * UIProcess/API/C/WKPage.h:
    * UIProcess/API/qt/qwkpage.cpp:
    (QWKPage::QWKPage):
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::setWindowFrame):
    (WebKit::WebPageProxy::getWindowFrame):
    (WebKit::WebPageProxy::canRunBeforeUnloadConfirmPanel):
    (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
    * UIProcess/WebPageProxy.h:
    * UIProcess/WebPageProxy.messages.in:
    * UIProcess/WebUIClient.cpp:
    (WebKit::WebUIClient::canRunBeforeUnloadConfirmPanel):
    (WebKit::WebUIClient::runBeforeUnloadConfirmPanel):
    * UIProcess/WebUIClient.h:
    * WebProcess/WebCoreSupport/WebChromeClient.cpp:
    (WebKit::WebChromeClient::canRunBeforeUnloadConfirmPanel):
    (WebKit::WebChromeClient::runBeforeUnloadConfirmPanel):
    Pipe calls through to the UIProcess.
    
    WebKitTools:
    
    * MiniBrowser/mac/BrowserWindowController.m:
    (runBeforeUnloadConfirmPanel):
    (-[BrowserWindowController awakeFromNib]):
    * WebKitTestRunner/TestController.cpp:
    (WTR::createOtherPage):
    (WTR::TestController::initialize):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69460 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 7bd372b..be54086 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,33 @@
 
         Reviewed by Dan Bernstein.
 
+        Add WebKit2 version of runBeforeUnloadConfirmPanelWithMessage
+        <rdar://problem/8447690>
+        https://bugs.webkit.org/show_bug.cgi?id=47459
+
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/API/qt/qwkpage.cpp:
+        (QWKPage::QWKPage):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::setWindowFrame):
+        (WebKit::WebPageProxy::getWindowFrame):
+        (WebKit::WebPageProxy::canRunBeforeUnloadConfirmPanel):
+        (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/WebUIClient.cpp:
+        (WebKit::WebUIClient::canRunBeforeUnloadConfirmPanel):
+        (WebKit::WebUIClient::runBeforeUnloadConfirmPanel):
+        * UIProcess/WebUIClient.h:
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::canRunBeforeUnloadConfirmPanel):
+        (WebKit::WebChromeClient::runBeforeUnloadConfirmPanel):
+        Pipe calls through to the UIProcess.
+
+2010-10-09  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Dan Bernstein.
+
         Need implementation of ChromeClient windowRect related functions.
         <rdar://problem/8469476>
         https://bugs.webkit.org/show_bug.cgi?id=47386
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index b795ee4..c0f0cc2 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -141,6 +141,7 @@ typedef void (*WKPageContentsSizeChangedCallback)(WKPageRef page, int width, int
 typedef void (*WKPageDidNotHandleKeyEventCallback)(WKPageRef page, WKNativeEventPtr event, const void *clientInfo);
 typedef WKRect (*WKPageGetWindowFrameCallback)(WKPageRef page, const void *clientInfo);
 typedef void (*WKPageSetWindowFrameCallback)(WKPageRef page, WKRect frame, const void *clientInfo);
+typedef bool (*WKPageRunBeforeUnloadConfirmPanelCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo);
 
 struct WKPageUIClient {
     int                                                                 version;
@@ -157,6 +158,7 @@ struct WKPageUIClient {
     WKPageDidNotHandleKeyEventCallback                                  didNotHandleKeyEvent;
     WKPageGetWindowFrameCallback                                        getWindowFrame;
     WKPageSetWindowFrameCallback                                        setWindowFrame;
+    WKPageRunBeforeUnloadConfirmPanelCallback                           runBeforeUnloadConfirmPanel;
 };
 typedef struct WKPageUIClient WKPageUIClient;
 
diff --git a/WebKit2/UIProcess/API/qt/qwkpage.cpp b/WebKit2/UIProcess/API/qt/qwkpage.cpp
index aa22fbe..e79a554 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage.cpp
+++ b/WebKit2/UIProcess/API/qt/qwkpage.cpp
@@ -283,8 +283,9 @@ QWKPage::QWKPage(WKPageNamespaceRef namespaceRef)
         0,  /* mouseDidMoveOverElement */
         0,  /* contentsSizeChanged */
         0,  /* didNotHandleKeyEvent */
-        0,  /* getWindowRect */
-        0   /* setWindowRect */
+        0,  /* getWindowFrame */
+        0,  /* setWindowFrame */
+        0   /* runBeforeUnloadConfirmPanel */
     };
     WKPageSetPageUIClient(pageRef(), &uiClient);
 }
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 4561dcb..7a6f285 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -865,6 +865,26 @@ void WebPageProxy::contentsSizeChanged(uint64_t frameID, const WebCore::IntSize&
     m_uiClient.contentsSizeChanged(this, size, process()->webFrame(frameID));
 }
 
+void WebPageProxy::setWindowFrame(const FloatRect& newWindowFrame)
+{
+    m_uiClient.setWindowFrame(this, m_pageClient->transformToDeviceSpace(newWindowFrame));
+}
+
+void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame)
+{
+    newWindowFrame = m_pageClient->transformToUserSpace(m_uiClient.windowFrame(this));
+}
+
+void WebPageProxy::canRunBeforeUnloadConfirmPanel(bool& canRun)
+{
+    canRun = m_uiClient.canRunBeforeUnloadConfirmPanel();
+}
+
+void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose)
+{
+    shouldClose = m_uiClient.runBeforeUnloadConfirmPanel(this, message, process()->webFrame(frameID));
+}
+
 // BackForwardList
 
 void WebPageProxy::backForwardAddItem(uint64_t itemID)
@@ -971,16 +991,6 @@ void WebPageProxy::didValidateMenuItem(const String& commandName, bool isEnabled
     m_pageClient->setEditCommandState(commandName, isEnabled, state);
 }
 
-void WebPageProxy::setWindowFrame(const FloatRect& newWindowFrame)
-{
-    m_uiClient.setWindowFrame(this, m_pageClient->transformToDeviceSpace(newWindowFrame));
-}
-
-void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame)
-{
-    newWindowFrame = m_pageClient->transformToUserSpace(m_uiClient.windowFrame(this));
-}
-
 void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
 {
     WebEvent::Type type = static_cast<WebEvent::Type>(opaqueType);
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 60437a3..7fc79e3 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -247,6 +247,7 @@ private:
 
     void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder*);
 
+    // UI client
     void createNewPage(uint64_t& newPageID, WebPageCreationParameters&);
     void showPage();
     void closePage();
@@ -256,6 +257,10 @@ private:
     void setStatusText(const String&);
     void mouseDidMoveOverElement(uint32_t modifiers, CoreIPC::ArgumentDecoder*);
     void contentsSizeChanged(uint64_t frameID, const WebCore::IntSize&);
+    void setWindowFrame(const WebCore::FloatRect&);
+    void getWindowFrame(WebCore::FloatRect&);
+    void canRunBeforeUnloadConfirmPanel(bool& canRun);
+    void runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose);
 
     // Back/Forward list management
     void backForwardAddItem(uint64_t itemID);
@@ -278,10 +283,7 @@ private:
     void setToolTip(const String&);
     void setCursor(const WebCore::Cursor&);
     void didValidateMenuItem(const String& commandName, bool isEnabled, int32_t state);
-
-    void setWindowFrame(const WebCore::FloatRect&);
-    void getWindowFrame(WebCore::FloatRect&);
-
+    
     void didReceiveEvent(uint32_t opaqueType, bool handled);
 
     void didRunJavaScriptInMainFrame(const String&, uint64_t);
diff --git a/WebKit2/UIProcess/WebPageProxy.messages.in b/WebKit2/UIProcess/WebPageProxy.messages.in
index 85a57ba..cc045be 100644
--- a/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -38,6 +38,8 @@ messages -> WebPageProxy {
     TakeFocus(bool direction)
     SetWindowFrame(WebCore::FloatRect windowFrame)
     GetWindowFrame() -> (WebCore::FloatRect windowFrame)
+    CanRunBeforeUnloadConfirmPanel() -> (bool canRun)
+    RunBeforeUnloadConfirmPanel(WTF::String message, uint64_t frameID) -> (bool shouldClose)
 
     # Policy messages.
     DecidePolicyForMIMEType(uint64_t frameID, WTF::String MIMEType, WTF::String url, uint64_t listenerID)
diff --git a/WebKit2/UIProcess/WebUIClient.cpp b/WebKit2/UIProcess/WebUIClient.cpp
index 9736139..aa31e8f 100644
--- a/WebKit2/UIProcess/WebUIClient.cpp
+++ b/WebKit2/UIProcess/WebUIClient.cpp
@@ -153,4 +153,17 @@ FloatRect WebUIClient::windowFrame(WebPageProxy* page)
     return toImpl(m_pageUIClient.getWindowFrame(toAPI(page), m_pageUIClient.clientInfo));
 }
 
+bool WebUIClient::canRunBeforeUnloadConfirmPanel()
+{
+    return m_pageUIClient.runBeforeUnloadConfirmPanel;
+}
+
+bool WebUIClient::runBeforeUnloadConfirmPanel(WebPageProxy* page, const String& message, WebFrameProxy* frame)
+{
+    if (!m_pageUIClient.runBeforeUnloadConfirmPanel)
+        return true;
+
+    return m_pageUIClient.runBeforeUnloadConfirmPanel(toAPI(page), toAPI(message.impl()), toAPI(frame), m_pageUIClient.clientInfo);
+}
+
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebUIClient.h b/WebKit2/UIProcess/WebUIClient.h
index dfd18ba..f24df54 100644
--- a/WebKit2/UIProcess/WebUIClient.h
+++ b/WebKit2/UIProcess/WebUIClient.h
@@ -50,17 +50,23 @@ public:
     PassRefPtr<WebPageProxy> createNewPage(WebPageProxy*);
     void showPage(WebPageProxy*);
     void close(WebPageProxy*);
+
     void runJavaScriptAlert(WebPageProxy*, const String&, WebFrameProxy*);
     bool runJavaScriptConfirm(WebPageProxy*, const String&, WebFrameProxy*);
     String runJavaScriptPrompt(WebPageProxy*, const String&, const String&, WebFrameProxy*);
+
     void setStatusText(WebPageProxy*, const String&);
     void mouseDidMoveOverElement(WebPageProxy*, WebEvent::Modifiers, APIObject*);
+
     void contentsSizeChanged(WebPageProxy*, const WebCore::IntSize&, WebFrameProxy*);
     void didNotHandleKeyEvent(WebPageProxy*, const NativeWebKeyboardEvent&);
 
     void setWindowFrame(WebPageProxy*, const WebCore::FloatRect&);
     WebCore::FloatRect windowFrame(WebPageProxy*);
 
+    bool canRunBeforeUnloadConfirmPanel();
+    bool runBeforeUnloadConfirmPanel(WebPageProxy*, const String&, WebFrameProxy*);
+
 private:
     WKPageUIClient m_pageUIClient;
 };
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
index 783e7ec..5dffea5 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
@@ -204,14 +204,26 @@ void WebChromeClient::addMessageToConsole(MessageSource, MessageType, MessageLev
 
 bool WebChromeClient::canRunBeforeUnloadConfirmPanel()
 {
-    notImplemented();
-    return false;
+    bool canRun = false;
+    if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::CanRunBeforeUnloadConfirmPanel(),
+            Messages::WebPageProxy::CanRunBeforeUnloadConfirmPanel::Reply(canRun),
+            m_page->pageID(), CoreIPC::Connection::NoTimeout))
+        return false;
+
+    return canRun;
 }
 
 bool WebChromeClient::runBeforeUnloadConfirmPanel(const String& message, Frame* frame)
 {
-    notImplemented();
-    return false;
+    WebFrame* webFrame =  static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
+
+    bool shouldClose = false;
+    if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::RunBeforeUnloadConfirmPanel(message, webFrame->frameID()),
+            Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::Reply(shouldClose),
+            m_page->pageID(), CoreIPC::Connection::NoTimeout))
+        return false;
+
+    return shouldClose;
 }
 
 void WebChromeClient::closeWindowSoon()
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index b5188e7..2d45899 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -2,6 +2,21 @@
 
         Reviewed by Dan Bernstein.
 
+        Add WebKit2 version of runBeforeUnloadConfirmPanelWithMessage
+        <rdar://problem/8447690>
+        https://bugs.webkit.org/show_bug.cgi?id=47459
+
+        * MiniBrowser/mac/BrowserWindowController.m:
+        (runBeforeUnloadConfirmPanel):
+        (-[BrowserWindowController awakeFromNib]):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::createOtherPage):
+        (WTR::TestController::initialize):
+
+2010-10-09  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Dan Bernstein.
+
         Need implementation of ChromeClient windowRect related functions.
         <rdar://problem/8469476>
         https://bugs.webkit.org/show_bug.cgi?id=47386
diff --git a/WebKitTools/MiniBrowser/mac/BrowserWindowController.m b/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
index fd0ff54..2df04ff 100644
--- a/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
+++ b/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
@@ -500,6 +500,30 @@ static void setWindowFrame(WKPageRef page, WKRect rect, const void* clientInfo)
     [[(BrowserWindowController *)clientInfo window] setFrame:CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height) display:YES];
 }
 
+static bool runBeforeUnloadConfirmPanel(WKPageRef page, WKStringRef message, WKFrameRef frame, const void* clientInfo)
+{
+    NSAlert *alert = [[NSAlert alloc] init];
+
+    WKURLRef wkURL = WKFrameCopyURL(frame);
+    CFURLRef cfURL = WKURLCopyCFURL(0, wkURL);
+    WKRelease(wkURL);
+
+    [alert setMessageText:[NSString stringWithFormat:@"BeforeUnload confirm dialog from %@.", [(NSURL *)cfURL absoluteString]]];
+    CFRelease(cfURL);
+
+    CFStringRef cfMessage = WKStringCopyCFString(0, message);
+    [alert setInformativeText:(NSString *)cfMessage];
+    CFRelease(cfMessage);
+
+    [alert addButtonWithTitle:@"OK"];
+    [alert addButtonWithTitle:@"Cancel"];
+
+    NSInteger button = [alert runModal];
+    [alert release];
+
+    return button == NSAlertFirstButtonReturn;
+}
+
 - (void)awakeFromNib
 {
     _webView = [[WKView alloc] initWithFrame:[containerView frame] pageNamespaceRef:_pageNamespace];
@@ -556,7 +580,8 @@ static void setWindowFrame(WKPageRef page, WKRect rect, const void* clientInfo)
         contentsSizeChanged,
         0,          /* didNotHandleKeyEvent */
         getWindowFrame,
-        setWindowFrame
+        setWindowFrame,
+        runBeforeUnloadConfirmPanel
     };
     WKPageSetPageUIClient(_webView.pageRef, &uiClient);
 }
diff --git a/WebKitTools/WebKitTestRunner/TestController.cpp b/WebKitTools/WebKitTestRunner/TestController.cpp
index 9bb7cd1..eef5eff 100644
--- a/WebKitTools/WebKitTestRunner/TestController.cpp
+++ b/WebKitTools/WebKitTestRunner/TestController.cpp
@@ -119,7 +119,8 @@ static WKPageRef createOtherPage(WKPageRef oldPage, const void*)
         0,
         0,
         getWindowFrameOtherPage,
-        setWindowFrameOtherPage
+        setWindowFrameOtherPage,
+        0
     };
     WKPageSetPageUIClient(newPage, &otherPageUIClient);
 
@@ -202,7 +203,8 @@ void TestController::initialize(int argc, const char* argv[])
         0,
         0,
         getWindowFrameMainPage,
-        setWindowFrameMainPage
+        setWindowFrameMainPage,
+        0,
     };
     WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list