Diff
Modified: branches/safari-612.1.15.1-branch/Source/WTF/ChangeLog (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WTF/ChangeLog 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WTF/ChangeLog 2021-05-18 23:55:52 UTC (rev 277695)
@@ -1,174 +1,3 @@
-2021-05-17 Russell Epstein <repst...@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 <drou...@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:]`.
-
2021-05-13 Chris Dumez <cdu...@apple.com>
Rename FileSystem::fileIsDirectory(path, followSymlinks) to isDirectory(path) / isDirectoryFollowingSymlinks(path)
Modified: branches/safari-612.1.15.1-branch/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml 2021-05-18 23:55:52 UTC (rev 277695)
@@ -760,6 +760,30 @@
WebKit:
default: defaultUseGPUProcessForDOMRenderingEnabled()
+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
+
# FIXME: Remove once <rdar://73830961> has been fixed
UseiTunesAVOutputContext:
type: bool
Modified: branches/safari-612.1.15.1-branch/Source/WebCore/ChangeLog (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebCore/ChangeLog 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebCore/ChangeLog 2021-05-18 23:55:52 UTC (rev 277695)
@@ -45,199 +45,6 @@
2021-05-17 Russell Epstein <repst...@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 <drou...@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 <repst...@apple.com>
-
Cherry-pick r277459. rdar://problem/78110796
[macOS] experimental "Use theme color for scroll area background" isn't working
Modified: branches/safari-612.1.15.1-branch/Source/WebCore/dom/Document.cpp (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebCore/dom/Document.cpp 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebCore/dom/Document.cpp 2021-05-18 23:55:52 UTC (rev 277695)
@@ -3901,6 +3901,13 @@
if (auto* page = this->page())
page->chrome().client().themeColorChanged();
+
+#if ENABLE(RUBBER_BANDING)
+ if (auto* view = renderView()) {
+ if (view->usesCompositing())
+ view->compositor().updateLayerForOverhangAreasBackgroundColor();
+ }
+#endif // ENABLE(RUBBER_BANDING)
}
static bool isValidPageSampleLocation(Document& document, const IntPoint& location)
Modified: branches/safari-612.1.15.1-branch/Source/WebCore/page/Page.cpp (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebCore/page/Page.cpp 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebCore/page/Page.cpp 2021-05-18 23:55:52 UTC (rev 277695)
@@ -2563,25 +2563,6 @@
return document->sampledPageTopColor();
}
-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)
-}
-
// These are magical constants that might be tweaked over time.
static const double gMinimumPaintedAreaRatio = 0.1;
static const double gMaximumUnpaintedAreaRatio = 0.04;
Modified: branches/safari-612.1.15.1-branch/Source/WebCore/page/Page.h (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebCore/page/Page.h 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebCore/page/Page.h 2021-05-18 23:55:52 UTC (rev 277695)
@@ -623,9 +623,6 @@
WEBCORE_EXPORT Color pageExtendedBackgroundColor() const;
WEBCORE_EXPORT Color sampledPageTopColor() const;
- Color underPageBackgroundColorOverride() const { return m_underPageBackgroundColorOverride; }
- WEBCORE_EXPORT void setUnderPageBackgroundColorOverride(Color&&);
-
bool isCountingRelevantRepaintedObjects() const;
void setIsCountingRelevantRepaintedObjects(bool isCounting) { m_isCountingRelevantRepaintedObjects = isCounting; }
void startCountingRelevantRepaintedObjects();
@@ -1155,8 +1152,6 @@
MonotonicTime m_lastRenderingUpdateTimestamp;
- Color m_underPageBackgroundColorOverride;
-
const bool m_httpsUpgradeEnabled { true };
mutable MediaSessionGroupIdentifier m_mediaSessionGroupIdentifier;
};
Modified: branches/safari-612.1.15.1-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp 2021-05-18 23:55:52 UTC (rev 277695)
@@ -3882,9 +3882,16 @@
if (m_renderView.settings().backgroundShouldExtendBeyondPage()) {
backgroundColor = ([&] {
- if (auto underPageBackgroundColorOverride = page().underPageBackgroundColorOverride(); underPageBackgroundColorOverride.isValid())
- return underPageBackgroundColorOverride;
+ if (page().settings().useThemeColorForScrollAreaBackgroundColor()) {
+ if (auto themeColor = page().themeColor(); themeColor.isValid())
+ return themeColor;
+ }
+ if (page().settings().useSampledPageTopColorForScrollAreaBackgroundColor()) {
+ if (auto sampledPageTopColor = page().sampledPageTopColor(); sampledPageTopColor.isValid())
+ return sampledPageTopColor;
+ }
+
return m_rootExtendedBackgroundColor;
})();
m_layerForOverhangAreas->setBackgroundColor(backgroundColor);
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/ChangeLog (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/ChangeLog 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/ChangeLog 2021-05-18 23:55:52 UTC (rev 277695)
@@ -1,225 +1,5 @@
2021-05-17 Russell Epstein <repst...@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 <drou...@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 <repst...@apple.com>
-
Cherry-pick r277528. rdar://problem/78109685
REGRESSION (r269824): Random tile corruption when scrolling/zooming in macCatalyst
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h 2021-05-18 23:55:52 UTC (rev 277695)
@@ -580,20 +580,6 @@
@property (nonatomic, readonly, nullable) NSColor *themeColor WK_API_AVAILABLE(macos(WK_MAC_TBA));
#endif
-/*! @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
-
@end
#if !TARGET_OS_IPHONE
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2021-05-18 23:55:52 UTC (rev 277695)
@@ -1721,21 +1721,6 @@
return WebCore::platformColor(themeColor);
}
-- (CocoaColor *)underPageBackgroundColor
-{
- return WebCore::platformColor(_page->underPageBackgroundColor());
-}
-
-- (void)setUnderPageBackgroundColor:(CocoaColor *)underPageBackgroundColorOverride
-{
- _page->setUnderPageBackgroundColorOverride(underPageBackgroundColorOverride.CGColor);
-}
-
-+ (BOOL)automaticallyNotifiesObserversOfUnderPageBackgroundColor
-{
- return NO;
-}
-
@end
#pragma mark -
@@ -3203,13 +3188,11 @@
_page->setCanUseCredentialStorage(canUseCredentialStorage);
}
-// FIXME: Remove old `-[WKWebView _themeColor]` SPI <rdar://76662644>
- (CocoaColor *)_themeColor
{
return [self themeColor];
}
-// FIXME: Remove old `-[WKWebView _pageExtendedBackgroundColor]` SPI <rdar://77789732>
- (CocoaColor *)_pageExtendedBackgroundColor
{
auto pageExtendedBackgroundColor = _page->pageExtendedBackgroundColor();
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h 2021-05-18 23:55:52 UTC (rev 277695)
@@ -380,11 +380,10 @@
@property (nonatomic, readonly) NSColor *_themeColor WK_API_DEPRECATED_WITH_REPLACEMENT("themeColor", macos(WK_MAC_TBA, WK_MAC_TBA));
#endif
-// FIXME: Remove old `-[WKWebView _pageExtendedBackgroundColor]` SPI <rdar://77789732>
#if TARGET_OS_IPHONE
-@property (nonatomic, readonly) UIColor *_pageExtendedBackgroundColor WK_API_DEPRECATED_WITH_REPLACEMENT("underPageBackgroundColor", ios(WK_IOS_TBA, WK_IOS_TBA));
+@property (nonatomic, readonly) UIColor *_pageExtendedBackgroundColor WK_API_AVAILABLE(ios(WK_IOS_TBA));
#else
-@property (nonatomic, readonly) NSColor *_pageExtendedBackgroundColor WK_API_DEPRECATED_WITH_REPLACEMENT("underPageBackgroundColor", macos(10.10, WK_MAC_TBA));
+@property (nonatomic, readonly) NSColor *_pageExtendedBackgroundColor;
#endif
// Only set if `-[WKWebViewConfiguration _sampledPageTopColorMaxDifference]` is a positive number.
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm 2021-05-18 23:55:52 UTC (rev 277695)
@@ -493,7 +493,7 @@
if (!webView->_page)
return { };
- return webView->_page->underPageBackgroundColor();
+ return webView->_page->scrollAreaBackgroundColor();
}
static WebCore::Color scrollViewBackgroundColor(WKWebView *webView)
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h 2021-05-18 23:55:52 UTC (rev 277695)
@@ -38,7 +38,6 @@
namespace WebCore {
class AlternativeTextUIController;
-class Color;
struct AppHighlight;
}
@@ -54,8 +53,6 @@
void themeColorWillChange() final;
void themeColorDidChange() final;
- void underPageBackgroundColorWillChange() final;
- void underPageBackgroundColorDidChange() final;
void pageExtendedBackgroundColorWillChange() final;
void pageExtendedBackgroundColorDidChange() final;
void sampledPageTopColorWillChange() final;
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm 2021-05-18 23:55:52 UTC (rev 277695)
@@ -47,8 +47,6 @@
void PageClientImplCocoa::themeColorWillChange()
{
[m_webView willChangeValueForKey:@"themeColor"];
-
- // FIXME: Remove old `-[WKWebView _themeColor]` SPI <rdar://76662644>
[m_webView willChangeValueForKey:@"_themeColor"];
}
@@ -55,30 +53,16 @@
void PageClientImplCocoa::themeColorDidChange()
{
[m_webView didChangeValueForKey:@"themeColor"];
-
- // FIXME: Remove old `-[WKWebView _themeColor]` SPI <rdar://76662644>
[m_webView didChangeValueForKey:@"_themeColor"];
}
-void PageClientImplCocoa::underPageBackgroundColorWillChange()
-{
- [m_webView willChangeValueForKey:@"underPageBackgroundColor"];
-}
-
-void PageClientImplCocoa::underPageBackgroundColorDidChange()
-{
- [m_webView didChangeValueForKey:@"underPageBackgroundColor"];
-}
-
void PageClientImplCocoa::pageExtendedBackgroundColorWillChange()
{
- // FIXME: Remove old `-[WKWebView _pageExtendedBackgroundColor]` SPI <rdar://77789732>
[m_webView willChangeValueForKey:@"_pageExtendedBackgroundColor"];
}
void PageClientImplCocoa::pageExtendedBackgroundColorDidChange()
{
- // FIXME: Remove old `-[WKWebView _pageExtendedBackgroundColor]` SPI <rdar://77789732>
[m_webView didChangeValueForKey:@"_pageExtendedBackgroundColor"];
}
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/PageClient.h (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/PageClient.h 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/PageClient.h 2021-05-18 23:55:52 UTC (rev 277695)
@@ -490,8 +490,6 @@
#if HAVE(UISCROLLVIEW_ASYNCHRONOUS_SCROLL_EVENT_HANDLING)
virtual void handleAsynchronousCancelableScrollEvent(UIScrollView *, UIScrollEvent *, void (^completion)(BOOL handled)) = 0;
#endif
-
- virtual WebCore::Color contentViewBackgroundColor() = 0;
#endif
// Auxiliary Client Creation
@@ -516,8 +514,6 @@
virtual void themeColorWillChange() { }
virtual void themeColorDidChange() { }
- virtual void underPageBackgroundColorWillChange() { }
- virtual void underPageBackgroundColorDidChange() { }
virtual void pageExtendedBackgroundColorWillChange() { }
virtual void pageExtendedBackgroundColorDidChange() { }
virtual void sampledPageTopColorWillChange() { }
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ViewSnapshotStore.cpp (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ViewSnapshotStore.cpp 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ViewSnapshotStore.cpp 2021-05-18 23:55:52 UTC (rev 277695)
@@ -95,7 +95,7 @@
snapshot->setRenderTreeSize(webPageProxy.renderTreeSize());
snapshot->setDeviceScaleFactor(webPageProxy.deviceScaleFactor());
- snapshot->setBackgroundColor(webPageProxy.pageExtendedBackgroundColor());
+ snapshot->setBackgroundColor(webPageProxy.scrollAreaBackgroundColor());
snapshot->setViewScrollPosition(WebCore::roundedIntPoint(webPageProxy.viewScrollPosition()));
item.setSnapshot(WTFMove(snapshot));
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-05-18 23:55:52 UTC (rev 277695)
@@ -1911,56 +1911,17 @@
send(Messages::WebPage::SetUnderlayColor(color));
}
-Color WebPageProxy::underPageBackgroundColor() const
+Color WebPageProxy::scrollAreaBackgroundColor() const
{
- if (m_underPageBackgroundColorOverride.isValid())
- return m_underPageBackgroundColorOverride;
+ if (m_preferences->useThemeColorForScrollAreaBackgroundColor() && m_themeColor.isValid())
+ return m_themeColor;
- if (m_pageExtendedBackgroundColor.isValid())
- return m_pageExtendedBackgroundColor;
+ if (m_preferences->useSampledPageTopColorForScrollAreaBackgroundColor() && m_sampledPageTopColor.isValid())
+ return m_sampledPageTopColor;
- return platformUnderPageBackgroundColor();
+ return m_pageExtendedBackgroundColor;
}
-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));
- });
-}
-
void WebPageProxy::viewWillStartLiveResize()
{
if (!hasRunningProcess())
@@ -8597,24 +8558,13 @@
pageClient().themeColorDidChange();
}
-void WebPageProxy::pageExtendedBackgroundColorDidChange(const Color& newPageExtendedBackgroundColor)
+void WebPageProxy::pageExtendedBackgroundColorDidChange(const Color& pageExtendedBackgroundColor)
{
- if (m_pageExtendedBackgroundColor == newPageExtendedBackgroundColor)
+ if (m_pageExtendedBackgroundColor == pageExtendedBackgroundColor)
return;
- auto oldUnderPageBackgroundColor = underPageBackgroundColor();
- auto oldPageExtendedBackgroundColor = std::exchange(m_pageExtendedBackgroundColor, newPageExtendedBackgroundColor);
- bool changesUnderPageBackgroundColor = !equalIgnoringSemanticColor(oldUnderPageBackgroundColor, underPageBackgroundColor());
- m_pageExtendedBackgroundColor = WTFMove(oldPageExtendedBackgroundColor);
-
- if (changesUnderPageBackgroundColor)
- pageClient().underPageBackgroundColorWillChange();
pageClient().pageExtendedBackgroundColorWillChange();
-
- m_pageExtendedBackgroundColor = newPageExtendedBackgroundColor;
-
- if (changesUnderPageBackgroundColor)
- pageClient().underPageBackgroundColorDidChange();
+ m_pageExtendedBackgroundColor = pageExtendedBackgroundColor;
pageClient().pageExtendedBackgroundColorDidChange();
}
@@ -8628,15 +8578,6 @@
pageClient().sampledPageTopColorDidChange();
}
-#if !PLATFORM(COCOA)
-
-Color WebPageProxy::platformUnderPageBackgroundColor() const
-{
- return Color::transparentBlack;
-}
-
-#endif // !PLATFORM(COCOA)
-
#if ENABLE(NETSCAPE_PLUGIN_API)
void WebPageProxy::didFailToInitializePlugin(const String& mimeType, const String& frameURLString, const String& pageURLString)
{
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/WebPageProxy.h (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/WebPageProxy.h 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/WebPageProxy.h 2021-05-18 23:55:52 UTC (rev 277695)
@@ -672,9 +672,7 @@
WebCore::Color sampledPageTopColor() const { return m_sampledPageTopColor; }
- WebCore::Color underPageBackgroundColor() const;
- WebCore::Color underPageBackgroundColorOverride() const { return m_underPageBackgroundColorOverride; }
- void setUnderPageBackgroundColorOverride(WebCore::Color&&);
+ WebCore::Color scrollAreaBackgroundColor() const;
void viewWillStartLiveResize();
void viewWillEndLiveResize();
@@ -2110,7 +2108,6 @@
void themeColorChanged(const WebCore::Color&);
void pageExtendedBackgroundColorDidChange(const WebCore::Color&);
void sampledPageTopColorChanged(const WebCore::Color&);
- WebCore::Color platformUnderPageBackgroundColor() const;
#if ENABLE(NETSCAPE_PLUGIN_API)
void didFailToInitializePlugin(const String& mimeType, const String& frameURLString, const String& pageURLString);
void didBlockInsecurePluginVersion(const String& mimeType, const String& pluginURLString, const String& frameURLString, const String& pageURLString, bool replacementObscured);
@@ -2655,13 +2652,10 @@
LayerHostingMode m_layerHostingMode { LayerHostingMode::InProcess };
WebCore::Color m_themeColor;
- WebCore::Color m_underPageBackgroundColorOverride;
WebCore::Color m_underlayColor;
WebCore::Color m_pageExtendedBackgroundColor;
WebCore::Color m_sampledPageTopColor;
- bool m_hasPendingUnderPageBackgroundColorOverrideToDispatch { false };
-
bool m_useFixedLayout { false };
WebCore::IntSize m_fixedLayoutSize;
Optional<WebCore::FloatRect> m_viewExposedRect;
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.h (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.h 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.h 2021-05-18 23:55:52 UTC (rev 277695)
@@ -293,8 +293,6 @@
void handleAsynchronousCancelableScrollEvent(UIScrollView *, UIScrollEvent *, void (^completion)(BOOL handled)) final;
#endif
- WebCore::Color contentViewBackgroundColor() final;
-
WeakObjCPtr<WKContentView> m_contentView;
RetainPtr<WKEditorUndoTarget> m_undoTarget;
};
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2021-05-18 23:55:52 UTC (rev 277695)
@@ -1008,11 +1008,6 @@
[m_contentView runModalJavaScriptDialog:WTFMove(callback)];
}
-WebCore::Color PageClientImpl::contentViewBackgroundColor()
-{
- return [m_contentView backgroundColor].CGColor;
-}
-
} // namespace WebKit
#endif // PLATFORM(IOS_FAMILY)
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2021-05-18 23:55:52 UTC (rev 277695)
@@ -1564,18 +1564,7 @@
pageClient().showDataDetectorsUIForPositionInformation(positionInfo);
}
-Color WebPageProxy::platformUnderPageBackgroundColor() const
-{
- if (auto contentViewBackgroundColor = pageClient().contentViewBackgroundColor(); contentViewBackgroundColor.isValid())
- return contentViewBackgroundColor;
-#if HAVE(OS_DARK_MODE_SUPPORT)
- return UIColor.systemBackgroundColor.CGColor;
-#else
- return UIColor.whiteColor.CGColor;
-#endif
-}
-
} // namespace WebKit
#undef RELEASE_LOG_IF_ALLOWED
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2021-05-18 23:55:52 UTC (rev 277695)
@@ -710,15 +710,6 @@
}
#endif
-Color WebPageProxy::platformUnderPageBackgroundColor() const
-{
-#if ENABLE(DARK_MODE_CSS)
- return NSColor.controlBackgroundColor.CGColor;
-#else
- return NSColor.whiteColor.CGColor;
-#endif
-}
-
} // namespace WebKit
#endif // PLATFORM(MAC)
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-05-18 23:55:52 UTC (rev 277695)
@@ -2448,11 +2448,6 @@
injectedBundle->didReceiveMessageToPage(this, messageName, webProcess.transformHandlesToObjects(userData.object()).get());
}
-void WebPage::setUnderPageBackgroundColorOverride(WebCore::Color&& underPageBackgroundColorOverride)
-{
- m_page->setUnderPageBackgroundColorOverride(WTFMove(underPageBackgroundColorOverride));
-}
-
#if !PLATFORM(IOS_FAMILY)
void WebPage::setHeaderPageBanner(PageBanner* pageBanner)
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.h (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.h 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.h 2021-05-18 23:55:52 UTC (rev 277695)
@@ -608,8 +608,6 @@
void postInjectedBundleMessage(const String& messageName, const UserData&);
- void setUnderPageBackgroundColorOverride(WebCore::Color&&);
-
void setUnderlayColor(const WebCore::Color& color) { m_underlayColor = color; }
WebCore::Color underlayColor() const { return m_underlayColor; }
Modified: branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2021-05-18 23:55:52 UTC (rev 277695)
@@ -39,7 +39,6 @@
SetTopContentInset(float contentInset)
SetUnderlayColor(WebCore::Color color)
- SetUnderPageBackgroundColorOverride(WebCore::Color underPageBackgroundColorOverride)
ViewWillStartLiveResize()
ViewWillEndLiveResize()
Modified: branches/safari-612.1.15.1-branch/Tools/ChangeLog (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Tools/ChangeLog 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Tools/ChangeLog 2021-05-18 23:55:52 UTC (rev 277695)
@@ -1,190 +1,3 @@
-2021-05-17 Russell Epstein <repst...@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 <drou...@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:
-
2021-05-13 Chris Dumez <cdu...@apple.com>
Rename FileSystem::fileIsDirectory(path, followSymlinks) to isDirectory(path) / isDirectoryFollowingSymlinks(path)
Modified: branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-05-18 23:55:52 UTC (rev 277695)
@@ -874,7 +874,7 @@
93FCDB34263631560046DD7D /* SortedArrayMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93FCDB33263631560046DD7D /* SortedArrayMap.cpp */; };
95095F20262FFFA50000D920 /* SampledPageTopColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95095F1F262FFFA50000D920 /* SampledPageTopColor.mm */; };
950E4CC1252E75240071659F /* iOSStylusSupport.mm in Sources */ = {isa = PBXBuildFile; fileRef = 950E4CC0252E75230071659F /* iOSStylusSupport.mm */; };
- 953ABB3525C0D682004C8B73 /* WKWebViewUnderPageBackgroundColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 953ABB3425C0D681004C8B73 /* WKWebViewUnderPageBackgroundColor.mm */; };
+ 953ABB3525C0D682004C8B73 /* PageExtendedBackgroundColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 953ABB3425C0D681004C8B73 /* PageExtendedBackgroundColor.mm */; };
95A524952581A10D00461FE9 /* WKWebViewThemeColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95A524942581A10D00461FE9 /* WKWebViewThemeColor.mm */; };
95B6B3B7251EBF2F00FC4382 /* MediaDocument.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95B6B3B6251EBF2F00FC4382 /* MediaDocument.mm */; };
9984FACC1CFFAF60008D198C /* WKWebViewTextInput.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9984FACA1CFFAEEE008D198C /* WKWebViewTextInput.mm */; };
@@ -2576,7 +2576,7 @@
93FCDB33263631560046DD7D /* SortedArrayMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SortedArrayMap.cpp; sourceTree = "<group>"; };
95095F1F262FFFA50000D920 /* SampledPageTopColor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SampledPageTopColor.mm; sourceTree = "<group>"; };
950E4CC0252E75230071659F /* iOSStylusSupport.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = iOSStylusSupport.mm; sourceTree = "<group>"; };
- 953ABB3425C0D681004C8B73 /* WKWebViewUnderPageBackgroundColor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewUnderPageBackgroundColor.mm; sourceTree = "<group>"; };
+ 953ABB3425C0D681004C8B73 /* PageExtendedBackgroundColor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageExtendedBackgroundColor.mm; sourceTree = "<group>"; };
95A524942581A10D00461FE9 /* WKWebViewThemeColor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewThemeColor.mm; sourceTree = "<group>"; };
95B6B3B6251EBF2F00FC4382 /* MediaDocument.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaDocument.mm; sourceTree = "<group>"; };
9984FACA1CFFAEEE008D198C /* WKWebViewTextInput.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewTextInput.mm; sourceTree = "<group>"; };
@@ -3483,8 +3483,8 @@
6351992722275C6A00890AD3 /* NavigationAction.mm */,
5C8BC798218CF3E900813886 /* NetworkProcess.mm */,
5CAE4637201937CD0051610F /* NetworkProcessCrashNonPersistentDataStore.mm */,
+ 46A80F25264C29D400EEF20D /* NotificationAPI.mm */,
CDCFFEC022E268D500DF4223 /* NoPauseWhenSwitchingTabs.mm */,
- 46A80F25264C29D400EEF20D /* NotificationAPI.mm */,
CD2D0D19213465560018C784 /* NowPlaying.mm */,
2ECFF5541D9B12F800B55394 /* NowPlayingControlsTests.mm */,
A10F047C1E3AD29C00C95E19 /* NSFileManagerExtras.mm */,
@@ -3493,6 +3493,7 @@
37A22AA51DCAA27200AFBFC4 /* ObservedRenderingProgressEventsAfterCrash.mm */,
CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */,
2DA2586E225C67DC00B45C1C /* OverrideViewportArguments.mm */,
+ 953ABB3425C0D681004C8B73 /* PageExtendedBackgroundColor.mm */,
2D3CA3A4221DF2390088E803 /* PageOverlayPlugin.mm */,
51242CDA237B791E00EED9C1 /* PageZoom.mm */,
F44C79FB20F9E50C0014478C /* ParserYieldTokenPlugIn.mm */,
@@ -3636,7 +3637,6 @@
CD7F89DB22A86CDA00D683AE /* WKWebViewSuspendAllMediaPlayback.mm */,
9984FACA1CFFAEEE008D198C /* WKWebViewTextInput.mm */,
95A524942581A10D00461FE9 /* WKWebViewThemeColor.mm */,
- 953ABB3425C0D681004C8B73 /* WKWebViewUnderPageBackgroundColor.mm */,
);
name = "WebKit Cocoa";
path = WebKitCocoa;
@@ -5452,6 +5452,7 @@
CDB213BD24EF522800FDE301 /* FullscreenFocus.mm in Sources */,
CDE77D2525A6591C00D4115E /* FullscreenPointerLeave.mm in Sources */,
CDDC7C6925FFF6D000224278 /* FullscreenRemoveNodeBeforeEnter.mm in Sources */,
+ 46A80F26264C29D400EEF20D /* NotificationAPI.mm in Sources */,
CDBFCC451A9FF45300A7B691 /* FullscreenZoomInitialFrame.mm in Sources */,
83DB79691EF63B3C00BFA5E5 /* Function.cpp in Sources */,
7CCE7EF81A411AE600447C4C /* Geolocation.cpp in Sources */,
@@ -5582,7 +5583,6 @@
7CCE7F051A411AE600447C4C /* NewFirstVisuallyNonEmptyLayoutFrames.cpp in Sources */,
0F5651F71FCE4DDC00310FBC /* NoHistoryItemScrollToFragment.mm in Sources */,
83F22C6420B355F80034277E /* NoPolicyDelegateResponse.mm in Sources */,
- 46A80F26264C29D400EEF20D /* NotificationAPI.mm in Sources */,
CD2D0D1A213465560018C784 /* NowPlaying.mm in Sources */,
2ECFF5551D9B12F800B55394 /* NowPlayingControlsTests.mm in Sources */,
5159F267260D43E300B2DA3C /* NowPlayingInfoTests.cpp in Sources */,
@@ -5596,6 +5596,7 @@
0F34077623037FDC0060A1A0 /* OverflowScrollViewTests.mm in Sources */,
C104BC1F2547237100C078C9 /* OverrideAppleLanguagesPreference.mm in Sources */,
2DA2586F225C67DC00B45C1C /* OverrideViewportArguments.mm in Sources */,
+ 953ABB3525C0D682004C8B73 /* PageExtendedBackgroundColor.mm in Sources */,
7CCB4DA91C83AE7300CC6918 /* PageGroup.cpp in Sources */,
7CCE7F071A411AE600447C4C /* PageLoadBasic.cpp in Sources */,
7CCE7F081A411AE600447C4C /* PageLoadDidChangeLocationWithinPageForFrame.cpp in Sources */,
@@ -5877,7 +5878,6 @@
CD7F89DC22A86CDA00D683AE /* WKWebViewSuspendAllMediaPlayback.mm in Sources */,
9984FACC1CFFAF60008D198C /* WKWebViewTextInput.mm in Sources */,
95A524952581A10D00461FE9 /* WKWebViewThemeColor.mm in Sources */,
- 953ABB3525C0D682004C8B73 /* WKWebViewUnderPageBackgroundColor.mm in Sources */,
7C74C8FA22DFBA9600DA2DAB /* WTFStringUtilities.cpp in Sources */,
C14D304624B4C3BA00480387 /* XPCEndpoint.mm in Sources */,
9C64DC321D76198A004B598E /* YouTubePluginReplacement.cpp in Sources */,
Added: branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/PageExtendedBackgroundColor.mm (0 => 277695)
--- branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/PageExtendedBackgroundColor.mm (rev 0)
+++ branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/PageExtendedBackgroundColor.mm 2021-05-18 23:55:52 UTC (rev 277695)
@@ -0,0 +1,163 @@
+/*
+ * 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()));
+}
Modified: branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm 2021-05-18 23:55:52 UTC (rev 277695)
@@ -81,12 +81,20 @@
@end
-static RetainPtr<TestWKWebView> createWebViewWithSampledPageTopColorMaxDifference(double sampledPageTopColorMaxDifference, double sampledPageTopColorMinHeight = 0)
+enum class UseSampledPageTopColorForScrollAreaBackgroundColor : bool { Yes, No };
+static RetainPtr<TestWKWebView> createWebViewWithSampledPageTopColorMaxDifference(double sampledPageTopColorMaxDifference, double sampledPageTopColorMinHeight = 0, UseSampledPageTopColorForScrollAreaBackgroundColor useSampledPageTopColorForScrollAreaBackgroundColor = UseSampledPageTopColorForScrollAreaBackgroundColor::No)
{
auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
[configuration _setSampledPageTopColorMaxDifference:sampledPageTopColorMaxDifference];
[configuration _setSampledPageTopColorMinHeight:sampledPageTopColorMinHeight];
+ for (_WKInternalDebugFeature *feature in [WKPreferences _internalDebugFeatures]) {
+ if ([feature.key isEqualToString:@"UseSampledPageTopColorForScrollAreaBackgroundColor"]) {
+ [[configuration preferences] _setEnabled:(useSampledPageTopColorForScrollAreaBackgroundColor == UseSampledPageTopColorForScrollAreaBackgroundColor::Yes) forInternalDebugFeature:feature];
+ break;
+ }
+ }
+
return adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration.get()]);
}
@@ -350,3 +358,34 @@
EXPECT_IN_RANGE(components[2], 1.00, 1.01);
EXPECT_EQ(components[3], 1);
}
+
+#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)
Modified: branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewThemeColor.mm (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewThemeColor.mm 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewThemeColor.mm 2021-05-18 23:55:52 UTC (rev 277695)
@@ -321,3 +321,52 @@
}
#endif // ENABLE(APPLICATION_MANIFEST)
+
+#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)
Deleted: branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewUnderPageBackgroundColor.mm (277694 => 277695)
--- branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewUnderPageBackgroundColor.mm 2021-05-18 23:55:44 UTC (rev 277694)
+++ branches/safari-612.1.15.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewUnderPageBackgroundColor.mm 2021-05-18 23:55:52 UTC (rev 277695)
@@ -1,302 +0,0 @@
-/*
- * 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)
-