Skip to content
  • joepeck@webkit.org's avatar
    Improve PageVisibility API with enums · 5fd52db0
    joepeck@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=107364
    
    Reviewed by Sam Weinig.
    
    Source/WebKit/mac:
    
    * WebView/WebView.mm:
    * WebView/WebViewPrivate.h:
    (corePageVisibilityState):
    (-[WebView _setVisibilityState:isInitialState:]):
    Switch the private API form int to a WebPageVisibilityState enum.
    
    Source/WebKit2:
    
    * Shared/API/c/WKPageVisibilityTypes.h: Added.
    * Shared/API/c/WKSharedAPICast.h:
    (WebKit::toPageVisibilityState):
    Create an enum for page visibility APIs and a conversion function
    for the WK2 values to WebCore values.
    
    * Target.pri:
    * GNUmakefile.list.am:
    * WebKit2.xcodeproj/project.pbxproj:
    Add WKPageVisibilityTypes.h to the build as a private export.
    
    * UIProcess/API/C/WKPage.h:
    * UIProcess/API/C/WKPage.cpp:
    (WKPageSetVisibilityState):
    * UIProcess/WebPageProxy.h:
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::setVisibilityState):
    UIProcess API to set visibility state. WebPageProxy already
    had m_visibilityState, so update that when setter is used.
    
    * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
    * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
    * WebProcess/InjectedBundle/InjectedBundle.cpp:
    * WebProcess/InjectedBundle/InjectedBundle.h:
    Remove the old SPI for WebKitTestRunner. Tests now use the C API.
    
    * WebProcess/WebPage/WebPage.h:
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::setVisibilityState):
    * WebProcess/WebPage/WebPage.messages.in:
    Update the existing WebPage API to use uint32_t, which matches
    other enum message types.
    
    Tools:
    
    * DumpRenderTree/mac/TestRunnerMac.mm:
    (TestRunner::resetPageVisibility):
    (TestRunner::setPageVisibility):
    Update the WK1 test code to use the new WK1 enums.
    
    * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
    (WTR::InjectedBundle::setVisibilityState):
    * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
    (InjectedBundle):
    * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
    (WTR::TestRunner::setPageVisibility):
    (WTR::TestRunner::resetPageVisibility):
    * WebKitTestRunner/TestController.cpp:
    (WTR::TestController::setVisibilityState):
    * WebKitTestRunner/TestController.h:
    (TestController):
    * WebKitTestRunner/TestInvocation.cpp:
    (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
    Update the WK2 test code to use the new WK2 API and enums.
    
    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
    * TestWebKitAPI/Tests/WebKit2/PageVisibilityState.cpp: Added.
    (TestWebKitAPI):
    (TestWebKitAPI::setPageVisibilityStateWithEvalContinuation):
    (TestWebKitAPI::assertSerializedScriptValueIsStringValue):
    (TestWebKitAPI::didRunStep1StateChangeVisibleToHidden):
    (TestWebKitAPI::didRunStep2StateChangeHiddenToPrerender):
    (TestWebKitAPI::didRunStep3StateChangePrerenderToPreview):
    (TestWebKitAPI::didRunStep4InStatePreview):
    (TestWebKitAPI::TEST):
    Test the new WK2 API with all enum types.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141010 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    5fd52db0