WKWebView loses minimum layout size overrides that happen while the process is terminated
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Jan 2018 22:54:09 +0000 (22:54 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Jan 2018 22:54:09 +0000 (22:54 +0000)
commit1a2fcc096f7d546cb14e61e10f1e8ca96ceaa551
treed946b327c271e479bafc6ec86359af8b6491e318
parent68caee0d2a90ebabc853869d21b8cf98f0b6144f
WKWebView loses minimum layout size overrides that happen while the process is terminated
https://bugs.webkit.org/show_bug.cgi?id=181306
<rdar://problem/34398288>

Reviewed by Dan Bernstein.

Source/WebKit:

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _didRelaunchProcess]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didRelaunchProcess):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize):
(WebKit::WebPageProxy::setForceAlwaysUserScalable):
(WebKit::WebPageProxy::setMaximumUnobscuredSize):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
Pass the current viewport minimum layout size and maximum unobscured size
in the WebPageCreationParameters instead of re-sending them in _didRelaunchProcess.

The previous approach was problematic when _dispatchSetMinimumLayoutSize:
was changed to not re-send identical updates, because if the client calls
_overrideLayoutParametersWithMinimumLayoutSize before the Web Content process
is re-launched (after terminating), we would cache the size, attempt to send it,
fail silently (because the process is not launched), and then in _didRelaunchProcess
we would choose not to re-send (after the process is successfully relaunched)
because we think we already sent the new value.

Add isValid() checks to our message sends. Ideally send() would assert
if the process is not alive to avoid problems like this, but it doesn't (yet).

Get rid of WKWebView's _didRelaunchProcess, because it does nothing now.

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/AnimatedResize.mm:
(TEST):
Add a test that calling _overrideLayoutParametersWithMinimumLayoutSize
while the process is terminated results in the page getting the correct
minimum layout size.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226424 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPageCreationParameters.cpp
Source/WebKit/Shared/WebPageCreationParameters.h
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/AnimatedResize.mm