[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

darin at apple.com darin at apple.com
Sun Feb 20 23:33:23 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 3ed100bb9c289c1cb9ecfaaf725c22bc682ab860
Author: darin at apple.com <darin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 21 18:41:32 2011 +0000

    WebKit2: Implement showModalDialog
    https://bugs.webkit.org/show_bug.cgi?id=52855
    
    Reviewed by Dan Bernstein.
    
    Source/WebKit2:
    
    * Shared/WebPageCreationParameters.h: Added canRunModal.
    
    * UIProcess/API/C/WKPage.h: Added a runModal function pointer to
    WKPageUIClient. Also removed a lot of redundant typedefs and added
    a new one, WKPageCallback, for callbacks without arguments or return
    values.
    
    * UIProcess/API/qt/qwkpage.cpp:
    (QWKPage::QWKPage): Added a runModal function pointer of 0.
    
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::creationParameters): Set canRunModal
    based on return value of WebUIClient::canRunModal.
    
    * UIProcess/WebPageProxy.h: Added runModal.
    Calls WebUIClient::runModal.
    
    * UIProcess/WebPageProxy.messages.in: Added RunModal message.
    Also removed the periods from the phrases in the comments
    as Maciej requested a while back.
    
    * UIProcess/WebUIClient.cpp:
    (WebKit::WebUIClient::canRunModal): Added. Returns true or false
    based on whether a runModal function was supplied in the
    WKPageUIClient structure.
    (WebKit::WebUIClient::runModal): Added. Calls the runModal
    function from the WKPageUIClient structure.
    * UIProcess/WebUIClient.h: Declared the above functions.
    
    * WebProcess/WebCoreSupport/WebChromeClient.cpp:
    (WebKit::WebChromeClient::canRunModal): Call through to WebPage.
    (WebKit::WebChromeClient::runModal): Ditto.
    
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::WebPage): Initialize m_canRunModal based on the
    creation parameters. Initialize m_isRunningModal to false.
    (WebKit::WebPage::close): Stop the nested run loop if we are running modal.
    (WebKit::WebPage::runModal): Send a message to ask the UI process to run
    modal and then start a nested run loop. It gets stopped when the page is closed.
    * WebProcess/WebPage/WebPage.h: Defined the canRunModal function
    and declared the runModal function.
    
    Tools:
    
    This fixes WebKitTestRunner to compile, but more work is probably
    needed to get it to pass the tests.
    
    * WebKitTestRunner/TestController.cpp:
    (WTR::TestController::runModal): Added. Calls through to the
    platform-specific version of runModal.
    (WTR::TestController::createOtherPage): Changed to be a private
    static member function so it can refer to runModal, which is
    a private static member function.
    (WTR::TestController::initialize): Pass 0 for the runModal
    function since we don't need to run the main window modal.
    I suspect this is wrong and will need to change.
    * WebKitTestRunner/TestController.h: Added declarations for
    the functions added above.
    * WebKitTestRunner/mac/TestControllerMac.mm:
    (WTR::TestController::runModal): Added. Untested implementation.
    * WebKitTestRunner/qt/TestControllerQt.cpp:
    (WTR::TestController::runModal): Added.
    * WebKitTestRunner/win/TestControllerWin.cpp:
    (WTR::TestController::runModal): Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76361 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index dafe1bc..84330b8 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,52 @@
