REGRESSION (PSON): White or Black flash occurs when process swapping on navigation...
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2018 12:06:11 +0000 (12:06 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2018 12:06:11 +0000 (12:06 +0000)
commitd7335371bb7faae63423c6d158a635f8d717c127
tree527288f8de9ff9019befb2497c0347efd0e245ec
parente800df4c7367cfab0d9f5492edfb79a865d20a28
REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on iOS
https://bugs.webkit.org/show_bug.cgi?id=189695
<rdar://problem/44551146>

Reviewed by Simon Fraser.

Freeze the layers on UI process side during process swap.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _processWillChange]):

Shared work of _processWillSwap and _processDidExit.

(-[WKWebView _processWillSwap]):
(-[WKWebView _processDidExit]):

Split into two functions. Don't reset scroll position and similar when doing navigation swap.

* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
(WebKit::RemoteLayerTreeDrawingAreaProxy::detachRemoteLayerTreeHost):

Add to way to detach RemoteLayerTreeHost from the drawing area. Inert RemoteLayerTreeHost will host
the frozen layers.

(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
(WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator):
(WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilPendingUpdate):
(WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilAnyUpdate):
(WebKit::RemoteLayerTreeDrawingAreaProxy::prepareForAppSuspension):
(WebKit::RemoteLayerTreeDrawingAreaProxy::hasVisibleContent const):
(WebKit::RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting const):
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::RemoteLayerTreeHost):
(WebKit::RemoteLayerTreeHost::updateLayerTree):
(WebKit::RemoteLayerTreeHost::animationDidStart):
(WebKit::RemoteLayerTreeHost::animationDidEnd):
(WebKit::RemoteLayerTreeHost::detachFromDrawingArea):

Clear the DrawingArea backpointer.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::resetState):

Detach and save the current RemoteLayerTreeHost on navigation swap.

* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::processWillSwap):

Avoid reseting the scroll position.

* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):

Drop the frozen layers after setting the new root layer.

* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):

For completeness do this also on Mac (where remote layers are currently not used).

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236500 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h
Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm
Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h
Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
Source/WebKit/UIProcess/ios/WKContentView.h
Source/WebKit/UIProcess/ios/WKContentView.mm
Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
Source/WebKit/UIProcess/mac/WebPageProxyMac.mm