WebKit Bugzilla
Attachment 341351 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-20180525163411.patch (text/plain), 11.85 KB, created by
Timothy Hatcher
on 2018-05-25 16:34:11 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Timothy Hatcher
Created:
2018-05-25 16:34:11 PDT
Size:
11.85 KB
patch
obsolete
>Subversion Revision: 232166 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0df47a50d46ba4bff665c7b1be935846e9f277c4..b0e530cafa7346af47c4397fd5f5d2ee6870a650 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2018-05-25 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 Simon Fraser. >+ >+ * 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. >+ > 2018-05-24 Chris Dumez <cdumez@apple.com> > > Cache navigator.userAgent for performance >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index aaceeb109812c0afeb6bf27841c59e53ca688b53..81a2d8ca172dfc9a43fe228b0d757f205de12feb 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,29 @@ >+2018-05-25 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 Simon Fraser. >+ >+ * 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. >+ > 2018-05-24 Jiewen Tan <jiewen_tan@apple.com> > > Adopt SecKeyProxy SPI in certificate based challenge response code >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 8e0d74bdcd7b82317eb9cbe821a1fac0d1487177..604c56a0241306619befb08d448f9ac9978900a4 100644 >--- a/Source/WebCore/page/FrameView.cpp >+++ b/Source/WebCore/page/FrameView.cpp >@@ -2894,6 +2894,7 @@ void FrameView::setTransparent(bool isTransparent) > return; > > renderView()->compositor().rootBackgroundTransparencyChanged(); >+ setNeedsLayout(); > } > > bool FrameView::hasOpaqueBackground() const >@@ -2909,7 +2910,7 @@ Color FrameView::baseBackgroundColor() const > void FrameView::setBaseBackgroundColor(const Color& backgroundColor) > { > bool wasOpaque = m_baseBackgroundColor.isOpaque(); >- >+ > if (!backgroundColor.isValid()) > m_baseBackgroundColor = Color::white; > else >@@ -2919,6 +2920,7 @@ void FrameView::setBaseBackgroundColor(const Color& backgroundColor) > return; > > recalculateScrollbarOverlayStyle(); >+ setNeedsLayout(); > > if (m_baseBackgroundColor.isOpaque() != wasOpaque) > renderView()->compositor().rootBackgroundTransparencyChanged(); >@@ -2930,6 +2932,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 3f539013ae3b03cbdeb5f28c2bc28006ade59034..8f60e7cdb275fbef0876bd10dc7382af634b9bda 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/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 82e4e046241ee209f5d789c63d0eb783b4feb71c..eb8efc938c97b4892b7bc4ba1f4efeafdaa9202d 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -2077,7 +2077,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..3a912b5a63a8b754f0eb68bed37e3a8b49c99752 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -461,6 +461,8 @@ WebPage::WebPage(uint64_t pageID, WebPageCreationParameters&& parameters) > m_mainFrame = WebFrame::createWithCoreMainFrame(this, &m_page->mainFrame()); > m_drawingArea->updatePreferences(parameters.store); > >+ setBackgroundExtendsBeyondPage(parameters.backgroundExtendsBeyondPage); >+ > #if ENABLE(GEOLOCATION) > WebCore::provideGeolocationTo(m_page.get(), *new WebGeolocationClient(*this)); > #endif >@@ -522,8 +524,6 @@ WebPage::WebPage(uint64_t pageID, WebPageCreationParameters&& parameters) > else > m_scrollbarOverlayStyle = std::optional<ScrollbarOverlayStyle>(); > >- setBackgroundExtendsBeyondPage(parameters.backgroundExtendsBeyondPage); >- > setTopContentInset(parameters.topContentInset); > > m_userAgent = parameters.userAgent; >@@ -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