+2011-01-20  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        WebKit2: Implement showModalDialog
+        https://bugs.webkit.org/show_bug.cgi?id=52855
+
+        * Shared/WebPageCreationParameters.h: Added canRunModal.
+
+        * UIProcess/API/C/WKPage.h: Added a runModal function pointer to
+        WKPageUIClient. Also removed a lot of redundant typedefs and added
+        a new one, WKPageCallback, for callbacks without arguments or return
+        values.
+
+        * UIProcess/API/qt/qwkpage.cpp:
+        (QWKPage::QWKPage): Added a runModal function pointer of 0.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::creationParameters): Set canRunModal
+        based on return value of WebUIClient::canRunModal.
+
+        * UIProcess/WebPageProxy.h: Added runModal.
+        Calls WebUIClient::runModal.
+
+        * UIProcess/WebPageProxy.messages.in: Added RunModal message.
+        Also removed the periods from the phrases in the comments
+        as Maciej requested a while back.
+
+        * UIProcess/WebUIClient.cpp:
+        (WebKit::WebUIClient::canRunModal): Added. Returns true or false
+        based on whether a runModal function was supplied in the
+        WKPageUIClient structure.
+        (WebKit::WebUIClient::runModal): Added. Calls the runModal
+        function from the WKPageUIClient structure.
+        * UIProcess/WebUIClient.h: Declared the above functions.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::canRunModal): Call through to WebPage.
+        (WebKit::WebChromeClient::runModal): Ditto.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage): Initialize m_canRunModal based on the
+        creation parameters. Initialize m_isRunningModal to false.
+        (WebKit::WebPage::close): Stop the nested run loop if we are running modal.
+        (WebKit::WebPage::runModal): Send a message to ask the UI process to run
+        modal and then start a nested run loop. It gets stopped when the page is closed.
+        * WebProcess/WebPage/WebPage.h: Defined the canRunModal function
+        and declared the runModal function.
+
 2011-01-20  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/Source/WebKit2/Shared/WebPageCreationParameters.h b/Source/WebKit2/Shared/WebPageCreationParameters.h
