Skip to content
  • joepeck@webkit.org's avatar
    [Mac] Update PageVisibilityState when WebView is hidden / visible · 2152e36f
    joepeck@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=107509
    
    Source/WebKit/mac:
    
    Reviewed by NOBODY (OOPS!).
    
    * WebView/WebView.mm:
    * WebView/WebViewPrivate.h:
    (-[WebView _commonInitializationWithFrameName:groupName:]):
    Set the initial visibility of the page.
    
    (-[WebView addWindowObserversForWindow:]):
    (-[WebView removeWindowObservers]):
    (-[WebView _isViewVisible]):
    (-[WebView _updateVisibilityState]):
    (-[WebView viewDidMoveToWindow]):
    (-[WebView _windowVisibilityChanged:]):
    Update visibility state in the same ways WK2 does. This involves
    listening for some new NSWindow delegates.
    
    Tools:
    
    Add a test that PageVisibility of WK1 WebViews and WK2 WKViews
    automatically changes between hidden and visible as the view is added
    and removed from window, or when it is in a window that changes
    visibility, for instance by minimizing / deminimizing.
    
    Reviewed by NOBODY (OOPS!).
    
    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
    * TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.html: Added.
    * TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm: Added.
    (-[PageVisibilityStateDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:]):
    (runJavaScriptAlert):
    (PageVisibilityStateWithWindowChanges):
    (TestWebKitAPI::PageVisibilityStateWithWindowChanges::initializeView):
    (TestWebKitAPI::PageVisibilityStateWithWindowChanges::deinitializeView):
    (TestWebKitAPI::PageVisibilityStateWithWindowChanges::runTest):
    (TestWebKitAPI::TEST_F):
    Test visibility state of a page in a WebView/WKView with different window states.
    
    * TestWebKitAPI/mac/WebKitAgnosticTest.h:
    * TestWebKitAPI/mac/WebKitAgnosticTest.mm:
    (TestWebKitAPI::WebKitAgnosticTest::deinitializeView):
    (TestWebKitAPI::WebKitAgnosticTest::runWebKit1Test):
    (TestWebKitAPI::WebKitAgnosticTest::runWebKit2Test):
    Add a WK1 and WK2 deinitializeView to balance initializeView.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141011 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    2152e36f