WebKit Bugzilla
Attachment 341103 Details for
Bug 185885
: Setting drawsBackground to YES on a WKView doesn't take effect immediately
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185885-20180523102954.patch (text/plain), 11.42 KB, created by
Timothy Hatcher
on 2018-05-23 10:29:55 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Timothy Hatcher
Created:
2018-05-23 10:29:55 PDT
Size:
11.42 KB
patch
obsolete
>Subversion Revision: 232094 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c95c6c50eafe14eedc09ae161d12f4742d9c854e..2fa6e70ac15ac993eb939f32db4a59a5083cbfe8 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,29 @@ >+2018-05-22 Timothy Hatcher <timothy@apple.com> >+ >+ 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 NOBODY (OOPS!). >+ >+ * 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: >+ * page/Settings.yaml: Make backgroundShouldExtendBeyondPage default to true. WebKit was >+ always turning this on during WKWebView initializtion, which would cause the shadow >+ scroll layer to be created, flash black because of no background, then destroyed soon after >+ once WebKit's message to turn it on got delivered. >+ * rendering/RenderLayerCompositor.cpp: >+ (WebCore::RenderLayerCompositor::viewHasTransparentBackground const): Use baseBackgroundColor >+ instead of hadcoding white. >+ (WebCore::RenderLayerCompositor::rootBackgroundTransparencyChanged): Fixed incorrect changed logging. >+ > 2018-05-22 Dean Jackson <dino@apple.com> > > Optimized path zoom animation needs a valid UIImage and CGRect >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 3698602417e44b2c2b1335cc436420db1fde412a..1aa2d64fcdc42894bf07969fe77c6f845de7b45b 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,24 @@ >+2018-05-22 Timothy Hatcher <timothy@apple.com> >+ >+ 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 NOBODY (OOPS!). >+ >+ * 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: >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::setDrawsBackground): Use updateBackgroundRecursively to propagate the >+ correct base background color. >+ > 2018-05-22 Dean Jackson <dino@apple.com> > > Optimized path zoom animation needs a valid UIImage and CGRect >diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp >index 63bf3866e0ec37f8d604dfdc7dee72f4952e6949..742aa2abbd32a352ae3ee5c6353deae959d2185d 100644 >--- a/Source/WebCore/page/Frame.cpp >+++ b/Source/WebCore/page/Frame.cpp >@@ -935,8 +935,7 @@ void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor > > setView(frameView.copyRef()); > >- if (backgroundColor.isValid()) >- frameView->updateBackgroundRecursively(backgroundColor, transparent); >+ frameView->updateBackgroundRecursively(backgroundColor, transparent); > > if (isMainFrame) > frameView->setParentVisible(true); >diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp >index d21a4e03ca0c64166e0d9ece9b200d60bcca1ba3..4c2f0dd9372214a46b4c55bfae613b5beb557bbc 100644 >--- a/Source/WebCore/page/FrameView.cpp >+++ b/Source/WebCore/page/FrameView.cpp >@@ -2896,6 +2896,7 @@ void FrameView::setTransparent(bool isTransparent) > return; > > renderView()->compositor().rootBackgroundTransparencyChanged(); >+ setNeedsLayout(); > } > > bool FrameView::hasOpaqueBackground() const >@@ -2911,7 +2912,7 @@ Color FrameView::baseBackgroundColor() const > void FrameView::setBaseBackgroundColor(const Color& backgroundColor) > { > bool wasOpaque = m_baseBackgroundColor.isOpaque(); >- >+ > if (!backgroundColor.isValid()) > m_baseBackgroundColor = Color::white; > else >@@ -2921,6 +2922,7 @@ void FrameView::setBaseBackgroundColor(const Color& backgroundColor) > return; > > recalculateScrollbarOverlayStyle(); >+ setNeedsLayout(); > > if (m_baseBackgroundColor.isOpaque() != wasOpaque) > renderView()->compositor().rootBackgroundTransparencyChanged(); >@@ -2932,6 +2934,8 @@ void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool t > if (FrameView* view = frame->view()) { > view->setTransparent(transparent); > view->setBaseBackgroundColor(backgroundColor); >+ if (view->needsLayout()) >+ view->layoutContext().scheduleLayout(); > } > } > } >diff --git a/Source/WebCore/page/FrameView.h b/Source/WebCore/page/FrameView.h >index 70e0674b6d65dfe69df7ef2eebcc9e523155304b..3f6309e7cf4bff7baf4a36cfd843c75bbcd0399f 100644 >--- a/Source/WebCore/page/FrameView.h >+++ b/Source/WebCore/page/FrameView.h >@@ -187,7 +187,7 @@ public: > > WEBCORE_EXPORT Color baseBackgroundColor() const; > WEBCORE_EXPORT void setBaseBackgroundColor(const Color&); >- void updateBackgroundRecursively(const Color&, bool); >+ WEBCORE_EXPORT void updateBackgroundRecursively(const Color&, bool); > > enum ExtendedBackgroundModeFlags { > ExtendedBackgroundModeNone = 0, >diff --git a/Source/WebCore/page/Settings.yaml b/Source/WebCore/page/Settings.yaml >index 01bc6c8edc5a25751537fb905cf525938338399d..541bdb4771f97a1f12cb00879095a56684a19f0e 100644 >--- a/Source/WebCore/page/Settings.yaml >+++ b/Source/WebCore/page/Settings.yaml >@@ -659,7 +659,7 @@ dnsPrefetchingEnabled: > onChange: dnsPrefetchingEnabledChanged > > backgroundShouldExtendBeyondPage: >- initial: false >+ initial: true > onChange: backgroundShouldExtendBeyondPageChanged > > scrollingPerformanceLoggingEnabled: >diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp >index be7416f8d0a9b95c63164a9554aacd066b0777f9..537b0ad5aa11628173b5efc063a0894ccf50bbe7 100644 >--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp >+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp >@@ -3084,11 +3084,13 @@ bool RenderLayerCompositor::viewHasTransparentBackground(Color* backgroundColor) > > Color documentBackgroundColor = m_renderView.frameView().documentBackgroundColor(); > if (!documentBackgroundColor.isValid()) >- documentBackgroundColor = Color::white; >+ documentBackgroundColor = m_renderView.frameView().baseBackgroundColor(); >+ >+ ASSERT(documentBackgroundColor.isValid()); > > if (backgroundColor) > *backgroundColor = documentBackgroundColor; >- >+ > return !documentBackgroundColor.isOpaque(); > } > >@@ -3120,7 +3122,7 @@ void RenderLayerCompositor::rootBackgroundTransparencyChanged() > > bool isTransparent = viewHasTransparentBackground(); > >- LOG(Compositing, "RenderLayerCompositor %p rootBackgroundTransparencyChanged. isTransparent=%d, changed=%d", this, isTransparent, m_viewBackgroundIsTransparent == isTransparent); >+ LOG(Compositing, "RenderLayerCompositor %p rootBackgroundTransparencyChanged. isTransparent=%d, changed=%d", this, isTransparent, m_viewBackgroundIsTransparent != isTransparent); > if (m_viewBackgroundIsTransparent == isTransparent) > return; > >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >index e988f9a9aa6240c395febc40961663a76abbe1e3..9ef6f7d16ca4c4ff01dc4a3d6079c2f6a554c2a5 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -702,8 +702,6 @@ - (void)_initializeWithConfiguration:(WKWebViewConfiguration *)configuration > [self _updateAccessibilityEventsEnabled]; > #endif > >- _page->setBackgroundExtendsBeyondPage(true); >- > if (NSString *applicationNameForUserAgent = configuration.applicationNameForUserAgent) > _page->setApplicationNameForUserAgent(applicationNameForUserAgent); > >diff --git a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >index 591b02e1b9a0f373159b0f99da92c67c220d5a67..96b889b07d00a885971dc082f9374d4003f1dbd7 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >@@ -1393,6 +1393,9 @@ void WebViewImpl::didRelaunchProcess() > void WebViewImpl::setDrawsBackground(bool drawsBackground) > { > m_page->setDrawsBackground(drawsBackground); >+ >+ // Make sure updateLayer gets called on the web view. >+ [m_view setNeedsDisplay:YES]; > } > > bool WebViewImpl::drawsBackground() const >@@ -1403,6 +1406,9 @@ bool WebViewImpl::drawsBackground() const > void WebViewImpl::setBackgroundColor(NSColor *backgroundColor) > { > m_backgroundColor = backgroundColor; >+ >+ // Make sure updateLayer gets called on the web view. >+ [m_view setNeedsDisplay:YES]; > } > > NSColor *WebViewImpl::backgroundColor() const >@@ -1634,12 +1640,6 @@ void WebViewImpl::updateLayer() > [m_view layer].backgroundColor = CGColorGetConstantColor(draws ? kCGColorWhite : kCGColorClear); > else > [m_view layer].backgroundColor = [m_backgroundColor CGColor]; >- >- // If asynchronous geometry updates have been sent by forceAsyncDrawingAreaSizeUpdate, >- // then subsequent calls to setFrameSize should not result in us waiting for the did >- // udpate response if setFrameSize is called. >- if (frameSizeUpdatesDisabled()) >- return; > } > > void WebViewImpl::drawRect(CGRect rect) >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index c8b19f8858e7c699cefb46a83bc7f8b86030ec1e..e88ece052adfe8637294bb5f7a09b8e8f0f4a615 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -2073,7 +2073,7 @@ private: > bool m_enableVerticalRubberBanding { true }; > bool m_enableHorizontalRubberBanding { true }; > >- bool m_backgroundExtendsBeyondPage { false }; >+ bool m_backgroundExtendsBeyondPage { true }; > > bool m_shouldRecordNavigationSnapshots { false }; > bool m_isShowingNavigationGestureSnapshot { false }; >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index c1a313e807234b3f8614e2bb965678904d8d398d..7ca2d1d554198449a63051c0d47f7889ffaec4e2 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -2651,9 +2651,10 @@ void WebPage::setDrawsBackground(bool drawsBackground) > > m_drawsBackground = drawsBackground; > >- for (Frame* coreFrame = m_mainFrame->coreFrame(); coreFrame; coreFrame = coreFrame->tree().traverseNext()) { >- if (FrameView* view = coreFrame->view()) >- view->setTransparent(!drawsBackground); >+ if (FrameView* frameView = mainFrameView()) { >+ Color backgroundColor = drawsBackground ? Color::white : Color::transparent; >+ bool isTransparent = !drawsBackground; >+ frameView->updateBackgroundRecursively(backgroundColor, isTransparent); > } > > m_drawingArea->pageBackgroundTransparencyChanged();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185885
:
341024
|
341037
|
341039
|
341103
|
341107
|
341112
|
341351