index e698ce7..8c76f68 100644
--- a/Source/WebKit2/Shared/WebPageCreationParameters.h
+++ b/Source/WebKit2/Shared/WebPageCreationParameters.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C)  2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -66,9 +66,12 @@ struct WebPageCreationParameters {
     SessionState sessionState;
     uint64_t highestUsedBackForwardItemID;
 
+    bool canRunModal;
+
 #if PLATFORM(MAC)
     bool isSmartInsertDeleteEnabled;
 #endif
+
 #if PLATFORM(WIN)
     HWND nativeWindow;
 #endif
diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h
index fe37646..e4bf162 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPage.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPage.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -41,6 +41,8 @@
 extern "C" {
 #endif
 
+typedef void (*WKPageCallback)(WKPageRef page, const void* clientInfo);
+
 // FrameLoad Client
 typedef void (*WKPageDidStartProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
 typedef void (*WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
@@ -59,19 +61,6 @@ typedef void (*WKPageDidRunInsecureContentForFrameCallback)(WKPageRef page, WKFr
 typedef bool (*WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback)(WKPageRef page, WKFrameRef frame, WKProtectionSpaceRef protectionSpace, const void *clientInfo);
 typedef void (*WKPageDidReceiveAuthenticationChallengeInFrameCallback)(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo);
 
-// Progress Client
-typedef void (*WKPageDidStartProgressCallback)(WKPageRef page, const void *clientInfo);
-typedef void (*WKPageDidChangeProgressCallback)(WKPageRef page, const void *clientInfo);
-typedef void (*WKPageDidFinishProgressCallback)(WKPageRef page, const void *clientInfo);
-
-// WebProcess Client
-// FIXME: These three functions should not be part of this client.
-typedef void (*WKPageProcessDidBecomeUnresponsiveCallback)(WKPageRef page, const void *clientInfo);
-typedef void (*WKPageProcessDidBecomeResponsiveCallback)(WKPageRef page, const void *clientInfo);
-typedef void (*WKPageProcessDidCrashCallback)(WKPageRef page, const void *clientInfo);
-
-typedef void (*WKPageDidChangeBackForwardListCallback)(WKPageRef page, const void *clientInfo);
-
 struct WKPageLoaderClient {
     int                                                                 version;
     const void *                                                        clientInfo;
@@ -93,16 +82,16 @@ struct WKPageLoaderClient {
     WKPageDidReceiveAuthenticationChallengeInFrameCallback              didReceiveAuthenticationChallengeInFrame;
 
     // FIXME: Move to progress client.
-    WKPageDidStartProgressCallback                                      didStartProgress;
-    WKPageDidChangeProgressCallback                                     didChangeProgress;
-    WKPageDidFinishProgressCallback                                     didFinishProgress;
+    WKPageCallback                                                      didStartProgress;
+    WKPageCallback                                                      didChangeProgress;
+    WKPageCallback                                                      didFinishProgress;
 
     // FIXME: These three functions should not be part of this client.
-    WKPageProcessDidBecomeUnresponsiveCallback                          processDidBecomeUnresponsive;
-    WKPageProcessDidBecomeResponsiveCallback                            processDidBecomeResponsive;
-    WKPageProcessDidCrashCallback                                       processDidCrash;
+    WKPageCallback                                                      processDidBecomeUnresponsive;
+    WKPageCallback                                                      processDidBecomeResponsive;
+    WKPageCallback                                                      processDidCrash;
 
-    WKPageDidChangeBackForwardListCallback                              didChangeBackForwardList;
+    WKPageCallback                                                      didChangeBackForwardList;
 };
 typedef struct WKPageLoaderClient WKPageLoaderClient;
 
@@ -152,8 +141,6 @@ typedef struct WKPageResourceLoadClient WKPageResourceLoadClient;
 
 // UI Client
 typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
-typedef void (*WKPageShowPageCallback)(WKPageRef page, const void *clientInfo);
-typedef void (*WKPageCloseCallback)(WKPageRef page, const void *clientInfo);
 typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void *clientInfo);
 typedef bool (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo);
 typedef WKStringRef (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void *clientInfo);
@@ -172,8 +159,6 @@ typedef void (*WKPageSetIsResizableCallback)(WKPageRef page, bool resizable, con
 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);
-typedef void (*WKPageDidDrawCallback)(WKPageRef page, const void *clientInfo);
-typedef void (*WKPageDidScrollCallback)(WKPageRef page, const void *clientInfo);
 typedef unsigned long long (*WKPageExceededDatabaseQuotaCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentUsage, unsigned long long expectedUsage, const void *clientInfo);
 typedef void (*WKPageRunOpenPanelCallback)(WKPageRef page, WKFrameRef frame, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void *clientInfo);
 typedef void (*WKPageDecidePolicyForGeolocationPermissionRequestCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKGeolocationPermissionRequestRef permissionRequest, const void* clientInfo);
@@ -187,8 +172,8 @@ struct WKPageUIClient {
     int                                                                 version;
     const void *                                                        clientInfo;
     WKPageCreateNewPageCallback                                         createNewPage;
-    WKPageShowPageCallback                                              showPage;
-    WKPageCloseCallback                                                 close;
+    WKPageCallback                                                      showPage;
+    WKPageCallback                                                      close;
     WKPageRunJavaScriptAlertCallback                                    runJavaScriptAlert;
     WKPageRunJavaScriptConfirmCallback                                  runJavaScriptConfirm;
     WKPageRunJavaScriptPromptCallback                                   runJavaScriptPrompt;
@@ -207,8 +192,8 @@ struct WKPageUIClient {
     WKPageGetWindowFrameCallback                                        getWindowFrame;
     WKPageSetWindowFrameCallback                                        setWindowFrame;
     WKPageRunBeforeUnloadConfirmPanelCallback                           runBeforeUnloadConfirmPanel;
-    WKPageDidDrawCallback                                               didDraw;
-    WKPageDidScrollCallback                                             pageDidScroll;
+    WKPageCallback                                                      didDraw;
+    WKPageCallback                                                      pageDidScroll;
     WKPageExceededDatabaseQuotaCallback                                 exceededDatabaseQuota;
     WKPageRunOpenPanelCallback                                          runOpenPanel;
     WKPageDecidePolicyForGeolocationPermissionRequestCallback           decidePolicyForGeolocationPermissionRequest;
@@ -217,6 +202,7 @@ struct WKPageUIClient {
     WKPageDrawHeaderCallback                                            drawHeader;
     WKPageDrawFooterCallback                                            drawFooter;
     WKPagePrintFrameCallback                                            printFrame;
+    WKPageCallback                                                      runModal;
 };
 typedef struct WKPageUIClient WKPageUIClient;
 
diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp b/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp
index 0cb8eb3..72c1322 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp
@@ -458,7 +458,8 @@ QWKPage::QWKPage(QWKContext* context)
         0,  /* footerHeight */
         0,  /* drawHeader */
         0,  /* drawFooter */
-        0   /* printFrame */
+        0,  /* printFrame */
+        0   /* runModal */
     };
     WKPageSetPageUIClient(pageRef(), &uiClient);
 }
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp
index f85d824..0be2f11 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -2278,7 +2278,6 @@ WebPageCreationParameters WebPageProxy::creationParameters() const
     parameters.isFocused = m_pageClient->isViewFocused();
     parameters.isVisible = m_pageClient->isViewVisible();
     parameters.isInWindow = m_pageClient->isViewInWindow();
-
     parameters.drawingAreaInfo = m_drawingArea->info();
     parameters.store = m_pageGroup->preferences()->store();
     parameters.pageGroupData = m_pageGroup->data();
@@ -2289,6 +2288,7 @@ WebPageCreationParameters WebPageProxy::creationParameters() const
     parameters.userAgent = userAgent();
     parameters.sessionState = SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex());
     parameters.highestUsedBackForwardItemID = WebBackForwardListItem::highedUsedItemID();
+    parameters.canRunModal = m_uiClient.canRunModal();
 
 #if PLATFORM(MAC)
     parameters.isSmartInsertDeleteEnabled = m_isSmartInsertDeleteEnabled;
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h
index 962a68d..dc43e19 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.h
+++ b/Source/WebKit2/UIProcess/WebPageProxy.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -441,6 +441,7 @@ private:
     void printFrame(uint64_t frameID);
     void exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentUsage, uint64_t expectedUsage, uint64_t& newQuota);
     void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier);
+    void runModal() { m_uiClient.runModal(this); }
 
     void reattachToWebProcess();
     void reattachToWebProcessWithItem(WebBackForwardListItem*);
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
index 1f7243d..6456851 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Apple Inc. All rights reserved.
+# Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -21,7 +21,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 messages -> WebPageProxy {
-    # UI messages.
+    # UI messages
     CreateNewPage(WebCore::WindowFeatures windowFeatures, uint32_t modifiers, int32_t mouseButton) -> (uint64_t newPageID, WebKit::WebPageCreationParameters newPageParameters)
     ShowPage()
     ClosePage()
@@ -54,6 +54,7 @@ messages -> WebPageProxy {
     PageDidScroll()
     RunOpenPanel(uint64_t frameID, WebKit::WebOpenPanelParameters::Data parameters)
     PrintFrame(uint64_t frameID) -> ()
+    RunModal()
 
 #if ENABLE(TILED_BACKING_STORE)
     PageDidRequestScroll(WebCore::IntSize delta)
@@ -63,23 +64,23 @@ messages -> WebPageProxy {
     DidFindZoomableArea(WebCore::IntRect area)
 #endif
 
-    # Policy messages.
+    # Policy messages
     DecidePolicyForMIMEType(uint64_t frameID, WTF::String MIMEType, WTF::String url, uint64_t listenerID) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID)
     DecidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WTF::String url, uint64_t listenerID)
     DecidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WTF::String url, uint64_t listenerID)
 
-    # Progress messages.
+    # Progress messages
     DidChangeProgress(double value)
     DidFinishProgress()
     DidStartProgress()
 
-    # Frame lifetime messages.
+    # Frame lifetime messages
     DidCreateMainFrame(uint64_t frameID)
     DidCreateSubframe(uint64_t frameID, uint64_t parentFrameID)
     DidSaveFrameToPageCache(uint64_t frameID);
     DidRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID);
 
