• ananta's avatar
    When we switch tabs in chrome, the tab being switched away from gets hidden/shown/hidden. · 99941773
    ananta authored
    This occurs in the NativeViewHostAura::NativeViewDetaching code path where we first remove the
    clipping window which is the intermediate parent of the web contents view. The clipping window
    is hidden which causes the RWHVA::Hide function to get called which initiates the hiding sequence.
    Then the web contents view is reparented to the main view which is still visible. Now the RWHVA::Show
    function is called which initiates the show sequence. Eventually the main view is hidden, which then
    initiates the hide sequence.
    
    Addressed this with the following changes.
    1. WebView::AttachWebContents and WebView::DetachWebContents
       now show and hide the webcontents native view. The
       WebContents is shown and hidden as before in
       WebContentsNativeViewAura::OnWindowVisibilityChanged.
    
    2. Removed the WebContentsNativeViewAura::OnWindowParentChanged function.
       This function was present to show and hide the webcontents if the window was visible.
       This should not be needed with the change in #1 above.
    
    3. Added a new file webview_unittest.cc. This contains the unittest WebViewUnitTest.TestWebViewAttachDetachWebContents
       This is run as part of unit_tests.exe.
    
    BUG=412989
    R=sky
    
    Review URL: https://codereview.chromium.org/564553002
    
    Cr-Commit-Position: refs/heads/master@{#294962}
    99941773
webview.cc 13 KB