<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[277598] branches/safari-612.1.15.1-branch</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/277598">277598</a></dd>
<dt>Author</dt> <dd>alancoon@apple.com</dd>
<dt>Date</dt> <dd>2021-05-17 11:54:31 -0700 (Mon, 17 May 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Cherry-pick <a href="http://trac.webkit.org/projects/webkit/changeset/277505">r277505</a>. rdar://problem/78110796

    Promote `-[WKWebView _pageExtendedBackgroundColor]` SPI to `-[WKWebView underPageBackgroundColor]` API
    https://bugs.webkit.org/show_bug.cgi?id=225615
    <rdar://problem/76568094>

    Reviewed by Wenson Hsieh.

    Source/WebCore:

    `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
     - the most recent non-null value provided
     - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
     - the underlying platform view's background color
    Modifications to this property will not have any effect until control is returned to the runloop.

    Tests: WKWebViewUnderPageBackgroundColor.OnLoad
           WKWebViewUnderPageBackgroundColor.SingleSolidColor
           WKWebViewUnderPageBackgroundColor.SingleBlendedColor
           WKWebViewUnderPageBackgroundColor.MultipleSolidColors
           WKWebViewUnderPageBackgroundColor.MultipleBlendedColors
           WKWebViewUnderPageBackgroundColor.KVO
           WKWebViewUnderPageBackgroundColor.MatchesScrollView

    * page/Page.h:
    (WebCore::Page::underPageBackgroundColorOverride const): Added.
    * page/Page.cpp:
    (WebCore::Page::setUnderPageBackgroundColorOverride): Added.
    Hold the client-overriden value for `underPageBackgroundColor` so that it can be used when
    drawing the overscroll layer.

    * rendering/RenderLayerCompositor.cpp:
    (WebCore::RenderLayerCompositor::updateLayerForOverhangAreasBackgroundColor):
    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.

    * dom/Document.cpp:
    (WebCore::Document::themeColorChanged):
    It's no longer necessary to force the overscroll area to redraw since that'll be handled by
    a client calling `-[WKWebView setUnderPageBackgroundColor:]` (possibly in response to a
    `-[WKWebView themeColor]` KVO notification).

    Source/WebKit:

    `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
     - the most recent non-null value provided
     - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
     - the underlying platform view's background color
    Modifications to this property will not have any effect until control is returned to the runloop.

    * UIProcess/API/Cocoa/WKWebView.h:
    * UIProcess/API/Cocoa/WKWebViewPrivate.h:
    * UIProcess/API/Cocoa/WKWebView.mm:
    (-[WKWebView underPageBackgroundColor]): Added.
    (-[WKWebView setUnderPageBackgroundColor:]): Added.
    (+[WKWebView automaticallyNotifiesObserversOfUnderPageBackgroundColor]): Added.

    * UIProcess/API/ios/WKWebViewIOS.mm:
    (baseScrollViewBackgroundColor):
    (scrollViewBackgroundColor):
    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.

    * UIProcess/WebPageProxy.h:
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::underPageBackgroundColor const): Added.
    (WebKit::WebPageProxy::setUnderPageBackgroundColorOverride): Added.
    (WebKit::WebPageProxy::pageExtendedBackgroundColorDidChange):
    (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
    (WebKit::WebPageProxy::scrollAreaBackgroundColor const): Deleted.
    * UIProcess/ios/WebPageProxyIOS.mm:
    (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
    * UIProcess/mac/WebPageProxyMac.mm:
    (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
    Store the client-overriden value for `underPageBackgroundColor` and manage state changes.

    * UIProcess/PageClient.h:
    (WebKit::PageClient::underPageBackgroundColorWillChange): Added.
    (WebKit::PageClient::underPageBackgroundColorDidChange): Added.
    * UIProcess/Cocoa/PageClientImplCocoa.h:
    * UIProcess/Cocoa/PageClientImplCocoa.mm:
    (WebKit::PageClientImplCocoa::underPageBackgroundColorWillChange): Added.
    (WebKit::PageClientImplCocoa::underPageBackgroundColorDidChange): Added.
    Add ObjC KVO support for `-[WKWebView underPageBackgroundColor]`.

    * UIProcess/ios/PageClientImplIOS.h:
    * UIProcess/ios/PageClientImplIOS.mm:
    (WebKit::PageClientImpl::contentViewBackgroundColor): Added.
    Provide a way to get the `backgroundColor` of the `WKContentView`. This is needed on iOS
    because `scrollViewBackgroundColor` (now `WebPageProxy::platformUnderPageBackgroundColor`)
    would use this value before falling back to the underlying platform view's background color.

    * WebProcess/WebPage/WebPage.messages.in:
    * WebProcess/WebPage/WebPage.h:
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::setUnderPageBackgroundColorOverride): Added.
    Pass the client-overriden value for `underPageBackgroundColor` to the WebProcess so that it
    can be used when drawing the overscroll layer.

    * UIProcess/ViewSnapshotStore.cpp:
    (WebKit::ViewSnapshotStore::recordSnapshot):
    Go back to using the `pageExtendedBackgroundColor` (before <a href="http://trac.webkit.org/projects/webkit/changeset/273083">r273083</a>).

    Source/WTF:

    `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
     - the most recent non-null value provided
     - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
     - the underlying platform view's background color
    Modifications to this property will not have any effect until control is returned to the runloop.

    * Scripts/Preferences/WebPreferencesInternal.yaml:
    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor`and
    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.

    Tools:

    * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewUnderPageBackgroundColor.mm: Renamed from PageExtendedBackgroundColor.mm.
    (defaultBackgroundColor): Added.
    (TEST.WKWebViewUnderPageBackgroundColor.OnLoad):
    (TEST.WKWebViewUnderPageBackgroundColor.SingleSolidColor): Added.
    (TEST.WKWebViewUnderPageBackgroundColor.SingleBlendedColor): Added.
    (TEST.WKWebViewUnderPageBackgroundColor.MultipleSolidColors): Added.
    (TEST.WKWebViewUnderPageBackgroundColor.MultipleBlendedColors): Added.
    (-[WKWebViewUnderPageBackgroundColorObserver initWithWebView:]): Added.
    (-[WKWebViewUnderPageBackgroundColorObserver observeValueForKeyPath:ofObject:change:context:]): Added.
    (TEST.WKWebViewUnderPageBackgroundColor.KVO):
    (TEST.WKWebViewUnderPageBackgroundColor.MatchesScrollView): Added.
    (TEST.WKWebViewUnderPageBackgroundColor.MultipleStyles): Deleted.
    (-[WKWebViewPageExtendedBackgroundColorObserver initWithWebView:]): Deleted.
    (-[WKWebViewPageExtendedBackgroundColorObserver observeValueForKeyPath:ofObject:change:context:]): Deleted.

    * TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm:
    (createWebViewWithSampledPageTopColorMaxDifference):
    (TEST.SampledPageTopColor.ExperimentalUseSampledPageTopColorForScrollAreaBackgroundColor): Deleted.
    * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewThemeColor.mm:
    (createWebView): Deleted.
    (TEST.WKWebView.ExperimentalUseThemeColorForScrollAreaBackgroundColor): Deleted.
    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.

    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277505 268f45cc-cd09-0410-ab3c-d52691b4dbfc</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6121151branchSourceWTFChangeLog">branches/safari-612.1.15.1-branch/Source/WTF/ChangeLog</a></li>
<li><a href="#branchessafari6121151branchSourceWTFScriptsPreferencesWebPreferencesInternalyaml">branches/safari-612.1.15.1-branch/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml</a></li>
<li><a href="#branchessafari6121151branchSourceWebCoreChangeLog">branches/safari-612.1.15.1-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6121151branchSourceWebCoredomDocumentcpp">branches/safari-612.1.15.1-branch/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#branchessafari6121151branchSourceWebCorepagePagecpp">branches/safari-612.1.15.1-branch/Source/WebCore/page/Page.cpp</a></li>
<li><a href="#branchessafari6121151branchSourceWebCorepagePageh">branches/safari-612.1.15.1-branch/Source/WebCore/page/Page.h</a></li>
<li><a href="#branchessafari6121151branchSourceWebCorerenderingRenderLayerCompositorcpp">branches/safari-612.1.15.1-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitChangeLog">branches/safari-612.1.15.1-branch/Source/WebKit/ChangeLog</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitUIProcessAPICocoaWKWebViewh">branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitUIProcessAPICocoaWKWebViewmm">branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitUIProcessAPICocoaWKWebViewPrivateh">branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitUIProcessAPIiosWKWebViewIOSmm">branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitUIProcessCocoaPageClientImplCocoah">branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitUIProcessCocoaPageClientImplCocoamm">branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitUIProcessPageClienth">branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/PageClient.h</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitUIProcessViewSnapshotStorecpp">branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ViewSnapshotStore.cpp</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitUIProcessWebPageProxycpp">branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitUIProcessWebPageProxyh">branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/WebPageProxy.h</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitUIProcessiosPageClientImplIOSh">branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.h</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitUIProcessiosPageClientImplIOSmm">branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitUIProcessiosWebPageProxyIOSmm">branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitUIProcessmacWebPageProxyMacmm">branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitWebProcessWebPageWebPagecpp">branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitWebProcessWebPageWebPageh">branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#branchessafari6121151branchSourceWebKitWebProcessWebPageWebPagemessagesin">branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.messages.in</a></li>
<li><a href="#branchessafari6121151branchToolsChangeLog">branches/safari-612.1.15.1-branch/Tools/ChangeLog</a></li>
<li><a href="#branchessafari6121151branchToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
<li><a href="#branchessafari6121151branchToolsTestWebKitAPITestsWebKitCocoaSampledPageTopColormm">branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm</a></li>
<li><a href="#branchessafari6121151branchToolsTestWebKitAPITestsWebKitCocoaWKWebViewThemeColormm">branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewThemeColor.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari6121151branchToolsTestWebKitAPITestsWebKitCocoaWKWebViewUnderPageBackgroundColormm">branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewUnderPageBackgroundColor.mm</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#branchessafari6121151branchToolsTestWebKitAPITestsWebKitCocoaPageExtendedBackgroundColormm">branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/PageExtendedBackgroundColor.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6121151branchSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WTF/ChangeLog (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WTF/ChangeLog   2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WTF/ChangeLog      2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -1,3 +1,174 @@
</span><ins>+2021-05-17  Russell Epstein  <repstein@apple.com>
+
+        Cherry-pick r277505. rdar://problem/78110796
+
+    Promote `-[WKWebView _pageExtendedBackgroundColor]` SPI to `-[WKWebView underPageBackgroundColor]` API
+    https://bugs.webkit.org/show_bug.cgi?id=225615
+    <rdar://problem/76568094>
+    
+    Reviewed by Wenson Hsieh.
+    
+    Source/WebCore:
+    
+    `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
+     - the most recent non-null value provided
+     - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
+     - the underlying platform view's background color
+    Modifications to this property will not have any effect until control is returned to the runloop.
+    
+    Tests: WKWebViewUnderPageBackgroundColor.OnLoad
+           WKWebViewUnderPageBackgroundColor.SingleSolidColor
+           WKWebViewUnderPageBackgroundColor.SingleBlendedColor
+           WKWebViewUnderPageBackgroundColor.MultipleSolidColors
+           WKWebViewUnderPageBackgroundColor.MultipleBlendedColors
+           WKWebViewUnderPageBackgroundColor.KVO
+           WKWebViewUnderPageBackgroundColor.MatchesScrollView
+    
+    * page/Page.h:
+    (WebCore::Page::underPageBackgroundColorOverride const): Added.
+    * page/Page.cpp:
+    (WebCore::Page::setUnderPageBackgroundColorOverride): Added.
+    Hold the client-overriden value for `underPageBackgroundColor` so that it can be used when
+    drawing the overscroll layer.
+    
+    * rendering/RenderLayerCompositor.cpp:
+    (WebCore::RenderLayerCompositor::updateLayerForOverhangAreasBackgroundColor):
+    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
+    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+    
+    * dom/Document.cpp:
+    (WebCore::Document::themeColorChanged):
+    It's no longer necessary to force the overscroll area to redraw since that'll be handled by
+    a client calling `-[WKWebView setUnderPageBackgroundColor:]` (possibly in response to a
+    `-[WKWebView themeColor]` KVO notification).
+    
+    Source/WebKit:
+    
+    `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
+     - the most recent non-null value provided
+     - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
+     - the underlying platform view's background color
+    Modifications to this property will not have any effect until control is returned to the runloop.
+    
+    * UIProcess/API/Cocoa/WKWebView.h:
+    * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+    * UIProcess/API/Cocoa/WKWebView.mm:
+    (-[WKWebView underPageBackgroundColor]): Added.
+    (-[WKWebView setUnderPageBackgroundColor:]): Added.
+    (+[WKWebView automaticallyNotifiesObserversOfUnderPageBackgroundColor]): Added.
+    
+    * UIProcess/API/ios/WKWebViewIOS.mm:
+    (baseScrollViewBackgroundColor):
+    (scrollViewBackgroundColor):
+    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
+    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+    
+    * UIProcess/WebPageProxy.h:
+    * UIProcess/WebPageProxy.cpp:
+    (WebKit::WebPageProxy::underPageBackgroundColor const): Added.
+    (WebKit::WebPageProxy::setUnderPageBackgroundColorOverride): Added.
+    (WebKit::WebPageProxy::pageExtendedBackgroundColorDidChange):
+    (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
+    (WebKit::WebPageProxy::scrollAreaBackgroundColor const): Deleted.
+    * UIProcess/ios/WebPageProxyIOS.mm:
+    (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
+    * UIProcess/mac/WebPageProxyMac.mm:
+    (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
+    Store the client-overriden value for `underPageBackgroundColor` and manage state changes.
+    
+    * UIProcess/PageClient.h:
+    (WebKit::PageClient::underPageBackgroundColorWillChange): Added.
+    (WebKit::PageClient::underPageBackgroundColorDidChange): Added.
+    * UIProcess/Cocoa/PageClientImplCocoa.h:
+    * UIProcess/Cocoa/PageClientImplCocoa.mm:
+    (WebKit::PageClientImplCocoa::underPageBackgroundColorWillChange): Added.
+    (WebKit::PageClientImplCocoa::underPageBackgroundColorDidChange): Added.
+    Add ObjC KVO support for `-[WKWebView underPageBackgroundColor]`.
+    
+    * UIProcess/ios/PageClientImplIOS.h:
+    * UIProcess/ios/PageClientImplIOS.mm:
+    (WebKit::PageClientImpl::contentViewBackgroundColor): Added.
+    Provide a way to get the `backgroundColor` of the `WKContentView`. This is needed on iOS
+    because `scrollViewBackgroundColor` (now `WebPageProxy::platformUnderPageBackgroundColor`)
+    would use this value before falling back to the underlying platform view's background color.
+    
+    * WebProcess/WebPage/WebPage.messages.in:
+    * WebProcess/WebPage/WebPage.h:
+    * WebProcess/WebPage/WebPage.cpp:
+    (WebKit::WebPage::setUnderPageBackgroundColorOverride): Added.
+    Pass the client-overriden value for `underPageBackgroundColor` to the WebProcess so that it
+    can be used when drawing the overscroll layer.
+    
+    * UIProcess/ViewSnapshotStore.cpp:
+    (WebKit::ViewSnapshotStore::recordSnapshot):
+    Go back to using the `pageExtendedBackgroundColor` (before r273083).
+    
+    Source/WTF:
+    
+    `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
+     - the most recent non-null value provided
+     - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
+     - the underlying platform view's background color
+    Modifications to this property will not have any effect until control is returned to the runloop.
+    
+    * Scripts/Preferences/WebPreferencesInternal.yaml:
+    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor`and
+    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewUnderPageBackgroundColor.mm: Renamed from PageExtendedBackgroundColor.mm.
+    (defaultBackgroundColor): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.OnLoad):
+    (TEST.WKWebViewUnderPageBackgroundColor.SingleSolidColor): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.SingleBlendedColor): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.MultipleSolidColors): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.MultipleBlendedColors): Added.
+    (-[WKWebViewUnderPageBackgroundColorObserver initWithWebView:]): Added.
+    (-[WKWebViewUnderPageBackgroundColorObserver observeValueForKeyPath:ofObject:change:context:]): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.KVO):
+    (TEST.WKWebViewUnderPageBackgroundColor.MatchesScrollView): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.MultipleStyles): Deleted.
+    (-[WKWebViewPageExtendedBackgroundColorObserver initWithWebView:]): Deleted.
+    (-[WKWebViewPageExtendedBackgroundColorObserver observeValueForKeyPath:ofObject:change:context:]): Deleted.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm:
+    (createWebViewWithSampledPageTopColorMaxDifference):
+    (TEST.SampledPageTopColor.ExperimentalUseSampledPageTopColorForScrollAreaBackgroundColor): Deleted.
+    * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewThemeColor.mm:
+    (createWebView): Deleted.
+    (TEST.WKWebView.ExperimentalUseThemeColorForScrollAreaBackgroundColor): Deleted.
+    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
+    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+    
+    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277505 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-05-14  Devin Rousso  <drousso@apple.com>
+
+            Promote `-[WKWebView _pageExtendedBackgroundColor]` SPI to `-[WKWebView underPageBackgroundColor]` API
+            https://bugs.webkit.org/show_bug.cgi?id=225615
+            <rdar://problem/76568094>
+
+            Reviewed by Wenson Hsieh.
+
+            `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
+             - the most recent non-null value provided
+             - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
+             - the underlying platform view's background color
+            Modifications to this property will not have any effect until control is returned to the runloop.
+
+            * Scripts/Preferences/WebPreferencesInternal.yaml:
+            Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor`and
+            `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+            overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+
</ins><span class="cx"> 2021-05-13  Chris Dumez  <cdumez@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Rename FileSystem::fileIsDirectory(path, followSymlinks) to isDirectory(path) / isDirectoryFollowingSymlinks(path)
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWTFScriptsPreferencesWebPreferencesInternalyaml"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml     2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml        2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -760,30 +760,6 @@
</span><span class="cx">     WebKit:
</span><span class="cx">       default: defaultUseGPUProcessForDOMRenderingEnabled()
</span><span class="cx"> 
</span><del>-UseSampledPageTopColorForScrollAreaBackgroundColor:
-  type: bool
-  humanReadableName: "Use sampled page top color for scroll area background color"
-  humanReadableDescription: "Use sampled page top color for scroll area background color"
-  defaultValue:
-    WebKitLegacy:
-      default: false
-    WebKit:
-      default: false
-    WebCore:
-      default: false
-
-UseThemeColorForScrollAreaBackgroundColor:
-  type: bool
-  humanReadableName: "Use theme-color for scroll area background color"
-  humanReadableDescription: "Use theme-color for scroll area background color"
-  defaultValue:
-    WebKitLegacy:
-      default: false
-    WebKit:
-      default: false
-    WebCore:
-      default: false
-
</del><span class="cx"> # FIXME: Remove once <rdar://73830961> has been fixed
</span><span class="cx"> UseiTunesAVOutputContext:
</span><span class="cx">   type: bool
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebCore/ChangeLog (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebCore/ChangeLog       2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebCore/ChangeLog  2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -1,5 +1,198 @@
</span><span class="cx"> 2021-05-17  Russell Epstein  <repstein@apple.com>
</span><span class="cx"> 
</span><ins>+        Cherry-pick r277505. rdar://problem/78110796
+
+    Promote `-[WKWebView _pageExtendedBackgroundColor]` SPI to `-[WKWebView underPageBackgroundColor]` API
+    https://bugs.webkit.org/show_bug.cgi?id=225615
+    <rdar://problem/76568094>
+    
+    Reviewed by Wenson Hsieh.
+    
+    Source/WebCore:
+    
+    `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
+     - the most recent non-null value provided
+     - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
+     - the underlying platform view's background color
+    Modifications to this property will not have any effect until control is returned to the runloop.
+    
+    Tests: WKWebViewUnderPageBackgroundColor.OnLoad
+           WKWebViewUnderPageBackgroundColor.SingleSolidColor
+           WKWebViewUnderPageBackgroundColor.SingleBlendedColor
+           WKWebViewUnderPageBackgroundColor.MultipleSolidColors
+           WKWebViewUnderPageBackgroundColor.MultipleBlendedColors
+           WKWebViewUnderPageBackgroundColor.KVO
+           WKWebViewUnderPageBackgroundColor.MatchesScrollView
+    
+    * page/Page.h:
+    (WebCore::Page::underPageBackgroundColorOverride const): Added.
+    * page/Page.cpp:
+    (WebCore::Page::setUnderPageBackgroundColorOverride): Added.
+    Hold the client-overriden value for `underPageBackgroundColor` so that it can be used when
+    drawing the overscroll layer.
+    
+    * rendering/RenderLayerCompositor.cpp:
+    (WebCore::RenderLayerCompositor::updateLayerForOverhangAreasBackgroundColor):
+    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
+    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+    
+    * dom/Document.cpp:
+    (WebCore::Document::themeColorChanged):
+    It's no longer necessary to force the overscroll area to redraw since that'll be handled by
+    a client calling `-[WKWebView setUnderPageBackgroundColor:]` (possibly in response to a
+    `-[WKWebView themeColor]` KVO notification).
+    
+    Source/WebKit:
+    
+    `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
+     - the most recent non-null value provided
+     - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
+     - the underlying platform view's background color
+    Modifications to this property will not have any effect until control is returned to the runloop.
+    
+    * UIProcess/API/Cocoa/WKWebView.h:
+    * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+    * UIProcess/API/Cocoa/WKWebView.mm:
+    (-[WKWebView underPageBackgroundColor]): Added.
+    (-[WKWebView setUnderPageBackgroundColor:]): Added.
+    (+[WKWebView automaticallyNotifiesObserversOfUnderPageBackgroundColor]): Added.
+    
+    * UIProcess/API/ios/WKWebViewIOS.mm:
+    (baseScrollViewBackgroundColor):
+    (scrollViewBackgroundColor):
+    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
+    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+    
+    * UIProcess/WebPageProxy.h:
+    * UIProcess/WebPageProxy.cpp:
+    (WebKit::WebPageProxy::underPageBackgroundColor const): Added.
+    (WebKit::WebPageProxy::setUnderPageBackgroundColorOverride): Added.
+    (WebKit::WebPageProxy::pageExtendedBackgroundColorDidChange):
+    (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
+    (WebKit::WebPageProxy::scrollAreaBackgroundColor const): Deleted.
+    * UIProcess/ios/WebPageProxyIOS.mm:
+    (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
+    * UIProcess/mac/WebPageProxyMac.mm:
+    (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
+    Store the client-overriden value for `underPageBackgroundColor` and manage state changes.
+    
+    * UIProcess/PageClient.h:
+    (WebKit::PageClient::underPageBackgroundColorWillChange): Added.
+    (WebKit::PageClient::underPageBackgroundColorDidChange): Added.
+    * UIProcess/Cocoa/PageClientImplCocoa.h:
+    * UIProcess/Cocoa/PageClientImplCocoa.mm:
+    (WebKit::PageClientImplCocoa::underPageBackgroundColorWillChange): Added.
+    (WebKit::PageClientImplCocoa::underPageBackgroundColorDidChange): Added.
+    Add ObjC KVO support for `-[WKWebView underPageBackgroundColor]`.
+    
+    * UIProcess/ios/PageClientImplIOS.h:
+    * UIProcess/ios/PageClientImplIOS.mm:
+    (WebKit::PageClientImpl::contentViewBackgroundColor): Added.
+    Provide a way to get the `backgroundColor` of the `WKContentView`. This is needed on iOS
+    because `scrollViewBackgroundColor` (now `WebPageProxy::platformUnderPageBackgroundColor`)
+    would use this value before falling back to the underlying platform view's background color.
+    
+    * WebProcess/WebPage/WebPage.messages.in:
+    * WebProcess/WebPage/WebPage.h:
+    * WebProcess/WebPage/WebPage.cpp:
+    (WebKit::WebPage::setUnderPageBackgroundColorOverride): Added.
+    Pass the client-overriden value for `underPageBackgroundColor` to the WebProcess so that it
+    can be used when drawing the overscroll layer.
+    
+    * UIProcess/ViewSnapshotStore.cpp:
+    (WebKit::ViewSnapshotStore::recordSnapshot):
+    Go back to using the `pageExtendedBackgroundColor` (before r273083).
+    
+    Source/WTF:
+    
+    `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
+     - the most recent non-null value provided
+     - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
+     - the underlying platform view's background color
+    Modifications to this property will not have any effect until control is returned to the runloop.
+    
+    * Scripts/Preferences/WebPreferencesInternal.yaml:
+    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor`and
+    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewUnderPageBackgroundColor.mm: Renamed from PageExtendedBackgroundColor.mm.
+    (defaultBackgroundColor): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.OnLoad):
+    (TEST.WKWebViewUnderPageBackgroundColor.SingleSolidColor): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.SingleBlendedColor): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.MultipleSolidColors): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.MultipleBlendedColors): Added.
+    (-[WKWebViewUnderPageBackgroundColorObserver initWithWebView:]): Added.
+    (-[WKWebViewUnderPageBackgroundColorObserver observeValueForKeyPath:ofObject:change:context:]): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.KVO):
+    (TEST.WKWebViewUnderPageBackgroundColor.MatchesScrollView): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.MultipleStyles): Deleted.
+    (-[WKWebViewPageExtendedBackgroundColorObserver initWithWebView:]): Deleted.
+    (-[WKWebViewPageExtendedBackgroundColorObserver observeValueForKeyPath:ofObject:change:context:]): Deleted.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm:
+    (createWebViewWithSampledPageTopColorMaxDifference):
+    (TEST.SampledPageTopColor.ExperimentalUseSampledPageTopColorForScrollAreaBackgroundColor): Deleted.
+    * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewThemeColor.mm:
+    (createWebView): Deleted.
+    (TEST.WKWebView.ExperimentalUseThemeColorForScrollAreaBackgroundColor): Deleted.
+    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
+    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+    
+    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277505 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-05-14  Devin Rousso  <drousso@apple.com>
+
+            Promote `-[WKWebView _pageExtendedBackgroundColor]` SPI to `-[WKWebView underPageBackgroundColor]` API
+            https://bugs.webkit.org/show_bug.cgi?id=225615
+            <rdar://problem/76568094>
+
+            Reviewed by Wenson Hsieh.
+
+            `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
+             - the most recent non-null value provided
+             - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
+             - the underlying platform view's background color
+            Modifications to this property will not have any effect until control is returned to the runloop.
+
+            Tests: WKWebViewUnderPageBackgroundColor.OnLoad
+                   WKWebViewUnderPageBackgroundColor.SingleSolidColor
+                   WKWebViewUnderPageBackgroundColor.SingleBlendedColor
+                   WKWebViewUnderPageBackgroundColor.MultipleSolidColors
+                   WKWebViewUnderPageBackgroundColor.MultipleBlendedColors
+                   WKWebViewUnderPageBackgroundColor.KVO
+                   WKWebViewUnderPageBackgroundColor.MatchesScrollView
+
+            * page/Page.h:
+            (WebCore::Page::underPageBackgroundColorOverride const): Added.
+            * page/Page.cpp:
+            (WebCore::Page::setUnderPageBackgroundColorOverride): Added.
+            Hold the client-overriden value for `underPageBackgroundColor` so that it can be used when
+            drawing the overscroll layer.
+
+            * rendering/RenderLayerCompositor.cpp:
+            (WebCore::RenderLayerCompositor::updateLayerForOverhangAreasBackgroundColor):
+            Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
+            `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+            overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+
+            * dom/Document.cpp:
+            (WebCore::Document::themeColorChanged):
+            It's no longer necessary to force the overscroll area to redraw since that'll be handled by
+            a client calling `-[WKWebView setUnderPageBackgroundColor:]` (possibly in response to a
+            `-[WKWebView themeColor]` KVO notification).
+
+2021-05-17  Russell Epstein  <repstein@apple.com>
+
</ins><span class="cx">         Cherry-pick r277459. rdar://problem/78110796
</span><span class="cx"> 
</span><span class="cx">     [macOS] experimental "Use theme color for scroll area background" isn't working
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebCore/dom/Document.cpp (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebCore/dom/Document.cpp        2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebCore/dom/Document.cpp   2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -3901,13 +3901,6 @@
</span><span class="cx"> 
</span><span class="cx">     if (auto* page = this->page())
</span><span class="cx">         page->chrome().client().themeColorChanged();
</span><del>-
-#if ENABLE(RUBBER_BANDING)
-    if (auto* view = renderView()) {
-        if (view->usesCompositing())
-            view->compositor().updateLayerForOverhangAreasBackgroundColor();
-    }
-#endif // ENABLE(RUBBER_BANDING)
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool isValidPageSampleLocation(Document& document, const IntPoint& location)
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebCore/page/Page.cpp (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebCore/page/Page.cpp   2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebCore/page/Page.cpp      2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -2563,6 +2563,25 @@
</span><span class="cx">     return document->sampledPageTopColor();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Page::setUnderPageBackgroundColorOverride(Color&& underPageBackgroundColorOverride)
+{
+    if (underPageBackgroundColorOverride == m_underPageBackgroundColorOverride)
+        return;
+
+    m_underPageBackgroundColorOverride = WTFMove(underPageBackgroundColorOverride);
+
+    scheduleRenderingUpdate({ });
+
+#if ENABLE(RUBBER_BANDING)
+    if (auto frameView = makeRefPtr(mainFrame().view())) {
+        if (auto* renderView = frameView->renderView()) {
+            if (renderView->usesCompositing())
+                renderView->compositor().updateLayerForOverhangAreasBackgroundColor();
+        }
+    }
+#endif // ENABLE(RUBBER_BANDING)
+}
+
</ins><span class="cx"> // These are magical constants that might be tweaked over time.
</span><span class="cx"> static const double gMinimumPaintedAreaRatio = 0.1;
</span><span class="cx"> static const double gMaximumUnpaintedAreaRatio = 0.04;
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebCorepagePageh"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebCore/page/Page.h (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebCore/page/Page.h     2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebCore/page/Page.h        2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -623,6 +623,9 @@
</span><span class="cx">     WEBCORE_EXPORT Color pageExtendedBackgroundColor() const;
</span><span class="cx">     WEBCORE_EXPORT Color sampledPageTopColor() const;
</span><span class="cx"> 
</span><ins>+    Color underPageBackgroundColorOverride() const { return m_underPageBackgroundColorOverride; }
+    WEBCORE_EXPORT void setUnderPageBackgroundColorOverride(Color&&);
+
</ins><span class="cx">     bool isCountingRelevantRepaintedObjects() const;
</span><span class="cx">     void setIsCountingRelevantRepaintedObjects(bool isCounting) { m_isCountingRelevantRepaintedObjects = isCounting; }
</span><span class="cx">     void startCountingRelevantRepaintedObjects();
</span><span class="lines">@@ -1152,6 +1155,8 @@
</span><span class="cx"> 
</span><span class="cx">     MonotonicTime m_lastRenderingUpdateTimestamp;
</span><span class="cx"> 
</span><ins>+    Color m_underPageBackgroundColorOverride;
+
</ins><span class="cx">     const bool m_httpsUpgradeEnabled { true };
</span><span class="cx">     mutable MediaSessionGroupIdentifier m_mediaSessionGroupIdentifier;
</span><span class="cx"> };
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebCorerenderingRenderLayerCompositorcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp     2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp        2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -3882,16 +3882,9 @@
</span><span class="cx"> 
</span><span class="cx">     if (m_renderView.settings().backgroundShouldExtendBeyondPage()) {
</span><span class="cx">         backgroundColor = ([&] {
</span><del>-            if (page().settings().useThemeColorForScrollAreaBackgroundColor()) {
-                if (auto themeColor = page().themeColor(); themeColor.isValid())
-                    return themeColor;
-            }
</del><ins>+            if (auto underPageBackgroundColorOverride = page().underPageBackgroundColorOverride(); underPageBackgroundColorOverride.isValid())
+                return underPageBackgroundColorOverride;
</ins><span class="cx"> 
</span><del>-            if (page().settings().useSampledPageTopColorForScrollAreaBackgroundColor()) {
-                if (auto sampledPageTopColor = page().sampledPageTopColor(); sampledPageTopColor.isValid())
-                    return sampledPageTopColor;
-            }
-
</del><span class="cx">             return m_rootExtendedBackgroundColor;
</span><span class="cx">         })();
</span><span class="cx">         m_layerForOverhangAreas->setBackgroundColor(backgroundColor);
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/ChangeLog (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/ChangeLog        2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/ChangeLog   2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -1,5 +1,225 @@
</span><span class="cx"> 2021-05-17  Russell Epstein  <repstein@apple.com>
</span><span class="cx"> 
</span><ins>+        Cherry-pick r277505. rdar://problem/78110796
+
+    Promote `-[WKWebView _pageExtendedBackgroundColor]` SPI to `-[WKWebView underPageBackgroundColor]` API
+    https://bugs.webkit.org/show_bug.cgi?id=225615
+    <rdar://problem/76568094>
+    
+    Reviewed by Wenson Hsieh.
+    
+    Source/WebCore:
+    
+    `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
+     - the most recent non-null value provided
+     - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
+     - the underlying platform view's background color
+    Modifications to this property will not have any effect until control is returned to the runloop.
+    
+    Tests: WKWebViewUnderPageBackgroundColor.OnLoad
+           WKWebViewUnderPageBackgroundColor.SingleSolidColor
+           WKWebViewUnderPageBackgroundColor.SingleBlendedColor
+           WKWebViewUnderPageBackgroundColor.MultipleSolidColors
+           WKWebViewUnderPageBackgroundColor.MultipleBlendedColors
+           WKWebViewUnderPageBackgroundColor.KVO
+           WKWebViewUnderPageBackgroundColor.MatchesScrollView
+    
+    * page/Page.h:
+    (WebCore::Page::underPageBackgroundColorOverride const): Added.
+    * page/Page.cpp:
+    (WebCore::Page::setUnderPageBackgroundColorOverride): Added.
+    Hold the client-overriden value for `underPageBackgroundColor` so that it can be used when
+    drawing the overscroll layer.
+    
+    * rendering/RenderLayerCompositor.cpp:
+    (WebCore::RenderLayerCompositor::updateLayerForOverhangAreasBackgroundColor):
+    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
+    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+    
+    * dom/Document.cpp:
+    (WebCore::Document::themeColorChanged):
+    It's no longer necessary to force the overscroll area to redraw since that'll be handled by
+    a client calling `-[WKWebView setUnderPageBackgroundColor:]` (possibly in response to a
+    `-[WKWebView themeColor]` KVO notification).
+    
+    Source/WebKit:
+    
+    `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
+     - the most recent non-null value provided
+     - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
+     - the underlying platform view's background color
+    Modifications to this property will not have any effect until control is returned to the runloop.
+    
+    * UIProcess/API/Cocoa/WKWebView.h:
+    * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+    * UIProcess/API/Cocoa/WKWebView.mm:
+    (-[WKWebView underPageBackgroundColor]): Added.
+    (-[WKWebView setUnderPageBackgroundColor:]): Added.
+    (+[WKWebView automaticallyNotifiesObserversOfUnderPageBackgroundColor]): Added.
+    
+    * UIProcess/API/ios/WKWebViewIOS.mm:
+    (baseScrollViewBackgroundColor):
+    (scrollViewBackgroundColor):
+    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
+    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+    
+    * UIProcess/WebPageProxy.h:
+    * UIProcess/WebPageProxy.cpp:
+    (WebKit::WebPageProxy::underPageBackgroundColor const): Added.
+    (WebKit::WebPageProxy::setUnderPageBackgroundColorOverride): Added.
+    (WebKit::WebPageProxy::pageExtendedBackgroundColorDidChange):
+    (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
+    (WebKit::WebPageProxy::scrollAreaBackgroundColor const): Deleted.
+    * UIProcess/ios/WebPageProxyIOS.mm:
+    (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
+    * UIProcess/mac/WebPageProxyMac.mm:
+    (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
+    Store the client-overriden value for `underPageBackgroundColor` and manage state changes.
+    
+    * UIProcess/PageClient.h:
+    (WebKit::PageClient::underPageBackgroundColorWillChange): Added.
+    (WebKit::PageClient::underPageBackgroundColorDidChange): Added.
+    * UIProcess/Cocoa/PageClientImplCocoa.h:
+    * UIProcess/Cocoa/PageClientImplCocoa.mm:
+    (WebKit::PageClientImplCocoa::underPageBackgroundColorWillChange): Added.
+    (WebKit::PageClientImplCocoa::underPageBackgroundColorDidChange): Added.
+    Add ObjC KVO support for `-[WKWebView underPageBackgroundColor]`.
+    
+    * UIProcess/ios/PageClientImplIOS.h:
+    * UIProcess/ios/PageClientImplIOS.mm:
+    (WebKit::PageClientImpl::contentViewBackgroundColor): Added.
+    Provide a way to get the `backgroundColor` of the `WKContentView`. This is needed on iOS
+    because `scrollViewBackgroundColor` (now `WebPageProxy::platformUnderPageBackgroundColor`)
+    would use this value before falling back to the underlying platform view's background color.
+    
+    * WebProcess/WebPage/WebPage.messages.in:
+    * WebProcess/WebPage/WebPage.h:
+    * WebProcess/WebPage/WebPage.cpp:
+    (WebKit::WebPage::setUnderPageBackgroundColorOverride): Added.
+    Pass the client-overriden value for `underPageBackgroundColor` to the WebProcess so that it
+    can be used when drawing the overscroll layer.
+    
+    * UIProcess/ViewSnapshotStore.cpp:
+    (WebKit::ViewSnapshotStore::recordSnapshot):
+    Go back to using the `pageExtendedBackgroundColor` (before r273083).
+    
+    Source/WTF:
+    
+    `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
+     - the most recent non-null value provided
+     - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
+     - the underlying platform view's background color
+    Modifications to this property will not have any effect until control is returned to the runloop.
+    
+    * Scripts/Preferences/WebPreferencesInternal.yaml:
+    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor`and
+    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewUnderPageBackgroundColor.mm: Renamed from PageExtendedBackgroundColor.mm.
+    (defaultBackgroundColor): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.OnLoad):
+    (TEST.WKWebViewUnderPageBackgroundColor.SingleSolidColor): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.SingleBlendedColor): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.MultipleSolidColors): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.MultipleBlendedColors): Added.
+    (-[WKWebViewUnderPageBackgroundColorObserver initWithWebView:]): Added.
+    (-[WKWebViewUnderPageBackgroundColorObserver observeValueForKeyPath:ofObject:change:context:]): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.KVO):
+    (TEST.WKWebViewUnderPageBackgroundColor.MatchesScrollView): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.MultipleStyles): Deleted.
+    (-[WKWebViewPageExtendedBackgroundColorObserver initWithWebView:]): Deleted.
+    (-[WKWebViewPageExtendedBackgroundColorObserver observeValueForKeyPath:ofObject:change:context:]): Deleted.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm:
+    (createWebViewWithSampledPageTopColorMaxDifference):
+    (TEST.SampledPageTopColor.ExperimentalUseSampledPageTopColorForScrollAreaBackgroundColor): Deleted.
+    * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewThemeColor.mm:
+    (createWebView): Deleted.
+    (TEST.WKWebView.ExperimentalUseThemeColorForScrollAreaBackgroundColor): Deleted.
+    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
+    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+    
+    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277505 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-05-14  Devin Rousso  <drousso@apple.com>
+
+            Promote `-[WKWebView _pageExtendedBackgroundColor]` SPI to `-[WKWebView underPageBackgroundColor]` API
+            https://bugs.webkit.org/show_bug.cgi?id=225615
+            <rdar://problem/76568094>
+
+            Reviewed by Wenson Hsieh.
+
+            `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
+             - the most recent non-null value provided
+             - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
+             - the underlying platform view's background color
+            Modifications to this property will not have any effect until control is returned to the runloop.
+
+            * UIProcess/API/Cocoa/WKWebView.h:
+            * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+            * UIProcess/API/Cocoa/WKWebView.mm:
+            (-[WKWebView underPageBackgroundColor]): Added.
+            (-[WKWebView setUnderPageBackgroundColor:]): Added.
+            (+[WKWebView automaticallyNotifiesObserversOfUnderPageBackgroundColor]): Added.
+
+            * UIProcess/API/ios/WKWebViewIOS.mm:
+            (baseScrollViewBackgroundColor):
+            (scrollViewBackgroundColor):
+            Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
+            `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+            overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+
+            * UIProcess/WebPageProxy.h:
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::underPageBackgroundColor const): Added.
+            (WebKit::WebPageProxy::setUnderPageBackgroundColorOverride): Added.
+            (WebKit::WebPageProxy::pageExtendedBackgroundColorDidChange):
+            (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
+            (WebKit::WebPageProxy::scrollAreaBackgroundColor const): Deleted.
+            * UIProcess/ios/WebPageProxyIOS.mm:
+            (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
+            * UIProcess/mac/WebPageProxyMac.mm:
+            (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
+            Store the client-overriden value for `underPageBackgroundColor` and manage state changes.
+
+            * UIProcess/PageClient.h:
+            (WebKit::PageClient::underPageBackgroundColorWillChange): Added.
+            (WebKit::PageClient::underPageBackgroundColorDidChange): Added.
+            * UIProcess/Cocoa/PageClientImplCocoa.h:
+            * UIProcess/Cocoa/PageClientImplCocoa.mm:
+            (WebKit::PageClientImplCocoa::underPageBackgroundColorWillChange): Added.
+            (WebKit::PageClientImplCocoa::underPageBackgroundColorDidChange): Added.
+            Add ObjC KVO support for `-[WKWebView underPageBackgroundColor]`.
+
+            * UIProcess/ios/PageClientImplIOS.h:
+            * UIProcess/ios/PageClientImplIOS.mm:
+            (WebKit::PageClientImpl::contentViewBackgroundColor): Added.
+            Provide a way to get the `backgroundColor` of the `WKContentView`. This is needed on iOS
+            because `scrollViewBackgroundColor` (now `WebPageProxy::platformUnderPageBackgroundColor`)
+            would use this value before falling back to the underlying platform view's background color.
+
+            * WebProcess/WebPage/WebPage.messages.in:
+            * WebProcess/WebPage/WebPage.h:
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::setUnderPageBackgroundColorOverride): Added.
+            Pass the client-overriden value for `underPageBackgroundColor` to the WebProcess so that it
+            can be used when drawing the overscroll layer.
+
+            * UIProcess/ViewSnapshotStore.cpp:
+            (WebKit::ViewSnapshotStore::recordSnapshot):
+            Go back to using the `pageExtendedBackgroundColor` (before r273083).
+
+2021-05-17  Russell Epstein  <repstein@apple.com>
+
</ins><span class="cx">         Cherry-pick r277528. rdar://problem/78109685
</span><span class="cx"> 
</span><span class="cx">     REGRESSION (r269824): Random tile corruption when scrolling/zooming in macCatalyst
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitUIProcessAPICocoaWKWebViewh"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h  2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h     2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -580,6 +580,20 @@
</span><span class="cx"> @property (nonatomic, readonly, nullable) NSColor *themeColor WK_API_AVAILABLE(macos(WK_MAC_TBA));
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+/*! @abstract The color drawn behind the active page.
+ @discussion A color derived from the content of the active page, such as by blending the background color of
+ the <html> and <body> elements with the @link backgroundColor @/link of this @link WKWebView @/link. Used as
+ the background color under the page's content, such as for scroll bouncing areas. Can be overridden by the
+ owner application for custom styling without having to modify the page's style.
+ the background of scroll bouncing areas.
+ @link WKWebView @/link is key-value observing (KVO) compliant for this property.
+ */
+#if TARGET_OS_IPHONE
+@property (nonatomic, null_resettable, copy) UIColor *underPageBackgroundColor WK_API_AVAILABLE(ios(WK_IOS_TBA));
+#else
+@property (nonatomic, null_resettable, copy) NSColor *underPageBackgroundColor WK_API_AVAILABLE(macos(WK_MAC_TBA));
+#endif
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #if !TARGET_OS_IPHONE
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitUIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm    2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -1721,6 +1721,21 @@
</span><span class="cx">     return WebCore::platformColor(themeColor);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (CocoaColor *)underPageBackgroundColor
+{
+    return WebCore::platformColor(_page->underPageBackgroundColor());
+}
+
+- (void)setUnderPageBackgroundColor:(CocoaColor *)underPageBackgroundColorOverride
+{
+    _page->setUnderPageBackgroundColorOverride(underPageBackgroundColorOverride.CGColor);
+}
+
++ (BOOL)automaticallyNotifiesObserversOfUnderPageBackgroundColor
+{
+    return NO;
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #pragma mark -
</span><span class="lines">@@ -3188,11 +3203,13 @@
</span><span class="cx">     _page->setCanUseCredentialStorage(canUseCredentialStorage);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// FIXME: Remove old `-[WKWebView _themeColor]` SPI <rdar://76662644>
</ins><span class="cx"> - (CocoaColor *)_themeColor
</span><span class="cx"> {
</span><span class="cx">     return [self themeColor];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// FIXME: Remove old `-[WKWebView _pageExtendedBackgroundColor]` SPI <rdar://77789732>
</ins><span class="cx"> - (CocoaColor *)_pageExtendedBackgroundColor
</span><span class="cx"> {
</span><span class="cx">     auto pageExtendedBackgroundColor = _page->pageExtendedBackgroundColor();
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitUIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h   2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h      2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -380,10 +380,11 @@
</span><span class="cx"> @property (nonatomic, readonly) NSColor *_themeColor WK_API_DEPRECATED_WITH_REPLACEMENT("themeColor", macos(WK_MAC_TBA, WK_MAC_TBA));
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+// FIXME: Remove old `-[WKWebView _pageExtendedBackgroundColor]` SPI <rdar://77789732>
</ins><span class="cx"> #if TARGET_OS_IPHONE
</span><del>-@property (nonatomic, readonly) UIColor *_pageExtendedBackgroundColor WK_API_AVAILABLE(ios(WK_IOS_TBA));
</del><ins>+@property (nonatomic, readonly) UIColor *_pageExtendedBackgroundColor WK_API_DEPRECATED_WITH_REPLACEMENT("underPageBackgroundColor", ios(WK_IOS_TBA, WK_IOS_TBA));
</ins><span class="cx"> #else
</span><del>-@property (nonatomic, readonly) NSColor *_pageExtendedBackgroundColor;
</del><ins>+@property (nonatomic, readonly) NSColor *_pageExtendedBackgroundColor WK_API_DEPRECATED_WITH_REPLACEMENT("underPageBackgroundColor", macos(10.10, WK_MAC_TBA));
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> // Only set if `-[WKWebViewConfiguration _sampledPageTopColorMaxDifference]` is a positive number.
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitUIProcessAPIiosWKWebViewIOSmm"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm        2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm   2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -493,7 +493,7 @@
</span><span class="cx">     if (!webView->_page)
</span><span class="cx">         return { };
</span><span class="cx"> 
</span><del>-    return webView->_page->scrollAreaBackgroundColor();
</del><ins>+    return webView->_page->underPageBackgroundColor();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static WebCore::Color scrollViewBackgroundColor(WKWebView *webView)
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitUIProcessCocoaPageClientImplCocoah"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h    2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h       2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> class AlternativeTextUIController;
</span><ins>+class Color;
</ins><span class="cx"> 
</span><span class="cx"> struct AppHighlight;
</span><span class="cx"> }
</span><span class="lines">@@ -53,6 +54,8 @@
</span><span class="cx"> 
</span><span class="cx">     void themeColorWillChange() final;
</span><span class="cx">     void themeColorDidChange() final;
</span><ins>+    void underPageBackgroundColorWillChange() final;
+    void underPageBackgroundColorDidChange() final;
</ins><span class="cx">     void pageExtendedBackgroundColorWillChange() final;
</span><span class="cx">     void pageExtendedBackgroundColorDidChange() final;
</span><span class="cx">     void sampledPageTopColorWillChange() final;
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitUIProcessCocoaPageClientImplCocoamm"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm   2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm      2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -47,6 +47,8 @@
</span><span class="cx"> void PageClientImplCocoa::themeColorWillChange()
</span><span class="cx"> {
</span><span class="cx">     [m_webView willChangeValueForKey:@"themeColor"];
</span><ins>+
+    // FIXME: Remove old `-[WKWebView _themeColor]` SPI <rdar://76662644>
</ins><span class="cx">     [m_webView willChangeValueForKey:@"_themeColor"];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -53,16 +55,30 @@
</span><span class="cx"> void PageClientImplCocoa::themeColorDidChange()
</span><span class="cx"> {
</span><span class="cx">     [m_webView didChangeValueForKey:@"themeColor"];
</span><ins>+
+    // FIXME: Remove old `-[WKWebView _themeColor]` SPI <rdar://76662644>
</ins><span class="cx">     [m_webView didChangeValueForKey:@"_themeColor"];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PageClientImplCocoa::underPageBackgroundColorWillChange()
+{
+    [m_webView willChangeValueForKey:@"underPageBackgroundColor"];
+}
+
+void PageClientImplCocoa::underPageBackgroundColorDidChange()
+{
+    [m_webView didChangeValueForKey:@"underPageBackgroundColor"];
+}
+
</ins><span class="cx"> void PageClientImplCocoa::pageExtendedBackgroundColorWillChange()
</span><span class="cx"> {
</span><ins>+    // FIXME: Remove old `-[WKWebView _pageExtendedBackgroundColor]` SPI <rdar://77789732>
</ins><span class="cx">     [m_webView willChangeValueForKey:@"_pageExtendedBackgroundColor"];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PageClientImplCocoa::pageExtendedBackgroundColorDidChange()
</span><span class="cx"> {
</span><ins>+    // FIXME: Remove old `-[WKWebView _pageExtendedBackgroundColor]` SPI <rdar://77789732>
</ins><span class="cx">     [m_webView didChangeValueForKey:@"_pageExtendedBackgroundColor"];
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitUIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/PageClient.h (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/PageClient.h   2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/PageClient.h      2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -490,6 +490,8 @@
</span><span class="cx"> #if HAVE(UISCROLLVIEW_ASYNCHRONOUS_SCROLL_EVENT_HANDLING)
</span><span class="cx">     virtual void handleAsynchronousCancelableScrollEvent(UIScrollView *, UIScrollEvent *, void (^completion)(BOOL handled)) = 0;
</span><span class="cx"> #endif
</span><ins>+
+    virtual WebCore::Color contentViewBackgroundColor() = 0;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     // Auxiliary Client Creation
</span><span class="lines">@@ -514,6 +516,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void themeColorWillChange() { }
</span><span class="cx">     virtual void themeColorDidChange() { }
</span><ins>+    virtual void underPageBackgroundColorWillChange() { }
+    virtual void underPageBackgroundColorDidChange() { }
</ins><span class="cx">     virtual void pageExtendedBackgroundColorWillChange() { }
</span><span class="cx">     virtual void pageExtendedBackgroundColorDidChange() { }
</span><span class="cx">     virtual void sampledPageTopColorWillChange() { }
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitUIProcessViewSnapshotStorecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ViewSnapshotStore.cpp (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ViewSnapshotStore.cpp  2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ViewSnapshotStore.cpp     2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx"> 
</span><span class="cx">     snapshot->setRenderTreeSize(webPageProxy.renderTreeSize());
</span><span class="cx">     snapshot->setDeviceScaleFactor(webPageProxy.deviceScaleFactor());
</span><del>-    snapshot->setBackgroundColor(webPageProxy.scrollAreaBackgroundColor());
</del><ins>+    snapshot->setBackgroundColor(webPageProxy.pageExtendedBackgroundColor());
</ins><span class="cx">     snapshot->setViewScrollPosition(WebCore::roundedIntPoint(webPageProxy.viewScrollPosition()));
</span><span class="cx"> 
</span><span class="cx">     item.setSnapshot(WTFMove(snapshot));
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitUIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/WebPageProxy.cpp       2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/WebPageProxy.cpp  2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -1911,17 +1911,56 @@
</span><span class="cx">         send(Messages::WebPage::SetUnderlayColor(color));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Color WebPageProxy::scrollAreaBackgroundColor() const
</del><ins>+Color WebPageProxy::underPageBackgroundColor() const
</ins><span class="cx"> {
</span><del>-    if (m_preferences->useThemeColorForScrollAreaBackgroundColor() && m_themeColor.isValid())
-        return m_themeColor;
</del><ins>+    if (m_underPageBackgroundColorOverride.isValid())
+        return m_underPageBackgroundColorOverride;
</ins><span class="cx"> 
</span><del>-    if (m_preferences->useSampledPageTopColorForScrollAreaBackgroundColor() && m_sampledPageTopColor.isValid())
-        return m_sampledPageTopColor;
</del><ins>+    if (m_pageExtendedBackgroundColor.isValid())
+        return m_pageExtendedBackgroundColor;
</ins><span class="cx"> 
</span><del>-    return m_pageExtendedBackgroundColor;
</del><ins>+    return platformUnderPageBackgroundColor();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::setUnderPageBackgroundColorOverride(Color&& newUnderPageBackgroundColorOverride)
+{
+    if (newUnderPageBackgroundColorOverride == m_underPageBackgroundColorOverride)
+        return;
+
+    auto oldUnderPageBackgroundColor = underPageBackgroundColor();
+    auto oldUnderPageBackgroundColorOverride = std::exchange(m_underPageBackgroundColorOverride, newUnderPageBackgroundColorOverride);
+    bool changesUnderPageBackgroundColor = !equalIgnoringSemanticColor(oldUnderPageBackgroundColor, underPageBackgroundColor());
+    m_underPageBackgroundColorOverride = WTFMove(oldUnderPageBackgroundColorOverride);
+
+    if (changesUnderPageBackgroundColor)
+        pageClient().underPageBackgroundColorWillChange();
+
+    m_underPageBackgroundColorOverride = WTFMove(newUnderPageBackgroundColorOverride);
+
+    if (changesUnderPageBackgroundColor)
+        pageClient().underPageBackgroundColorDidChange();
+
+    if (m_hasPendingUnderPageBackgroundColorOverrideToDispatch)
+        return;
+
+    m_hasPendingUnderPageBackgroundColorOverrideToDispatch = true;
+
+    RunLoop::main().dispatch([this, weakThis = makeWeakPtr(*this)] {
+        if (!weakThis)
+            return;
+
+        if (!m_hasPendingUnderPageBackgroundColorOverrideToDispatch)
+            return;
+
+        m_hasPendingUnderPageBackgroundColorOverrideToDispatch = false;
+
+        didChangeBackgroundColor();
+
+        if (hasRunningProcess())
+            send(Messages::WebPage::SetUnderPageBackgroundColorOverride(m_underPageBackgroundColorOverride));
+    });
+}
+
</ins><span class="cx"> void WebPageProxy::viewWillStartLiveResize()
</span><span class="cx"> {
</span><span class="cx">     if (!hasRunningProcess())
</span><span class="lines">@@ -8558,13 +8597,24 @@
</span><span class="cx">     pageClient().themeColorDidChange();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::pageExtendedBackgroundColorDidChange(const Color& pageExtendedBackgroundColor)
</del><ins>+void WebPageProxy::pageExtendedBackgroundColorDidChange(const Color& newPageExtendedBackgroundColor)
</ins><span class="cx"> {
</span><del>-    if (m_pageExtendedBackgroundColor == pageExtendedBackgroundColor)
</del><ins>+    if (m_pageExtendedBackgroundColor == newPageExtendedBackgroundColor)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    auto oldUnderPageBackgroundColor = underPageBackgroundColor();
+    auto oldPageExtendedBackgroundColor = std::exchange(m_pageExtendedBackgroundColor, newPageExtendedBackgroundColor);
+    bool changesUnderPageBackgroundColor = !equalIgnoringSemanticColor(oldUnderPageBackgroundColor, underPageBackgroundColor());
+    m_pageExtendedBackgroundColor = WTFMove(oldPageExtendedBackgroundColor);
+
+    if (changesUnderPageBackgroundColor)
+        pageClient().underPageBackgroundColorWillChange();
</ins><span class="cx">     pageClient().pageExtendedBackgroundColorWillChange();
</span><del>-    m_pageExtendedBackgroundColor = pageExtendedBackgroundColor;
</del><ins>+
+    m_pageExtendedBackgroundColor = newPageExtendedBackgroundColor;
+
+    if (changesUnderPageBackgroundColor)
+        pageClient().underPageBackgroundColorDidChange();
</ins><span class="cx">     pageClient().pageExtendedBackgroundColorDidChange();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -8578,6 +8628,15 @@
</span><span class="cx">     pageClient().sampledPageTopColorDidChange();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(COCOA)
+
+Color WebPageProxy::platformUnderPageBackgroundColor() const
+{
+    return Color::transparentBlack;
+}
+
+#endif // !PLATFORM(COCOA)
+
</ins><span class="cx"> #if ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx"> void WebPageProxy::didFailToInitializePlugin(const String& mimeType, const String& frameURLString, const String& pageURLString)
</span><span class="cx"> {
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitUIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/WebPageProxy.h (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/WebPageProxy.h 2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/WebPageProxy.h    2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -672,7 +672,9 @@
</span><span class="cx"> 
</span><span class="cx">     WebCore::Color sampledPageTopColor() const { return m_sampledPageTopColor; }
</span><span class="cx"> 
</span><del>-    WebCore::Color scrollAreaBackgroundColor() const;
</del><ins>+    WebCore::Color underPageBackgroundColor() const;
+    WebCore::Color underPageBackgroundColorOverride() const { return m_underPageBackgroundColorOverride; }
+    void setUnderPageBackgroundColorOverride(WebCore::Color&&);
</ins><span class="cx"> 
</span><span class="cx">     void viewWillStartLiveResize();
</span><span class="cx">     void viewWillEndLiveResize();
</span><span class="lines">@@ -2108,6 +2110,7 @@
</span><span class="cx">     void themeColorChanged(const WebCore::Color&);
</span><span class="cx">     void pageExtendedBackgroundColorDidChange(const WebCore::Color&);
</span><span class="cx">     void sampledPageTopColorChanged(const WebCore::Color&);
</span><ins>+    WebCore::Color platformUnderPageBackgroundColor() const;
</ins><span class="cx"> #if ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx">     void didFailToInitializePlugin(const String& mimeType, const String& frameURLString, const String& pageURLString);
</span><span class="cx">     void didBlockInsecurePluginVersion(const String& mimeType, const String& pluginURLString, const String& frameURLString, const String& pageURLString, bool replacementObscured);
</span><span class="lines">@@ -2652,10 +2655,13 @@
</span><span class="cx">     LayerHostingMode m_layerHostingMode { LayerHostingMode::InProcess };
</span><span class="cx"> 
</span><span class="cx">     WebCore::Color m_themeColor;
</span><ins>+    WebCore::Color m_underPageBackgroundColorOverride;
</ins><span class="cx">     WebCore::Color m_underlayColor;
</span><span class="cx">     WebCore::Color m_pageExtendedBackgroundColor;
</span><span class="cx">     WebCore::Color m_sampledPageTopColor;
</span><span class="cx"> 
</span><ins>+    bool m_hasPendingUnderPageBackgroundColorOverrideToDispatch { false };
+
</ins><span class="cx">     bool m_useFixedLayout { false };
</span><span class="cx">     WebCore::IntSize m_fixedLayoutSize;
</span><span class="cx">     Optional<WebCore::FloatRect> m_viewExposedRect;
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitUIProcessiosPageClientImplIOSh"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.h (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.h        2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.h   2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -293,6 +293,8 @@
</span><span class="cx">     void handleAsynchronousCancelableScrollEvent(UIScrollView *, UIScrollEvent *, void (^completion)(BOOL handled)) final;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    WebCore::Color contentViewBackgroundColor() final;
+
</ins><span class="cx">     WeakObjCPtr<WKContentView> m_contentView;
</span><span class="cx">     RetainPtr<WKEditorUndoTarget> m_undoTarget;
</span><span class="cx"> };
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitUIProcessiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm       2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm  2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -1008,6 +1008,11 @@
</span><span class="cx">     [m_contentView runModalJavaScriptDialog:WTFMove(callback)];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+WebCore::Color PageClientImpl::contentViewBackgroundColor()
+{
+    return [m_contentView backgroundColor].CGColor;
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(IOS_FAMILY)
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitUIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm    2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -1564,7 +1564,18 @@
</span><span class="cx">     pageClient().showDataDetectorsUIForPositionInformation(positionInfo);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Color WebPageProxy::platformUnderPageBackgroundColor() const
+{
+    if (auto contentViewBackgroundColor = pageClient().contentViewBackgroundColor(); contentViewBackgroundColor.isValid())
+        return contentViewBackgroundColor;
</ins><span class="cx"> 
</span><ins>+#if HAVE(OS_DARK_MODE_SUPPORT)
+    return UIColor.systemBackgroundColor.CGColor;
+#else
+    return UIColor.whiteColor.CGColor;
+#endif
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #undef RELEASE_LOG_IF_ALLOWED
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitUIProcessmacWebPageProxyMacmm"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm    2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -710,6 +710,15 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+Color WebPageProxy::platformUnderPageBackgroundColor() const
+{
+#if ENABLE(DARK_MODE_CSS)
+    return NSColor.controlBackgroundColor.CGColor;
+#else
+    return NSColor.whiteColor.CGColor;
+#endif
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(MAC)
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitWebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp   2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp      2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -2448,6 +2448,11 @@
</span><span class="cx">     injectedBundle->didReceiveMessageToPage(this, messageName, webProcess.transformHandlesToObjects(userData.object()).get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPage::setUnderPageBackgroundColorOverride(WebCore::Color&& underPageBackgroundColorOverride)
+{
+    m_page->setUnderPageBackgroundColorOverride(WTFMove(underPageBackgroundColorOverride));
+}
+
</ins><span class="cx"> #if !PLATFORM(IOS_FAMILY)
</span><span class="cx"> 
</span><span class="cx"> void WebPage::setHeaderPageBanner(PageBanner* pageBanner)
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitWebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.h (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.h     2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.h        2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -608,6 +608,8 @@
</span><span class="cx">     
</span><span class="cx">     void postInjectedBundleMessage(const String& messageName, const UserData&);
</span><span class="cx"> 
</span><ins>+    void setUnderPageBackgroundColorOverride(WebCore::Color&&);
+
</ins><span class="cx">     void setUnderlayColor(const WebCore::Color& color) { m_underlayColor = color; }
</span><span class="cx">     WebCore::Color underlayColor() const { return m_underlayColor; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6121151branchSourceWebKitWebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.messages.in   2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.messages.in      2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx">     SetTopContentInset(float contentInset)
</span><span class="cx"> 
</span><span class="cx">     SetUnderlayColor(WebCore::Color color)
</span><ins>+    SetUnderPageBackgroundColorOverride(WebCore::Color underPageBackgroundColorOverride)
</ins><span class="cx"> 
</span><span class="cx">     ViewWillStartLiveResize()
</span><span class="cx">     ViewWillEndLiveResize()
</span></span></pre></div>
<a id="branchessafari6121151branchToolsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Tools/ChangeLog (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Tools/ChangeLog        2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Tools/ChangeLog   2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -1,3 +1,190 @@
</span><ins>+2021-05-17  Russell Epstein  <repstein@apple.com>
+
+        Cherry-pick r277505. rdar://problem/78110796
+
+    Promote `-[WKWebView _pageExtendedBackgroundColor]` SPI to `-[WKWebView underPageBackgroundColor]` API
+    https://bugs.webkit.org/show_bug.cgi?id=225615
+    <rdar://problem/76568094>
+    
+    Reviewed by Wenson Hsieh.
+    
+    Source/WebCore:
+    
+    `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
+     - the most recent non-null value provided
+     - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
+     - the underlying platform view's background color
+    Modifications to this property will not have any effect until control is returned to the runloop.
+    
+    Tests: WKWebViewUnderPageBackgroundColor.OnLoad
+           WKWebViewUnderPageBackgroundColor.SingleSolidColor
+           WKWebViewUnderPageBackgroundColor.SingleBlendedColor
+           WKWebViewUnderPageBackgroundColor.MultipleSolidColors
+           WKWebViewUnderPageBackgroundColor.MultipleBlendedColors
+           WKWebViewUnderPageBackgroundColor.KVO
+           WKWebViewUnderPageBackgroundColor.MatchesScrollView
+    
+    * page/Page.h:
+    (WebCore::Page::underPageBackgroundColorOverride const): Added.
+    * page/Page.cpp:
+    (WebCore::Page::setUnderPageBackgroundColorOverride): Added.
+    Hold the client-overriden value for `underPageBackgroundColor` so that it can be used when
+    drawing the overscroll layer.
+    
+    * rendering/RenderLayerCompositor.cpp:
+    (WebCore::RenderLayerCompositor::updateLayerForOverhangAreasBackgroundColor):
+    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
+    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+    
+    * dom/Document.cpp:
+    (WebCore::Document::themeColorChanged):
+    It's no longer necessary to force the overscroll area to redraw since that'll be handled by
+    a client calling `-[WKWebView setUnderPageBackgroundColor:]` (possibly in response to a
+    `-[WKWebView themeColor]` KVO notification).
+    
+    Source/WebKit:
+    
+    `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
+     - the most recent non-null value provided
+     - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
+     - the underlying platform view's background color
+    Modifications to this property will not have any effect until control is returned to the runloop.
+    
+    * UIProcess/API/Cocoa/WKWebView.h:
+    * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+    * UIProcess/API/Cocoa/WKWebView.mm:
+    (-[WKWebView underPageBackgroundColor]): Added.
+    (-[WKWebView setUnderPageBackgroundColor:]): Added.
+    (+[WKWebView automaticallyNotifiesObserversOfUnderPageBackgroundColor]): Added.
+    
+    * UIProcess/API/ios/WKWebViewIOS.mm:
+    (baseScrollViewBackgroundColor):
+    (scrollViewBackgroundColor):
+    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
+    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+    
+    * UIProcess/WebPageProxy.h:
+    * UIProcess/WebPageProxy.cpp:
+    (WebKit::WebPageProxy::underPageBackgroundColor const): Added.
+    (WebKit::WebPageProxy::setUnderPageBackgroundColorOverride): Added.
+    (WebKit::WebPageProxy::pageExtendedBackgroundColorDidChange):
+    (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
+    (WebKit::WebPageProxy::scrollAreaBackgroundColor const): Deleted.
+    * UIProcess/ios/WebPageProxyIOS.mm:
+    (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
+    * UIProcess/mac/WebPageProxyMac.mm:
+    (WebKit::WebPageProxy::platformUnderPageBackgroundColor const): Added.
+    Store the client-overriden value for `underPageBackgroundColor` and manage state changes.
+    
+    * UIProcess/PageClient.h:
+    (WebKit::PageClient::underPageBackgroundColorWillChange): Added.
+    (WebKit::PageClient::underPageBackgroundColorDidChange): Added.
+    * UIProcess/Cocoa/PageClientImplCocoa.h:
+    * UIProcess/Cocoa/PageClientImplCocoa.mm:
+    (WebKit::PageClientImplCocoa::underPageBackgroundColorWillChange): Added.
+    (WebKit::PageClientImplCocoa::underPageBackgroundColorDidChange): Added.
+    Add ObjC KVO support for `-[WKWebView underPageBackgroundColor]`.
+    
+    * UIProcess/ios/PageClientImplIOS.h:
+    * UIProcess/ios/PageClientImplIOS.mm:
+    (WebKit::PageClientImpl::contentViewBackgroundColor): Added.
+    Provide a way to get the `backgroundColor` of the `WKContentView`. This is needed on iOS
+    because `scrollViewBackgroundColor` (now `WebPageProxy::platformUnderPageBackgroundColor`)
+    would use this value before falling back to the underlying platform view's background color.
+    
+    * WebProcess/WebPage/WebPage.messages.in:
+    * WebProcess/WebPage/WebPage.h:
+    * WebProcess/WebPage/WebPage.cpp:
+    (WebKit::WebPage::setUnderPageBackgroundColorOverride): Added.
+    Pass the client-overriden value for `underPageBackgroundColor` to the WebProcess so that it
+    can be used when drawing the overscroll layer.
+    
+    * UIProcess/ViewSnapshotStore.cpp:
+    (WebKit::ViewSnapshotStore::recordSnapshot):
+    Go back to using the `pageExtendedBackgroundColor` (before r273083).
+    
+    Source/WTF:
+    
+    `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
+     - the most recent non-null value provided
+     - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
+     - the underlying platform view's background color
+    Modifications to this property will not have any effect until control is returned to the runloop.
+    
+    * Scripts/Preferences/WebPreferencesInternal.yaml:
+    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor`and
+    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewUnderPageBackgroundColor.mm: Renamed from PageExtendedBackgroundColor.mm.
+    (defaultBackgroundColor): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.OnLoad):
+    (TEST.WKWebViewUnderPageBackgroundColor.SingleSolidColor): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.SingleBlendedColor): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.MultipleSolidColors): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.MultipleBlendedColors): Added.
+    (-[WKWebViewUnderPageBackgroundColorObserver initWithWebView:]): Added.
+    (-[WKWebViewUnderPageBackgroundColorObserver observeValueForKeyPath:ofObject:change:context:]): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.KVO):
+    (TEST.WKWebViewUnderPageBackgroundColor.MatchesScrollView): Added.
+    (TEST.WKWebViewUnderPageBackgroundColor.MultipleStyles): Deleted.
+    (-[WKWebViewPageExtendedBackgroundColorObserver initWithWebView:]): Deleted.
+    (-[WKWebViewPageExtendedBackgroundColorObserver observeValueForKeyPath:ofObject:change:context:]): Deleted.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm:
+    (createWebViewWithSampledPageTopColorMaxDifference):
+    (TEST.SampledPageTopColor.ExperimentalUseSampledPageTopColorForScrollAreaBackgroundColor): Deleted.
+    * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewThemeColor.mm:
+    (createWebView): Deleted.
+    (TEST.WKWebView.ExperimentalUseThemeColorForScrollAreaBackgroundColor): Deleted.
+    Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
+    `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+    overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+    
+    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277505 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-05-14  Devin Rousso  <drousso@apple.com>
+
+            Promote `-[WKWebView _pageExtendedBackgroundColor]` SPI to `-[WKWebView underPageBackgroundColor]` API
+            https://bugs.webkit.org/show_bug.cgi?id=225615
+            <rdar://problem/76568094>
+
+            Reviewed by Wenson Hsieh.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewUnderPageBackgroundColor.mm: Renamed from PageExtendedBackgroundColor.mm.
+            (defaultBackgroundColor): Added.
+            (TEST.WKWebViewUnderPageBackgroundColor.OnLoad):
+            (TEST.WKWebViewUnderPageBackgroundColor.SingleSolidColor): Added.
+            (TEST.WKWebViewUnderPageBackgroundColor.SingleBlendedColor): Added.
+            (TEST.WKWebViewUnderPageBackgroundColor.MultipleSolidColors): Added.
+            (TEST.WKWebViewUnderPageBackgroundColor.MultipleBlendedColors): Added.
+            (-[WKWebViewUnderPageBackgroundColorObserver initWithWebView:]): Added.
+            (-[WKWebViewUnderPageBackgroundColorObserver observeValueForKeyPath:ofObject:change:context:]): Added.
+            (TEST.WKWebViewUnderPageBackgroundColor.KVO):
+            (TEST.WKWebViewUnderPageBackgroundColor.MatchesScrollView): Added.
+            (TEST.WKWebViewUnderPageBackgroundColor.MultipleStyles): Deleted.
+            (-[WKWebViewPageExtendedBackgroundColorObserver initWithWebView:]): Deleted.
+            (-[WKWebViewPageExtendedBackgroundColorObserver observeValueForKeyPath:ofObject:change:context:]): Deleted.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm:
+            (createWebViewWithSampledPageTopColorMaxDifference):
+            (TEST.SampledPageTopColor.ExperimentalUseSampledPageTopColorForScrollAreaBackgroundColor): Deleted.
+            * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewThemeColor.mm:
+            (createWebView): Deleted.
+            (TEST.WKWebView.ExperimentalUseThemeColorForScrollAreaBackgroundColor): Deleted.
+            Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
+            `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
+            overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
+
+            * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2021-05-13  Chris Dumez  <cdumez@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Rename FileSystem::fileIsDirectory(path, followSymlinks) to isDirectory(path) / isDirectoryFollowingSymlinks(path)
</span></span></pre></div>
<a id="branchessafari6121151branchToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj    2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj       2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -874,7 +874,7 @@
</span><span class="cx">          93FCDB34263631560046DD7D /* SortedArrayMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93FCDB33263631560046DD7D /* SortedArrayMap.cpp */; };
</span><span class="cx">          95095F20262FFFA50000D920 /* SampledPageTopColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95095F1F262FFFA50000D920 /* SampledPageTopColor.mm */; };
</span><span class="cx">          950E4CC1252E75240071659F /* iOSStylusSupport.mm in Sources */ = {isa = PBXBuildFile; fileRef = 950E4CC0252E75230071659F /* iOSStylusSupport.mm */; };
</span><del>-               953ABB3525C0D682004C8B73 /* PageExtendedBackgroundColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 953ABB3425C0D681004C8B73 /* PageExtendedBackgroundColor.mm */; };
</del><ins>+                953ABB3525C0D682004C8B73 /* WKWebViewUnderPageBackgroundColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 953ABB3425C0D681004C8B73 /* WKWebViewUnderPageBackgroundColor.mm */; };
</ins><span class="cx">           95A524952581A10D00461FE9 /* WKWebViewThemeColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95A524942581A10D00461FE9 /* WKWebViewThemeColor.mm */; };
</span><span class="cx">          95B6B3B7251EBF2F00FC4382 /* MediaDocument.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95B6B3B6251EBF2F00FC4382 /* MediaDocument.mm */; };
</span><span class="cx">          9984FACC1CFFAF60008D198C /* WKWebViewTextInput.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9984FACA1CFFAEEE008D198C /* WKWebViewTextInput.mm */; };
</span><span class="lines">@@ -2576,7 +2576,7 @@
</span><span class="cx">          93FCDB33263631560046DD7D /* SortedArrayMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SortedArrayMap.cpp; sourceTree = "<group>"; };
</span><span class="cx">          95095F1F262FFFA50000D920 /* SampledPageTopColor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SampledPageTopColor.mm; sourceTree = "<group>"; };
</span><span class="cx">          950E4CC0252E75230071659F /* iOSStylusSupport.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = iOSStylusSupport.mm; sourceTree = "<group>"; };
</span><del>-               953ABB3425C0D681004C8B73 /* PageExtendedBackgroundColor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageExtendedBackgroundColor.mm; sourceTree = "<group>"; };
</del><ins>+                953ABB3425C0D681004C8B73 /* WKWebViewUnderPageBackgroundColor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewUnderPageBackgroundColor.mm; sourceTree = "<group>"; };
</ins><span class="cx">           95A524942581A10D00461FE9 /* WKWebViewThemeColor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewThemeColor.mm; sourceTree = "<group>"; };
</span><span class="cx">          95B6B3B6251EBF2F00FC4382 /* MediaDocument.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaDocument.mm; sourceTree = "<group>"; };
</span><span class="cx">          9984FACA1CFFAEEE008D198C /* WKWebViewTextInput.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewTextInput.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -3483,8 +3483,8 @@
</span><span class="cx">                          6351992722275C6A00890AD3 /* NavigationAction.mm */,
</span><span class="cx">                          5C8BC798218CF3E900813886 /* NetworkProcess.mm */,
</span><span class="cx">                          5CAE4637201937CD0051610F /* NetworkProcessCrashNonPersistentDataStore.mm */,
</span><ins>+                               CDCFFEC022E268D500DF4223 /* NoPauseWhenSwitchingTabs.mm */,
</ins><span class="cx">                           46A80F25264C29D400EEF20D /* NotificationAPI.mm */,
</span><del>-                               CDCFFEC022E268D500DF4223 /* NoPauseWhenSwitchingTabs.mm */,
</del><span class="cx">                           CD2D0D19213465560018C784 /* NowPlaying.mm */,
</span><span class="cx">                          2ECFF5541D9B12F800B55394 /* NowPlayingControlsTests.mm */,
</span><span class="cx">                          A10F047C1E3AD29C00C95E19 /* NSFileManagerExtras.mm */,
</span><span class="lines">@@ -3493,7 +3493,6 @@
</span><span class="cx">                          37A22AA51DCAA27200AFBFC4 /* ObservedRenderingProgressEventsAfterCrash.mm */,
</span><span class="cx">                          CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */,
</span><span class="cx">                          2DA2586E225C67DC00B45C1C /* OverrideViewportArguments.mm */,
</span><del>-                               953ABB3425C0D681004C8B73 /* PageExtendedBackgroundColor.mm */,
</del><span class="cx">                           2D3CA3A4221DF2390088E803 /* PageOverlayPlugin.mm */,
</span><span class="cx">                          51242CDA237B791E00EED9C1 /* PageZoom.mm */,
</span><span class="cx">                          F44C79FB20F9E50C0014478C /* ParserYieldTokenPlugIn.mm */,
</span><span class="lines">@@ -3637,6 +3636,7 @@
</span><span class="cx">                          CD7F89DB22A86CDA00D683AE /* WKWebViewSuspendAllMediaPlayback.mm */,
</span><span class="cx">                          9984FACA1CFFAEEE008D198C /* WKWebViewTextInput.mm */,
</span><span class="cx">                          95A524942581A10D00461FE9 /* WKWebViewThemeColor.mm */,
</span><ins>+                               953ABB3425C0D681004C8B73 /* WKWebViewUnderPageBackgroundColor.mm */,
</ins><span class="cx">                   );
</span><span class="cx">                  name = "WebKit Cocoa";
</span><span class="cx">                  path = WebKitCocoa;
</span><span class="lines">@@ -5452,7 +5452,6 @@
</span><span class="cx">                          CDB213BD24EF522800FDE301 /* FullscreenFocus.mm in Sources */,
</span><span class="cx">                          CDE77D2525A6591C00D4115E /* FullscreenPointerLeave.mm in Sources */,
</span><span class="cx">                          CDDC7C6925FFF6D000224278 /* FullscreenRemoveNodeBeforeEnter.mm in Sources */,
</span><del>-                               46A80F26264C29D400EEF20D /* NotificationAPI.mm in Sources */,
</del><span class="cx">                           CDBFCC451A9FF45300A7B691 /* FullscreenZoomInitialFrame.mm in Sources */,
</span><span class="cx">                          83DB79691EF63B3C00BFA5E5 /* Function.cpp in Sources */,
</span><span class="cx">                          7CCE7EF81A411AE600447C4C /* Geolocation.cpp in Sources */,
</span><span class="lines">@@ -5583,6 +5582,7 @@
</span><span class="cx">                          7CCE7F051A411AE600447C4C /* NewFirstVisuallyNonEmptyLayoutFrames.cpp in Sources */,
</span><span class="cx">                          0F5651F71FCE4DDC00310FBC /* NoHistoryItemScrollToFragment.mm in Sources */,
</span><span class="cx">                          83F22C6420B355F80034277E /* NoPolicyDelegateResponse.mm in Sources */,
</span><ins>+                               46A80F26264C29D400EEF20D /* NotificationAPI.mm in Sources */,
</ins><span class="cx">                           CD2D0D1A213465560018C784 /* NowPlaying.mm in Sources */,
</span><span class="cx">                          2ECFF5551D9B12F800B55394 /* NowPlayingControlsTests.mm in Sources */,
</span><span class="cx">                          5159F267260D43E300B2DA3C /* NowPlayingInfoTests.cpp in Sources */,
</span><span class="lines">@@ -5596,7 +5596,6 @@
</span><span class="cx">                          0F34077623037FDC0060A1A0 /* OverflowScrollViewTests.mm in Sources */,
</span><span class="cx">                          C104BC1F2547237100C078C9 /* OverrideAppleLanguagesPreference.mm in Sources */,
</span><span class="cx">                          2DA2586F225C67DC00B45C1C /* OverrideViewportArguments.mm in Sources */,
</span><del>-                               953ABB3525C0D682004C8B73 /* PageExtendedBackgroundColor.mm in Sources */,
</del><span class="cx">                           7CCB4DA91C83AE7300CC6918 /* PageGroup.cpp in Sources */,
</span><span class="cx">                          7CCE7F071A411AE600447C4C /* PageLoadBasic.cpp in Sources */,
</span><span class="cx">                          7CCE7F081A411AE600447C4C /* PageLoadDidChangeLocationWithinPageForFrame.cpp in Sources */,
</span><span class="lines">@@ -5878,6 +5877,7 @@
</span><span class="cx">                          CD7F89DC22A86CDA00D683AE /* WKWebViewSuspendAllMediaPlayback.mm in Sources */,
</span><span class="cx">                          9984FACC1CFFAF60008D198C /* WKWebViewTextInput.mm in Sources */,
</span><span class="cx">                          95A524952581A10D00461FE9 /* WKWebViewThemeColor.mm in Sources */,
</span><ins>+                               953ABB3525C0D682004C8B73 /* WKWebViewUnderPageBackgroundColor.mm in Sources */,
</ins><span class="cx">                           7C74C8FA22DFBA9600DA2DAB /* WTFStringUtilities.cpp in Sources */,
</span><span class="cx">                          C14D304624B4C3BA00480387 /* XPCEndpoint.mm in Sources */,
</span><span class="cx">                          9C64DC321D76198A004B598E /* YouTubePluginReplacement.cpp in Sources */,
</span></span></pre></div>
<a id="branchessafari6121151branchToolsTestWebKitAPITestsWebKitCocoaPageExtendedBackgroundColormm"></a>
<div class="delfile"><h4>Deleted: branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/PageExtendedBackgroundColor.mm (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/PageExtendedBackgroundColor.mm   2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/PageExtendedBackgroundColor.mm      2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -1,163 +0,0 @@
</span><del>-/*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-
-#import "CocoaColor.h"
-#import "TestCocoa.h"
-#import "TestWKWebView.h"
-#import <WebKit/WKWebViewPrivate.h>
-#import <wtf/RetainPtr.h>
-
-#define EXPECT_NSSTRING_EQ(expected, actual) \
-    EXPECT_TRUE([actual isKindOfClass:[NSString class]]); \
-    EXPECT_WK_STREQ(expected, (NSString *)actual);
-
-constexpr CGFloat whiteColorComponents[4] = { 1, 1, 1, 1 };
-constexpr CGFloat redColorComponents[4] = { 1, 0, 0, 1 };
-constexpr CGFloat blueColorComponents[4] = { 0, 0, 1, 1 };
-
-TEST(PageExtendedBackgroundColor, OnLoad)
-{
-    auto sRGBColorSpace = adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceSRGB));
-    auto whiteColor = adoptCF(CGColorCreate(sRGBColorSpace.get(), whiteColorComponents));
-    auto redColor = adoptCF(CGColorCreate(sRGBColorSpace.get(), redColorComponents));
-
-    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
-    EXPECT_TRUE(![webView _pageExtendedBackgroundColor]);
-
-    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:@"<style> body { background-color: red; } </style>"];
-
-    EXPECT_TRUE(CGColorEqualToColor([webView _pageExtendedBackgroundColor].CGColor, redColor.get()));
-
-    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:@"<style> body { not-background-color: red; } </style>"];
-
-    EXPECT_TRUE(CGColorEqualToColor([webView _pageExtendedBackgroundColor].CGColor, whiteColor.get()));
-}
-
-TEST(PageExtendedBackgroundColor, MultipleStyles)
-{
-    auto sRGBColorSpace = adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceSRGB));
-    auto blueColor = adoptCF(CGColorCreate(sRGBColorSpace.get(), blueColorComponents));
-
-    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
-    EXPECT_TRUE(![webView _pageExtendedBackgroundColor]);
-
-    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:@"<style> body { background-color: red; } body { background-color: blue; } </style>"];
-
-    EXPECT_TRUE(CGColorEqualToColor([webView _pageExtendedBackgroundColor].CGColor, blueColor.get()));
-}
-
-@interface WKWebViewPageExtendedBackgroundColorObserver : NSObject
-
-- (instancetype)initWithWebView:(WKWebView *)webView;
-
-@property (nonatomic, readonly) WKWebView *webView;
-@property (nonatomic, copy) NSString *state;
-
-@end
-
-@implementation WKWebViewPageExtendedBackgroundColorObserver
-
-- (instancetype)initWithWebView:(WKWebView *)webView
-{
-    if (!(self = [super init]))
-        return nil;
-
-    _state = @"before-init";
-
-    _webView = webView;
-    [_webView addObserver:self forKeyPath:@"_pageExtendedBackgroundColor" options:NSKeyValueObservingOptionInitial context:nil];
-
-    return self;
-}
-
-- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
-{
-    if ([_state isEqualToString:@"before-init"]) {
-        _state = @"after-init";
-        return;
-    }
-
-    if ([_state isEqualToString:@"before-load"]) {
-        _state = @"after-load";
-        return;
-    }
-
-    if ([_state isEqualToString:@"before-css-class-added"]) {
-        _state = @"after-css-class-added";
-        return;
-    }
-
-    if ([_state isEqualToString:@"before-css-class-changed"]) {
-        _state = @"after-css-class-changed";
-        return;
-    }
-
-    if ([_state isEqualToString:@"before-css-class-removed"]) {
-        _state = @"after-css-class-removed";
-        return;
-    }
-
-    RELEASE_ASSERT_NOT_REACHED();
-}
-
-@end
-
-TEST(PageExtendedBackgroundColor, KVO)
-{
-    auto sRGBColorSpace = adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceSRGB));
-    auto whiteColor = adoptCF(CGColorCreate(sRGBColorSpace.get(), whiteColorComponents));
-    auto redColor = adoptCF(CGColorCreate(sRGBColorSpace.get(), redColorComponents));
-    auto blueColor = adoptCF(CGColorCreate(sRGBColorSpace.get(), blueColorComponents));
-
-    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
-    auto themeColorObserver = adoptNS([[WKWebViewPageExtendedBackgroundColorObserver alloc] initWithWebView:webView.get()]);
-    EXPECT_NSSTRING_EQ("after-init", [themeColorObserver state]);
-    EXPECT_TRUE(![webView _pageExtendedBackgroundColor]);
-
-    [themeColorObserver setState:@"before-load"];
-    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:@"<style> body.red { background-color: red; } body.blue { background-color: blue; } </style>"];
-    EXPECT_NSSTRING_EQ("after-load", [themeColorObserver state]);
-    EXPECT_TRUE(CGColorEqualToColor([webView _pageExtendedBackgroundColor].CGColor, whiteColor.get()));
-
-    [themeColorObserver setState:@"before-css-class-added"];
-    [webView objectByEvaluatingJavaScript:@"document.body.className = 'red'"];
-    [webView waitForNextPresentationUpdate];
-    EXPECT_NSSTRING_EQ("after-css-class-added", [themeColorObserver state]);
-    EXPECT_TRUE(CGColorEqualToColor([webView _pageExtendedBackgroundColor].CGColor, redColor.get()));
-
-    [themeColorObserver setState:@"before-css-class-changed"];
-    [webView objectByEvaluatingJavaScript:@"document.body.className = 'blue'"];
-    [webView waitForNextPresentationUpdate];
-    EXPECT_NSSTRING_EQ("after-css-class-changed", [themeColorObserver state]);
-    EXPECT_TRUE(CGColorEqualToColor([webView _pageExtendedBackgroundColor].CGColor, blueColor.get()));
-
-    [themeColorObserver setState:@"before-css-class-removed"];
-    [webView objectByEvaluatingJavaScript:@"document.body.className = ''"];
-    [webView waitForNextPresentationUpdate];
-    EXPECT_NSSTRING_EQ("after-css-class-removed", [themeColorObserver state]);
-    EXPECT_TRUE(CGColorEqualToColor([webView _pageExtendedBackgroundColor].CGColor, whiteColor.get()));
-}
</del></span></pre></div>
<a id="branchessafari6121151branchToolsTestWebKitAPITestsWebKitCocoaSampledPageTopColormm"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm   2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm      2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -81,20 +81,12 @@
</span><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span><del>-enum class UseSampledPageTopColorForScrollAreaBackgroundColor : bool { Yes, No };
-static RetainPtr<TestWKWebView> createWebViewWithSampledPageTopColorMaxDifference(double sampledPageTopColorMaxDifference, double sampledPageTopColorMinHeight = 0, UseSampledPageTopColorForScrollAreaBackgroundColor useSampledPageTopColorForScrollAreaBackgroundColor = UseSampledPageTopColorForScrollAreaBackgroundColor::No)
</del><ins>+static RetainPtr<TestWKWebView> createWebViewWithSampledPageTopColorMaxDifference(double sampledPageTopColorMaxDifference, double sampledPageTopColorMinHeight = 0)
</ins><span class="cx"> {
</span><span class="cx">     auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
</span><span class="cx">     [configuration _setSampledPageTopColorMaxDifference:sampledPageTopColorMaxDifference];
</span><span class="cx">     [configuration _setSampledPageTopColorMinHeight:sampledPageTopColorMinHeight];
</span><span class="cx"> 
</span><del>-    for (_WKInternalDebugFeature *feature in [WKPreferences _internalDebugFeatures]) {
-        if ([feature.key isEqualToString:@"UseSampledPageTopColorForScrollAreaBackgroundColor"]) {
-            [[configuration preferences] _setEnabled:(useSampledPageTopColorForScrollAreaBackgroundColor == UseSampledPageTopColorForScrollAreaBackgroundColor::Yes) forInternalDebugFeature:feature];
-            break;
-        }
-    }
-
</del><span class="cx">     return adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -358,34 +350,3 @@
</span><span class="cx">     EXPECT_IN_RANGE(components[2], 1.00, 1.01);
</span><span class="cx">     EXPECT_EQ(components[3], 1);
</span><span class="cx"> }
</span><del>-
-#if PLATFORM(IOS_FAMILY)
-
-// There's no API/SPI to get the background color of the scroll area on macOS.
-
-TEST(SampledPageTopColor, ExperimentalUseSampledPageTopColorForScrollAreaBackgroundColor)
-{
-    auto webViewWithoutThemeColorForScrollAreaBackgroundColor = createWebViewWithSampledPageTopColorMaxDifference(5, 0, UseSampledPageTopColorForScrollAreaBackgroundColor::No);
-    EXPECT_NULL([webViewWithoutThemeColorForScrollAreaBackgroundColor _sampledPageTopColor]);
-
-    [webViewWithoutThemeColorForScrollAreaBackgroundColor synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops("right"_s, { "red"_s, "blue"_s })];
-    EXPECT_NULL([webViewWithoutThemeColorForScrollAreaBackgroundColor _sampledPageTopColor]);
-    EXPECT_EQ(WebCore::Color([webViewWithoutThemeColorForScrollAreaBackgroundColor scrollView].backgroundColor.CGColor), WebCore::Color::white);
-
-    waitForSampledPageTopColorToChangeForHTML(webViewWithoutThemeColorForScrollAreaBackgroundColor.get(), createHTMLGradientWithColorStops("right"_s, { "red"_s, "red"_s }));
-    EXPECT_EQ(WebCore::Color([webViewWithoutThemeColorForScrollAreaBackgroundColor _sampledPageTopColor].CGColor), WebCore::Color::red);
-    EXPECT_EQ(WebCore::Color([webViewWithoutThemeColorForScrollAreaBackgroundColor scrollView].backgroundColor.CGColor), WebCore::Color::white);
-
-    auto webViewWithThemeColorForScrollAreaBackgroundColor = createWebViewWithSampledPageTopColorMaxDifference(5, 0, UseSampledPageTopColorForScrollAreaBackgroundColor::Yes);
-    EXPECT_NULL([webViewWithThemeColorForScrollAreaBackgroundColor _sampledPageTopColor]);
-
-    [webViewWithThemeColorForScrollAreaBackgroundColor synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops("right"_s, { "red"_s, "blue"_s })];
-    EXPECT_NULL([webViewWithThemeColorForScrollAreaBackgroundColor _sampledPageTopColor]);
-    EXPECT_EQ(WebCore::Color([webViewWithThemeColorForScrollAreaBackgroundColor scrollView].backgroundColor.CGColor), WebCore::Color::white);
-
-    waitForSampledPageTopColorToChangeForHTML(webViewWithThemeColorForScrollAreaBackgroundColor.get(), createHTMLGradientWithColorStops("right"_s, { "red"_s, "red"_s }));
-    EXPECT_EQ(WebCore::Color([webViewWithThemeColorForScrollAreaBackgroundColor _sampledPageTopColor].CGColor), WebCore::Color::red);
-    EXPECT_EQ(WebCore::Color([webViewWithThemeColorForScrollAreaBackgroundColor scrollView].backgroundColor.CGColor), WebCore::Color::red);
-}
-
-#endif // PLATFORM(IOS_FAMILY)
</del></span></pre></div>
<a id="branchessafari6121151branchToolsTestWebKitAPITestsWebKitCocoaWKWebViewThemeColormm"></a>
<div class="modfile"><h4>Modified: branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewThemeColor.mm (277597 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewThemeColor.mm   2021-05-17 18:54:23 UTC (rev 277597)
+++ branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewThemeColor.mm      2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -321,52 +321,3 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(APPLICATION_MANIFEST)
</span><del>-
-#if PLATFORM(IOS_FAMILY)
-
-// There's no API/SPI to get the background color of the scroll area on macOS.
-
-enum class UseThemeColorForScrollAreaBackgroundColor : bool { Yes, No };
-static RetainPtr<TestWKWebView> createWebView(UseThemeColorForScrollAreaBackgroundColor useThemeColorForScrollAreaBackgroundColor)
-{
-    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
-    for (_WKInternalDebugFeature *feature in [WKPreferences _internalDebugFeatures]) {
-        if ([feature.key isEqualToString:@"UseThemeColorForScrollAreaBackgroundColor"]) {
-            [[configuration preferences] _setEnabled:(useThemeColorForScrollAreaBackgroundColor == UseThemeColorForScrollAreaBackgroundColor::Yes) forInternalDebugFeature:feature];
-            break;
-        }
-    }
-
-    return adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration.get()]);
-}
-
-TEST(WKWebViewThemeColor, ExperimentalUseThemeColorForScrollAreaBackgroundColor)
-{
-    auto sRGBColorSpace = adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceSRGB));
-    auto redColor = adoptCF(CGColorCreate(sRGBColorSpace.get(), redColorComponents));
-    auto blueColor = adoptCF(CGColorCreate(sRGBColorSpace.get(), blueColorComponents));
-
-    auto webViewWithoutThemeColorForScrollAreaBackgroundColor = createWebView(UseThemeColorForScrollAreaBackgroundColor::No);
-    EXPECT_TRUE(![webViewWithoutThemeColorForScrollAreaBackgroundColor themeColor]);
-
-    [webViewWithoutThemeColorForScrollAreaBackgroundColor synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:@"<body style='background-color: blue'>"];
-    EXPECT_TRUE(![webViewWithoutThemeColorForScrollAreaBackgroundColor themeColor]);
-    EXPECT_TRUE(CGColorEqualToColor([webViewWithoutThemeColorForScrollAreaBackgroundColor scrollView].backgroundColor.CGColor, blueColor.get()));
-
-    [webViewWithoutThemeColorForScrollAreaBackgroundColor synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:@"<meta name='theme-color' content='red'><body style='background-color: blue'>"];
-    EXPECT_TRUE(CGColorEqualToColor([webViewWithoutThemeColorForScrollAreaBackgroundColor themeColor].CGColor, redColor.get()));
-    EXPECT_TRUE(CGColorEqualToColor([webViewWithoutThemeColorForScrollAreaBackgroundColor scrollView].backgroundColor.CGColor, blueColor.get()));
-
-    auto webViewWithThemeColorForScrollAreaBackgroundColor = createWebView(UseThemeColorForScrollAreaBackgroundColor::Yes);
-    EXPECT_TRUE(![webViewWithThemeColorForScrollAreaBackgroundColor themeColor]);
-
-    [webViewWithThemeColorForScrollAreaBackgroundColor synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:@"<body style='background-color: blue'>"];
-    EXPECT_TRUE(![webViewWithThemeColorForScrollAreaBackgroundColor themeColor]);
-    EXPECT_TRUE(CGColorEqualToColor([webViewWithThemeColorForScrollAreaBackgroundColor scrollView].backgroundColor.CGColor, blueColor.get()));
-
-    [webViewWithThemeColorForScrollAreaBackgroundColor synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:@"<meta name='theme-color' content='red'><body style='background-color: blue'>"];
-    EXPECT_TRUE(CGColorEqualToColor([webViewWithThemeColorForScrollAreaBackgroundColor themeColor].CGColor, redColor.get()));
-    EXPECT_TRUE(CGColorEqualToColor([webViewWithThemeColorForScrollAreaBackgroundColor scrollView].backgroundColor.CGColor, redColor.get()));
-}
-
-#endif // PLATFORM(IOS_FAMILY)
</del></span></pre></div>
<a id="branchessafari6121151branchToolsTestWebKitAPITestsWebKitCocoaWKWebViewUnderPageBackgroundColormm"></a>
<div class="addfile"><h4>Added: branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewUnderPageBackgroundColor.mm (0 => 277598)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewUnderPageBackgroundColor.mm                             (rev 0)
+++ branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewUnderPageBackgroundColor.mm        2021-05-17 18:54:31 UTC (rev 277598)
</span><span class="lines">@@ -0,0 +1,302 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+
+#import "CocoaColor.h"
+#import "TestCocoa.h"
+#import "TestWKWebView.h"
+#import <WebKit/WKWebViewPrivate.h>
+#import <wtf/RetainPtr.h>
+
+#define EXPECT_IN_RANGE(actual, min, max) \
+    EXPECT_GE(actual, min); \
+    EXPECT_LE(actual, max);
+
+#define EXPECT_NSSTRING_EQ(expected, actual) \
+    EXPECT_TRUE([actual isKindOfClass:[NSString class]]); \
+    EXPECT_WK_STREQ(expected, (NSString *)actual);
+
+constexpr CGFloat redColorComponents[4] = { 1, 0, 0, 1 };
+constexpr CGFloat blueColorComponents[4] = { 0, 0, 1, 1 };
+
+static RetainPtr<CGColor> defaultBackgroundColor()
+{
+#if HAVE(OS_DARK_MODE_SUPPORT) && PLATFORM(MAC)
+    auto color = retainPtr(NSColor.controlBackgroundColor);
+#elif HAVE(OS_DARK_MODE_SUPPORT) && PLATFORM(IOS_FAMILY)
+    auto color = retainPtr(UIColor.systemBackgroundColor);
+#else
+    auto color = retainPtr([CocoaColor whiteColor]);
+#endif
+
+    // Some of the above can sometimes be a monochrome color, so convert it to sRGB so the comparisons below work.
+    // `WebCore::ColorSpace` doesn't have an equivalent monochrome enum value, but treats `CGColor` with only two components as monochrome and converts them to `SRGB`.
+    auto sRGBColorSpace = adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceSRGB));
+    auto sRGBColor = adoptCF(CGColorCreateCopyByMatchingToColorSpace(sRGBColorSpace.get(), kCGRenderingIntentDefault, [color CGColor], NULL));
+    return sRGBColor.get();
+}
+
+TEST(WKWebViewUnderPageBackgroundColor, OnLoad)
+{
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, defaultBackgroundColor().get()));
+}
+
+TEST(WKWebViewUnderPageBackgroundColor, SingleSolidColor)
+{
+    auto sRGBColorSpace = adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceSRGB));
+    auto redColor = adoptCF(CGColorCreate(sRGBColorSpace.get(), redColorComponents));
+
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, defaultBackgroundColor().get()));
+
+    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:@"<style> body { background-color: red; } </style>"];
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, redColor.get()));
+}
+
+TEST(WKWebViewUnderPageBackgroundColor, SingleBlendedColor)
+{
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, defaultBackgroundColor().get()));
+
+    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:@"<style> body { background-color: rgba(255, 0, 0, 0.5); } </style>"];
+    auto components = CGColorGetComponents([webView underPageBackgroundColor].CGColor);
+    EXPECT_EQ(components[0], 1);
+    EXPECT_IN_RANGE(components[1], 0.45, 0.55);
+    EXPECT_IN_RANGE(components[2], 0.45, 0.55);
+    EXPECT_EQ(components[3], 1);
+}
+
+TEST(WKWebViewUnderPageBackgroundColor, MultipleSolidColors)
+{
+    auto sRGBColorSpace = adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceSRGB));
+    auto redColor = adoptCF(CGColorCreate(sRGBColorSpace.get(), redColorComponents));
+
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, defaultBackgroundColor().get()));
+
+    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:@"<style> html { background-color: blue; } body { background-color: red; } </style>"];
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, redColor.get()));
+}
+
+TEST(WKWebViewUnderPageBackgroundColor, MultipleBlendedColors)
+{
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, defaultBackgroundColor().get()));
+
+    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:@"<style> html { background-color: rgba(255, 0, 0, 0.5); } body { background-color: rgba(0, 0, 255, 0.5); } </style>"];
+    auto components = CGColorGetComponents([webView underPageBackgroundColor].CGColor);
+    EXPECT_IN_RANGE(components[0], 0.45, 0.55);
+    EXPECT_IN_RANGE(components[1], 0.2, 0.25);
+    EXPECT_IN_RANGE(components[2], 0.7, 0.75);
+    EXPECT_EQ(components[3], 1);
+}
+
+@interface WKWebViewUnderPageBackgroundColorObserver : NSObject
+
+- (instancetype)initWithWebView:(WKWebView *)webView;
+
+@property (nonatomic, readonly) WKWebView *webView;
+@property (nonatomic, copy) NSString *state;
+
+@end
+
+@implementation WKWebViewUnderPageBackgroundColorObserver
+
+- (instancetype)initWithWebView:(WKWebView *)webView
+{
+    if (!(self = [super init]))
+        return nil;
+
+    _state = @"before-init";
+
+    _webView = webView;
+    [_webView addObserver:self forKeyPath:@"underPageBackgroundColor" options:NSKeyValueObservingOptionInitial context:nil];
+
+    return self;
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+    if ([_state isEqualToString:@"before-init"]) {
+        _state = @"after-init";
+        return;
+    }
+
+    if ([_state isEqualToString:@"before-css-class-added"]) {
+        _state = @"after-css-class-added";
+        return;
+    }
+
+    if ([_state isEqualToString:@"before-css-class-changed"]) {
+        _state = @"after-css-class-changed";
+        return;
+    }
+
+    if ([_state isEqualToString:@"before-css-class-removed"]) {
+        _state = @"after-css-class-removed";
+        return;
+    }
+
+    if ([_state isEqualToString:@"before-nonnull-override"]) {
+        _state = @"after-nonnull-override";
+        return;
+    }
+
+    if ([_state isEqualToString:@"before-null-override"]) {
+        _state = @"after-null-override";
+        return;
+    }
+
+    EXPECT_NSSTRING_EQ("not-reached", _state);
+}
+
+@end
+
+TEST(WKWebViewUnderPageBackgroundColor, KVO)
+{
+    auto sRGBColorSpace = adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceSRGB));
+    auto redColor = adoptCF(CGColorCreate(sRGBColorSpace.get(), redColorComponents));
+    auto blueColor = adoptCF(CGColorCreate(sRGBColorSpace.get(), blueColorComponents));
+
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+    auto underPageBackgroundColorObserver = adoptNS([[WKWebViewUnderPageBackgroundColorObserver alloc] initWithWebView:webView.get()]);
+    EXPECT_NSSTRING_EQ("after-init", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, defaultBackgroundColor().get()));
+
+    [underPageBackgroundColorObserver setState:@"should-not-change"];
+    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:@"<style> body.red { background-color: red; } body.blue { background-color: blue; } </style>"];
+    EXPECT_NSSTRING_EQ("should-not-change", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, defaultBackgroundColor().get()));
+
+    [underPageBackgroundColorObserver setState:@"before-css-class-added"];
+    [webView objectByEvaluatingJavaScript:@"document.body.className = 'red'"];
+    [webView waitForNextPresentationUpdate];
+    EXPECT_NSSTRING_EQ("after-css-class-added", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, redColor.get()));
+
+    [underPageBackgroundColorObserver setState:@"should-not-change"];
+    [webView setUnderPageBackgroundColor:[CocoaColor colorWithCGColor:redColor.get()]];
+    EXPECT_NSSTRING_EQ("should-not-change", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, redColor.get()));
+
+    [underPageBackgroundColorObserver setState:@"should-not-change"];
+    [webView setUnderPageBackgroundColor:nil];
+    EXPECT_NSSTRING_EQ("should-not-change", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, redColor.get()));
+
+    [underPageBackgroundColorObserver setState:@"before-css-class-changed"];
+    [webView objectByEvaluatingJavaScript:@"document.body.className = 'blue'"];
+    [webView waitForNextPresentationUpdate];
+    EXPECT_NSSTRING_EQ("after-css-class-changed", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, blueColor.get()));
+
+    [underPageBackgroundColorObserver setState:@"should-not-change"];
+    [webView setUnderPageBackgroundColor:[CocoaColor colorWithCGColor:blueColor.get()]];
+    EXPECT_NSSTRING_EQ("should-not-change", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, blueColor.get()));
+
+    [underPageBackgroundColorObserver setState:@"should-not-change"];
+    [webView setUnderPageBackgroundColor:nil];
+    EXPECT_NSSTRING_EQ("should-not-change", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, blueColor.get()));
+
+    [underPageBackgroundColorObserver setState:@"before-css-class-removed"];
+    [webView objectByEvaluatingJavaScript:@"document.body.className = ''"];
+    [webView waitForNextPresentationUpdate];
+    EXPECT_NSSTRING_EQ("after-css-class-removed", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, defaultBackgroundColor().get()));
+
+    [underPageBackgroundColorObserver setState:@"should-not-change"];
+    [webView setUnderPageBackgroundColor:[CocoaColor colorWithCGColor:defaultBackgroundColor().get()]];
+    EXPECT_NSSTRING_EQ("should-not-change", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, defaultBackgroundColor().get()));
+
+    [underPageBackgroundColorObserver setState:@"should-not-change"];
+    [webView setUnderPageBackgroundColor:nil];
+    EXPECT_NSSTRING_EQ("should-not-change", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, defaultBackgroundColor().get()));
+
+    [underPageBackgroundColorObserver setState:@"before-nonnull-override"];
+    [webView setUnderPageBackgroundColor:[CocoaColor colorWithCGColor:redColor.get()]];
+    EXPECT_NSSTRING_EQ("after-nonnull-override", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, redColor.get()));
+
+    [underPageBackgroundColorObserver setState:@"should-not-change"];
+    [webView setUnderPageBackgroundColor:[CocoaColor colorWithCGColor:redColor.get()]];
+    EXPECT_NSSTRING_EQ("should-not-change", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, redColor.get()));
+
+    [underPageBackgroundColorObserver setState:@"should-not-change"];
+    [webView objectByEvaluatingJavaScript:@"document.body.className = 'red'"];
+    [webView waitForNextPresentationUpdate];
+    EXPECT_NSSTRING_EQ("should-not-change", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, redColor.get()));
+
+    [underPageBackgroundColorObserver setState:@"should-not-change"];
+    [webView objectByEvaluatingJavaScript:@"document.body.className = 'blue'"];
+    [webView waitForNextPresentationUpdate];
+    EXPECT_NSSTRING_EQ("should-not-change", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, redColor.get()));
+
+    [underPageBackgroundColorObserver setState:@"should-not-change"];
+    [webView objectByEvaluatingJavaScript:@"document.body.className = ''"];
+    [webView waitForNextPresentationUpdate];
+    EXPECT_NSSTRING_EQ("should-not-change", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, redColor.get()));
+
+    [underPageBackgroundColorObserver setState:@"before-null-override"];
+    [webView setUnderPageBackgroundColor:nil];
+    EXPECT_NSSTRING_EQ("after-null-override", [underPageBackgroundColorObserver state]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, defaultBackgroundColor().get()));
+}
+
+#if PLATFORM(IOS_FAMILY)
+
+// There's no API/SPI to get the background color of the scroll area on macOS.
+
+TEST(WKWebViewUnderPageBackgroundColor, MatchesScrollView)
+{
+    auto sRGBColorSpace = adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceSRGB));
+    auto redColor = adoptCF(CGColorCreate(sRGBColorSpace.get(), redColorComponents));
+    auto blueColor = adoptCF(CGColorCreate(sRGBColorSpace.get(), blueColorComponents));
+
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, defaultBackgroundColor().get()));
+    EXPECT_TRUE(CGColorEqualToColor([webView scrollView].backgroundColor.CGColor, defaultBackgroundColor().get()));
+
+    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:@"<style> body { background-color: red; } </style>"];
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, redColor.get()));
+    EXPECT_TRUE(CGColorEqualToColor([webView scrollView].backgroundColor.CGColor, redColor.get()));
+
+    [webView setUnderPageBackgroundColor:[CocoaColor colorWithCGColor:blueColor.get()]];
+    [webView waitForNextPresentationUpdate];
+    EXPECT_TRUE(CGColorEqualToColor([webView underPageBackgroundColor].CGColor, blueColor.get()));
+    EXPECT_TRUE(CGColorEqualToColor([webView scrollView].backgroundColor.CGColor, blueColor.get()));
+}
+
+#endif // PLATFORM(IOS_FAMILY)
+
</ins></span></pre>
</div>
</div>

</body>
</html>