-    # Frame load messages.
+    # Frame load messages
     DidCommitLoadForFrame(uint64_t frameID, WTF::String mimeType, bool hasCustomRepresentation, WebKit::PlatformCertificateInfo certificateInfo, WebKit::InjectedBundleUserMessageEncoder userData)
     DidFailLoadForFrame(uint64_t frameID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData)
     DidFailProvisionalLoadForFrame(uint64_t frameID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData)
@@ -97,7 +98,7 @@ messages -> WebPageProxy {
 
     FrameDidBecomeFrameSet(uint64_t frameID, bool value)
 
-    # Resource load messages.
+    # Resource load messages
     DidInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, WebCore::ResourceRequest request)
     DidSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, WebCore::ResourceRequest request, WebCore::ResourceResponse redirectResponse)
     DidReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, WebCore::ResourceResponse response)
@@ -108,21 +109,21 @@ messages -> WebPageProxy {
     # Custom representations
     DidFinishLoadingDataForCustomRepresentation(CoreIPC::DataReference data)
 
-    # Forms messages.
+    # Forms messages
     WillSubmitForm(uint64_t frameID, uint64_t sourceFrameID, WebKit::StringPairVector textFieldValues, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData)
 
-    # Callback messages.
+    # Callback messages
     DataCallback(CoreIPC::DataReference resultData, uint64_t callbackID)
     StringCallback(WTF::String resultString, uint64_t callbackID)
 
     DidReceiveAccessibilityPageToken(CoreIPC::DataReference data)
 
 #if PLATFORM(MAC)
-    # Keyboard support messages.
+    # Keyboard support messages
     InterpretKeyEvent(uint32_t type) -> (Vector<WebCore::KeypressCommand> commandName, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline> underlines)
 #endif
     
-    # BackForward messages.
+    # BackForward messages
     BackForwardAddItem(uint64_t itemID)
     BackForwardGoToItem(uint64_t itemID)
     BackForwardItemAtIndex(int32_t itemIndex) -> (uint64_t itemID)
@@ -130,67 +131,67 @@ messages -> WebPageProxy {
     BackForwardForwardListCount() -> (int32_t count)
     BackForwardClear()
 
-    # Undo/Redo messages.
+    # Undo/Redo messages
     RegisterEditCommandForUndo(uint64_t commandID, uint32_t editAction)
     ClearAllEditCommands()
     
-    # Selection messages.
+    # Selection messages
     SelectionStateChanged(WebKit::SelectionState selectionState)
 
 #if PLATFORM(WIN)
     DidChangeCompositionSelection(bool hasChanged)
 #endif
 
-    # Find messages.
+    # Find messages
     DidCountStringMatches(WTF::String string, uint32_t matchCount)
     SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, WebKit::SharedMemory::Handle contentImageHandle, bool fadeOut)
     DidFindString(WTF::String string, uint32_t matchCount)
     DidFailToFindString(WTF::String string)
 
-    # PopupMenu messages.
+    # PopupMenu messages
     ShowPopupMenu(WebCore::IntRect rect, Vector<WebKit::WebPopupItem> items, int32_t selectedIndex, WebKit::PlatformPopupMenuData data)
     HidePopupMenu()
     
-    # ContextMenu messages.
+    # ContextMenu messages
     ShowContextMenu(WebCore::IntPoint menuLocation, WebKit::ContextMenuState state, Vector<WebKit::WebContextMenuItemData> items, WebKit::InjectedBundleUserMessageEncoder userData)
 
 #if USE(ACCELERATED_COMPOSITING)
-    # Accelerated compositing messages.
+    # Accelerated compositing messages
     DidChangeAcceleratedCompositing(bool compositing) -> (WebKit::DrawingAreaInfo newDrawingArea)
 #endif
 
-    # Authentication messages.
+    # Authentication messages
     CanAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, WebCore::ProtectionSpace protectionSpace) -> (bool canAuthenticate)
     DidReceiveAuthenticationChallenge(uint64_t frameID, WebCore::AuthenticationChallenge challenge, uint64_t challengeID)
 
