Setting drawsBackground to YES on a WKView doesn't take effect immediately
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 26 May 2018 00:13:43 +0000 (00:13 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 26 May 2018 00:13:43 +0000 (00:13 +0000)
commit0e545ddc431738aeec2fc65537feeea564c1e364
treeea53e19584f859d496a00ac7e06cc02b59349ed2
parent742ae0b07ce2c7c02919e799add7a336967f4dbf
Setting drawsBackground to YES on a WKView doesn't take effect immediately
https://bugs.webkit.org/show_bug.cgi?id=185885
rdar://problem/39706506

Reviewed by Simon Fraser.

Source/WebCore:

* page/Frame.cpp:
(WebCore::Frame::createView): Always call updateBackgroundRecursively, it handles
invalid colors correctly already.
* page/FrameView.cpp:
(WebCore::FrameView::setTransparent): Call setNeedsLayout() since base background color
and transparent is used to update layers.
(WebCore::FrameView::setBaseBackgroundColor): Ditto.
(WebCore::FrameView::updateBackgroundRecursively): Schedule layout if needed.
* page/FrameView.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::viewHasTransparentBackground const): Use baseBackgroundColor
instead of hardcoding white.
(WebCore::RenderLayerCompositor::rootBackgroundTransparencyChanged): Fixed incorrect changed logging.

Source/WebKit:

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]): Removed setBackgroundExtendsBeyondPage(true)
since it is now the default.
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::setDrawsBackground): Make sure updateLayer gets called on the web view
by calling setNeedsDisplay:YES.
(WebKit::WebViewImpl::setBackgroundColor): Ditto.
(WebKit::WebViewImpl::updateLayer): Removed dead code.
* UIProcess/WebPageProxy.h: Make m_backgroundExtendsBeyondPage default to true. WebKit was
always turning this on during WKWebView initializtion, which would cause the scroll
shadow layer to be created, flash black because of no background, then destroyed soon
after once WebKit's message to turn it on got delivered.
* WebProcess/WebPage/WebPage.cpp:
(WebPage::WebPage): Call setBackgroundExtendsBeyondPage earlier to avoid creating the scroll
shadow layer, since backgroundShouldExtendBeyondPage defautls to false in WebCore for WK1.
(WebKit::WebPage::setDrawsBackground): Use updateBackgroundRecursively to propagate the
correct base background color.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232218 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/page/Frame.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp