WebKit Bugzilla
Attachment 341024 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-20180522142218.patch (text/plain), 12.13 KB, created by
Timothy Hatcher
on 2018-05-22 14:22:18 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Timothy Hatcher
Created:
2018-05-22 14:22:18 PDT
Size:
12.13 KB
patch
obsolete
>Subversion Revision: 231935 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index ca90dfca4c84ae551483239114eaa371c346ff87..31b4a8e3062993ae7030e69b53221953964424a7 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,26 @@ >+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. >+ * rendering/RenderLayerCompositor.cpp: >+ (WebCore::RenderLayerCompositor::viewHasTransparentBackground const): Use baseBackgroundColor >+ instead of hadcoding white. >+ (WebCore::RenderLayerCompositor::rootBackgroundTransparencyChanged): Fixed incorrect changed logging. >+ > 2018-05-17 Chris Dumez <cdumez@apple.com> > > RenderLayer::scrollRectToVisible() should not propagate a subframe's scroll to its cross-origin parent >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index b78c10b507a5fcb71b7355deb612428daa2060c5..508882ce71e21a2ce6fabb04ffe97801e61a15cf 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,26 @@ >+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/DrawingArea.h: >+ (WebKit::DrawingArea::pageBackgroundTransparencyChanged): Deleted. Was always empty. >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::setDrawsBackground): Use updateBackgroundRecursively to propagate the >+ correct base background color. Removed call to DrawingArea::pageBackgroundTransparencyChanged. >+ > 2018-05-17 Alex Christensen <achristensen@webkit.org> > > Use CompletionHandlers for DelayedReplies >diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp >index ab0a8ce21db4b2ee037b0750f79b361506a035e5..7fc26e5e49b0cf5c0e922fcb111edfebc57e2d52 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 ea6288f91a0ebaffbbb31cc523f0f4e1a90b6a63..aa78ea7ca064dea45501d17cd76f688ee9f0c6e8 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/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 a29f161eb49b4b2e3f4639a3779ba1144a42693a..665c71fad8612964cd0db6e2e7bb666adb1e3268 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 23bcfd72c66d954f386ff8812704aa30002df574..09e52d6c6bdd19632950e735c24d321a42fca4d5 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -701,8 +701,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 5d1ffd6a42a932c2ee2633d45dbc352e8ff3721c..dec35e7c6ac8f6b945a9d5ac5c08f372830c36f8 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 9c24a3f4f73c851481ac0ec9189b1a75e1e3ba48..a239c29680cc9c40d367b395c3f70d1ca1a6ccc2 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -2071,7 +2071,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/DrawingArea.h b/Source/WebKit/WebProcess/WebPage/DrawingArea.h >index 16eb4402158609b8e3b66f3122965a606bf0664c..45639aee29a3f49fe58c1c24d8873cfd7edbf8c9 100644 >--- a/Source/WebKit/WebProcess/WebPage/DrawingArea.h >+++ b/Source/WebKit/WebProcess/WebPage/DrawingArea.h >@@ -79,7 +79,6 @@ public: > virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta) = 0; > > // FIXME: These should be pure virtual. >- virtual void pageBackgroundTransparencyChanged() { } > virtual void forceRepaint() { } > virtual bool forceRepaintAsync(CallbackID) { return false; } > virtual void setLayerTreeStateIsFrozen(bool) { } >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 45a2356f4d7511b50f1ad80c03a5e27ae741c06d..dcd81693656254de11816ccb003f840c4273993d 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -2651,12 +2651,12 @@ 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(); > m_drawingArea->setNeedsDisplay(); > } >
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