-    # Database messages.
+    # Database messages
     ExceededDatabaseQuota(uint64_t frameID, WTF::String originIdentifier, WTF::String databaseName, WTF::String databaseDisplayName, uint64_t currentQuota, uint64_t currentUsage, uint64_t expectedUsage) -> (uint64_t newQuota)
 
-    # Geolocation messages.
+    # Geolocation messages
     RequestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, WTF::String originIdentifier)
 
-    # Plug-in complex text input support messages.
 #if PLATFORM(MAC)
+    # Plug-in complex text input support messages
     SetComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled)
 #endif
 
-    # Speech messages.
 #if PLATFORM(MAC)
+    # Speech messages
     GetIsSpeaking() -> (bool isSpeaking)
     Speak(WTF::String string)
     StopSpeaking()
 #endif
 
-    # Spelling and grammar.
+    # Spelling and grammar messages
     CheckTextOfParagraph(WTF::String text, uint64_t checkingTypes) -> (Vector<WebCore::TextCheckingResult> results)
     UpdateSpellingUIWithMisspelledWord(WTF::String misspelledWord)
     GetGuessesForWord(WTF::String word, WTF::String context) -> (Vector<WTF::String> guesses)
     LearnWord(WTF::String word);
     IgnoreWord(WTF::String word);
     
