Skip to content
  • darin@apple.com's avatar
    WebKit2: Implement showModalDialog · 3ed100bb
    darin@apple.com authored
    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
    3ed100bb