-    # Drag and drop.
+    # Drag and drop messages
     DidPerformDragControllerAction(uint64_t resultOperation)
 #if PLATFORM(MAC)
-    SetDragImage(WebCore::IntPoint clientPosition, WebCore::IntSize imageSize, WebKit::SharedMemory::Handle dragImageHandle, bool linkDrag)
+    SetDragImage(WebCore::IntPoint clientPosition, WebCore::IntSize imageSize, WebKit::SharedMemory::Handle dragImage, bool linkDrag)
 #endif
 }
diff --git a/Source/WebKit2/UIProcess/WebUIClient.cpp b/Source/WebKit2/UIProcess/WebUIClient.cpp
index 65f4ac3..9f2c7ab 100644
--- a/Source/WebKit2/UIProcess/WebUIClient.cpp
+++ b/Source/WebKit2/UIProcess/WebUIClient.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -313,4 +313,17 @@ void WebUIClient::printFrame(WebPageProxy* page, WebFrameProxy* frame)
     m_client.printFrame(toAPI(page), toAPI(frame), m_client.clientInfo);
 }
 
+bool WebUIClient::canRunModal() const
+{
+    return m_client.runModal;
+}
+
+void WebUIClient::runModal(WebPageProxy* page)
+{
+    if (!m_client.runModal)
+        return;
+
+    m_client.runModal(toAPI(page), m_client.clientInfo);
+}
+
 } // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebUIClient.h b/Source/WebKit2/UIProcess/WebUIClient.h
index 0acfb47..b873a8d 100644
--- a/Source/WebKit2/UIProcess/WebUIClient.h
+++ b/Source/WebKit2/UIProcess/WebUIClient.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -93,6 +93,9 @@ public:
     void drawHeader(WebPageProxy*, WebFrameProxy*, const WebCore::FloatRect&);
     void drawFooter(WebPageProxy*, WebFrameProxy*, const WebCore::FloatRect&);
     void printFrame(WebPageProxy*, WebFrameProxy*);
+
+    bool canRunModal() const;
+    void runModal(WebPageProxy*);
 };
 
 } // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
index b10846f..6da6c6e 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  * Redistribution and use in source and binary forms, with or without
@@ -173,13 +173,12 @@ void WebChromeClient::show()
 
 bool WebChromeClient::canRunModal()
 {
-    notImplemented();
-    return false;
+    return m_page->canRunModal();
 }
 
 void WebChromeClient::runModal()
 {
-    notImplemented();
+    m_page->runModal();
 }
 
 void WebChromeClient::setToolbarsVisible(bool toolbarsAreVisible)
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
index 8e7e6fd..a96a282 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -37,6 +37,7 @@
 #include "PluginProxy.h"
 #include "PluginView.h"
 #include "PrintInfo.h"
+#include "RunLoop.h"
 #include "SessionState.h"
 #include "ShareableBitmap.h"
 #include "WebBackForwardList.h"
@@ -149,6 +150,8 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
     , m_findController(this)
     , m_geolocationPermissionRequestManager(this)
     , m_pageID(pageID)
+    , m_canRunModal(parameters.canRunModal)
+    , m_isRunningModal(false)
 {
     ASSERT(m_pageID);
 
@@ -377,6 +380,11 @@ void WebPage::close()
     m_drawingArea.clear();
 
     WebProcess::shared().removeWebPage(m_pageID);
+
+    if (m_isRunningModal) {
+        m_isRunningModal = false;
+        WebProcess::shared().runLoop()->stop();
+    }
 }
 
 void WebPage::tryClose()
@@ -1793,4 +1801,17 @@ void WebPage::drawRectToPDF(uint64_t frameID, const WebCore::IntRect& rect, Vect
 }
 #endif
 
+void WebPage::runModal()
+{
+    if (m_isClosed)
+        return;
+    if (m_isRunningModal)
+        return;
+
+    m_isRunningModal = true;
+    send(Messages::WebPageProxy::RunModal());
+    RunLoop::run();
+    ASSERT(!m_isRunningModal);
+}
+
 } // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h
index 353c085..d2d8754 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h
@@ -311,6 +311,9 @@ public:
 
     bool mainFrameHasCustomRepresentation() const;
 
+    bool canRunModal() const { return m_canRunModal; }
+    void runModal();
+
 private:
     WebPage(uint64_t pageID, const WebPageCreationParameters&);
 
@@ -494,6 +497,9 @@ private:
 
     SandboxExtensionTracker m_sandboxExtensionTracker;
     uint64_t m_pageID;
+
+    bool m_canRunModal;
+    bool m_isRunningModal;
 };
 
 } // namespace WebKit
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index a81fb61..9c6cfa5 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,31 @@
+2011-01-20  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        WebKit2: Implement showModalDialog
+        https://bugs.webkit.org/show_bug.cgi?id=52855
+
+        This fixes WebKitTestRunner to compile, but more work is probably
+        needed to get it to pass the tests.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::runModal): Added. Calls through to the
+        platform-specific version of runModal.
+        (WTR::TestController::createOtherPage): Changed to be a private
+        static member function so it can refer to runModal, which is
+        a private static member function.
+        (WTR::TestController::initialize): Pass 0 for the runModal
+        function since we don't need to run the main window modal.
+        I suspect this is wrong and will need to change.
+        * WebKitTestRunner/TestController.h: Added declarations for
+        the functions added above.
+        * WebKitTestRunner/mac/TestControllerMac.mm:
+        (WTR::TestController::runModal): Added. Untested implementation.
+        * WebKitTestRunner/qt/TestControllerQt.cpp:
+        (WTR::TestController::runModal): Added.
+        * WebKitTestRunner/win/TestControllerWin.cpp:
+        (WTR::TestController::runModal): Added.
+
 2011-01-21  Eric Seidel  <eric at webkit.org>
 
         Reviewed by Adam Barth.
diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp
index 1a68426..e856176 100644
--- a/Tools/WebKitTestRunner/TestController.cpp
+++ b/Tools/WebKitTestRunner/TestController.cpp
@@ -103,6 +103,11 @@ static bool runBeforeUnloadConfirmPanel(WKPageRef page, WKStringRef message, WKF
     return true;
 }
 
+void TestController::runModal(WKPageRef page, const void* clientInfo)
+{
+    runModal(static_cast<PlatformWebView*>(const_cast<void*>(clientInfo)));
+}
+
 static void closeOtherPage(WKPageRef page, const void* clientInfo)
 {
     WKPageClose(page);
@@ -110,7 +115,7 @@ static void closeOtherPage(WKPageRef page, const void* clientInfo)
     delete view;
 }
 
-static WKPageRef createOtherPage(WKPageRef oldPage, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*)
+WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*)
 {
     PlatformWebView* view = new PlatformWebView(WKPageGetContext(oldPage), WKPageGetPageGroup(oldPage));
     WKPageRef newPage = view->page();
@@ -151,6 +156,7 @@ static WKPageRef createOtherPage(WKPageRef oldPage, WKDictionaryRef, WKEventModi
         0, // drawHeader
         0, // drawFooter
         0, // printFrame
+        runModal,
     };
     WKPageSetPageUIClient(newPage, &otherPageUIClient);
 
@@ -261,6 +267,7 @@ void TestController::initialize(int argc, const char* argv[])
         0, // drawHeader
         0, // drawFooter
         0, // printFrame
+        0, // runModal
     };
     WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient);
 
diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h
index fc8bd30..65305a2 100644
--- a/Tools/WebKitTestRunner/TestController.h
+++ b/Tools/WebKitTestRunner/TestController.h
@@ -85,6 +85,10 @@ private:
     static void processDidCrash(WKPageRef, const void* clientInfo);
     void processDidCrash(WKPageRef);
 
+    static WKPageRef createOtherPage(WKPageRef oldPage, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*);
+
+    static void runModal(WKPageRef, const void* clientInfo);
+    static void runModal(PlatformWebView*);
 
     OwnPtr<TestInvocation> m_currentInvocation;
 
diff --git a/Tools/WebKitTestRunner/mac/TestControllerMac.mm b/Tools/WebKitTestRunner/mac/TestControllerMac.mm
index 6a4444f..8107890 100644
--- a/Tools/WebKitTestRunner/mac/TestControllerMac.mm
+++ b/Tools/WebKitTestRunner/mac/TestControllerMac.mm
@@ -25,6 +25,7 @@
 
 #include "TestController.h"
 
+#include "PlatformWebView.h"
 #include <WebKit2/WKStringCF.h>
 #include <mach-o/dyld.h> 
 
@@ -62,4 +63,12 @@ void TestController::platformInitializeContext()
 {
 }
 
+void TestController::runModal(PlatformWebView* view)
+{
+    NSWindow *window = [view->platformView() window];
+    if (!window)
+        return;
+    [NSApp runModalForWindow:window];
+}
+
 } // namespace WTR
diff --git a/Tools/WebKitTestRunner/qt/TestControllerQt.cpp b/Tools/WebKitTestRunner/qt/TestControllerQt.cpp
index ca0a00c..df977fb 100644
--- a/Tools/WebKitTestRunner/qt/TestControllerQt.cpp
+++ b/Tools/WebKitTestRunner/qt/TestControllerQt.cpp
@@ -128,6 +128,11 @@ void TestController::platformInitializeContext()
 {
 }
 
+void TestController::runModal(PlatformWebView*)
+{
+    // FIXME: Need to implement this to test showModalDialog.
+}
+
 #include "TestControllerQt.moc"
 
 } // namespace WTR
diff --git a/Tools/WebKitTestRunner/win/TestControllerWin.cpp b/Tools/WebKitTestRunner/win/TestControllerWin.cpp
index e562ada..08f188f 100644
--- a/Tools/WebKitTestRunner/win/TestControllerWin.cpp
+++ b/Tools/WebKitTestRunner/win/TestControllerWin.cpp
@@ -152,4 +152,9 @@ void TestController::platformInitializeContext()
     WKContextSetShouldPaintNativeControls(m_context.get(), false);
 }
 
+void TestController::runModal(PlatformWebView*)
+{
+    // FIXME: Need to implement this to test showModalDialog.
+}
+
 } // namespace WTR

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list