Diff
Modified: trunk/Source/WebCore/ChangeLog (291563 => 291564)
--- trunk/Source/WebCore/ChangeLog 2022-03-21 17:37:08 UTC (rev 291563)
+++ trunk/Source/WebCore/ChangeLog 2022-03-21 17:44:45 UTC (rev 291564)
@@ -1,3 +1,24 @@
+2022-03-21 Tim Horton <timothy_hor...@apple.com>
+
+ Add an addition point for system background color
+ https://bugs.webkit.org/show_bug.cgi?id=238108
+ <rdar://problem/90463946>
+
+ Reviewed by Aditya Keerthi.
+
+ * SourcesCocoa.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/ios/WebCoreUIColorExtras.h: Added.
+ * platform/ios/WebCoreUIColorExtras.mm: Added.
+ (WebCore::systemBackgroundColor):
+ Add an addition point.
+
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::CSSValueSystemColorInformation::function):
+ (WebCore::cssValueSystemColorInformationList):
+ (WebCore::systemColorFromCSSValueSystemColorInformation):
+ Adopt it for CSS use of system background color.
+
2022-03-21 Alex Christensen <achristen...@webkit.org>
Dust off Mac CMake build
Modified: trunk/Source/WebCore/SourcesCocoa.txt (291563 => 291564)
--- trunk/Source/WebCore/SourcesCocoa.txt 2022-03-21 17:37:08 UTC (rev 291563)
+++ trunk/Source/WebCore/SourcesCocoa.txt 2022-03-21 17:44:45 UTC (rev 291564)
@@ -480,6 +480,7 @@
platform/ios/WebBackgroundTaskController.mm
platform/ios/WebCoreMotionManager.mm
platform/ios/WebEvent.mm @no-unify
+platform/ios/WebCoreUIColorExtras.mm
platform/ios/WebItemProviderPasteboard.mm @no-unify
platform/ios/WebSQLiteDatabaseTrackerClient.mm
platform/ios/WebVideoFullscreenControllerAVKit.mm @no-unify
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (291563 => 291564)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2022-03-21 17:37:08 UTC (rev 291563)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2022-03-21 17:44:45 UTC (rev 291564)
@@ -862,6 +862,7 @@
2D8B92FD203D13E1009C868F /* UnifiedSource528.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE5F85D21FA23856006DB63B /* UnifiedSource528.cpp */; };
2D8B92FE203D13E1009C868F /* UnifiedSource529.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE5F85CF1FA23850006DB63B /* UnifiedSource529.cpp */; };
2D8B92FF203D13E1009C868F /* UnifiedSource530.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE5F85D31FA23859006DB63B /* UnifiedSource530.cpp */; };
+ 2D8BA18127E5A487008F7E52 /* WebCoreUIColorExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D8BA18027E5A47B008F7E52 /* WebCoreUIColorExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D8FEBDB143E3EF70072502B /* CSSCrossfadeValue.h */; };
2D9066070BE141D400956998 /* RenderLayoutState.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9066050BE141D400956998 /* RenderLayoutState.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D93AEE319DF5641002A86C3 /* ServicesOverlayController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D93AEE119DF5641002A86C3 /* ServicesOverlayController.h */; };
@@ -8107,6 +8108,8 @@
2D7ED0A91BAE99170043B3E5 /* TimerEventBasedMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimerEventBasedMock.h; sourceTree = "<group>"; };
2D8287F416E4A0380086BD00 /* HitTestLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HitTestLocation.cpp; sourceTree = "<group>"; };
2D8287F516E4A0380086BD00 /* HitTestLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HitTestLocation.h; sourceTree = "<group>"; };
+ 2D8BA17F27E5A47A008F7E52 /* WebCoreUIColorExtras.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreUIColorExtras.mm; sourceTree = "<group>"; };
+ 2D8BA18027E5A47B008F7E52 /* WebCoreUIColorExtras.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebCoreUIColorExtras.h; sourceTree = "<group>"; };
2D8D3BEB23847AC900657075 /* gesture-recognizer.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; path = "gesture-recognizer.js"; sourceTree = "<group>"; };
2D8D3BEC23847AC900657075 /* pinch.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; path = pinch.js; sourceTree = "<group>"; };
2D8D3BED23847AC900657075 /* tap.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; path = tap.js; sourceTree = "<group>"; };
@@ -26785,6 +26788,8 @@
1F36EA9B1E21BA1700621E25 /* WebBackgroundTaskController.mm */,
31403797124BEA7F00AF40E4 /* WebCoreMotionManager.h */,
31403798124BEA7F00AF40E4 /* WebCoreMotionManager.mm */,
+ 2D8BA18027E5A47B008F7E52 /* WebCoreUIColorExtras.h */,
+ 2D8BA17F27E5A47A008F7E52 /* WebCoreUIColorExtras.mm */,
FE0D84E810484348001A179E /* WebEvent.h */,
FE0D84EA1048436E001A179E /* WebEvent.mm */,
F482230F1E3869B80066FC79 /* WebItemProviderPasteboard.h */,
@@ -38054,6 +38059,7 @@
A14832CC187F67C400DA63A6 /* WebCoreThreadRun.h in Headers */,
A14832CF187F684700DA63A6 /* WebCoreThreadSystemInterface.h in Headers */,
0F099D0917B968A100FF84B9 /* WebCoreTypedArrayController.h in Headers */,
+ 2D8BA18127E5A487008F7E52 /* WebCoreUIColorExtras.h in Headers */,
37F818FD0D657606005E1F05 /* WebCoreURLResponse.h in Headers */,
44A20DB90F84166C00B3E1FE /* WebCoreURLResponseIOS.h in Headers */,
93F199F008245E59001E9ABC /* WebCoreView.h in Headers */,
Added: trunk/Source/WebCore/platform/ios/WebCoreUIColorExtras.h (0 => 291564)
--- trunk/Source/WebCore/platform/ios/WebCoreUIColorExtras.h (rev 0)
+++ trunk/Source/WebCore/platform/ios/WebCoreUIColorExtras.h 2022-03-21 17:44:45 UTC (rev 291564)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#pragma once
+
+#if PLATFORM(IOS_FAMILY)
+
+namespace WebCore {
+
+WEBCORE_EXPORT UIColor *systemBackgroundColor();
+
+} // namespace WebCore
+
+#endif
Added: trunk/Source/WebCore/platform/ios/WebCoreUIColorExtras.mm (0 => 291564)
--- trunk/Source/WebCore/platform/ios/WebCoreUIColorExtras.mm (rev 0)
+++ trunk/Source/WebCore/platform/ios/WebCoreUIColorExtras.mm 2022-03-21 17:44:45 UTC (rev 291564)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2022 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 "WebCoreUIColorExtras.h"
+
+#if PLATFORM(IOS_FAMILY)
+
+#import <pal/ios/UIKitSoftLink.h>
+
+#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/WebCoreUIColorExtrasAdditions.mm>)
+
+#import <WebKitAdditions/WebCoreUIColorExtrasAdditions.mm>
+
+#else
+
+namespace WebCore {
+
+UIColor *systemBackgroundColor()
+{
+ return (UIColor *)[PAL::getUIColorClass() systemBackgroundColor];
+}
+
+} // namespace WebCore
+
+#endif
+
+#endif // PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (291563 => 291564)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2022-03-21 17:37:08 UTC (rev 291563)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2022-03-21 17:44:45 UTC (rev 291564)
@@ -80,6 +80,7 @@
#import "Theme.h"
#import "UTIUtilities.h"
#import "WebCoreThreadRun.h"
+#import "WebCoreUIColorExtras.h"
#import <CoreGraphics/CoreGraphics.h>
#import <CoreImage/CoreImage.h>
#import <objc/runtime.h>
@@ -1444,6 +1445,7 @@
SEL selector;
bool makeOpaque { false };
float opacity { 1.0f };
+ UIColor *(*function)(void) { nullptr };
};
static const Vector<CSSValueSystemColorInformation>& cssValueSystemColorInformationList()
@@ -1456,7 +1458,7 @@
[] {
cssValueSystemColorInformationList.get() = Vector(std::initializer_list<CSSValueSystemColorInformation> {
{ CSSValueText, @selector(labelColor) },
- { CSSValueWebkitControlBackground, @selector(systemBackgroundColor) },
+ { CSSValueWebkitControlBackground, nil, false, 1.0f, &systemBackgroundColor },
{ CSSValueAppleSystemBlue, @selector(systemBlueColor) },
{ CSSValueAppleSystemBrown, @selector(systemBrownColor) },
{ CSSValueAppleSystemGray, @selector(systemGrayColor) },
@@ -1468,7 +1470,7 @@
{ CSSValueAppleSystemRed, @selector(systemRedColor) },
{ CSSValueAppleSystemTeal, @selector(systemTealColor) },
{ CSSValueAppleSystemYellow, @selector(systemYellowColor) },
- { CSSValueAppleSystemBackground, @selector(systemBackgroundColor) },
+ { CSSValueAppleSystemBackground, nil, false, 1.0f, &systemBackgroundColor },
{ CSSValueAppleSystemSecondaryBackground, @selector(secondarySystemBackgroundColor) },
{ CSSValueAppleSystemTertiaryBackground, @selector(tertiarySystemBackgroundColor) },
{ CSSValueAppleSystemOpaqueFill, @selector(systemFillColor), true },
@@ -1488,11 +1490,11 @@
// FIXME: <rdar://problem/79471528> Adopt [UIColor opaqueSeparatorColor] once it has a high contrast variant.
{ CSSValueAppleSystemOpaqueSeparator, @selector(separatorColor), true },
{ CSSValueAppleSystemContainerBorder, @selector(separatorColor) },
- { CSSValueAppleSystemControlBackground, @selector(systemBackgroundColor) },
+ { CSSValueAppleSystemControlBackground, nil, false, 1.0f, &systemBackgroundColor },
{ CSSValueAppleSystemGrid, @selector(separatorColor) },
{ CSSValueAppleSystemHeaderText, @selector(labelColor) },
{ CSSValueAppleSystemSelectedContentBackground, @selector(tableCellDefaultSelectionTintColor) },
- { CSSValueAppleSystemTextBackground, @selector(systemBackgroundColor) },
+ { CSSValueAppleSystemTextBackground, nil, false, 1.0f, &systemBackgroundColor },
{ CSSValueAppleSystemUnemphasizedSelectedContentBackground, @selector(tableCellDefaultSelectionTintColor) },
{ CSSValueAppleWirelessPlaybackTargetActive, @selector(systemBlueColor) },
});
@@ -1503,19 +1505,24 @@
static inline std::optional<Color> systemColorFromCSSValueSystemColorInformation(CSSValueSystemColorInformation systemColorInformation, bool useDarkAppearance)
{
- if (auto color = wtfObjCMsgSend<UIColor *>(PAL::getUIColorClass(), systemColorInformation.selector)) {
- Color systemColor(roundAndClampToSRGBALossy(color.CGColor), Color::Flags::Semantic);
+ UIColor *color = nil;
+ if (systemColorInformation.selector)
+ color = wtfObjCMsgSend<UIColor *>(PAL::getUIColorClass(), systemColorInformation.selector);
+ else
+ color = systemColorInformation.function();
- if (systemColorInformation.opacity < 1.0f)
- systemColor = systemColor.colorWithAlphaMultipliedBy(systemColorInformation.opacity);
+ if (!color)
+ return std::nullopt;
- if (systemColorInformation.makeOpaque)
- return blendSourceOver(useDarkAppearance ? Color::black : Color::white, systemColor);
+ Color systemColor(roundAndClampToSRGBALossy(color.CGColor), Color::Flags::Semantic);
- return systemColor;
- }
+ if (systemColorInformation.opacity < 1.0f)
+ systemColor = systemColor.colorWithAlphaMultipliedBy(systemColorInformation.opacity);
- return std::nullopt;
+ if (systemColorInformation.makeOpaque)
+ return blendSourceOver(useDarkAppearance ? Color::black : Color::white, systemColor);
+
+ return systemColor;
}
static std::optional<Color> systemColorFromCSSValueID(CSSValueID cssValueID, bool useDarkAppearance, bool useElevatedUserInterfaceLevel)
Modified: trunk/Source/WebKit/ChangeLog (291563 => 291564)
--- trunk/Source/WebKit/ChangeLog 2022-03-21 17:37:08 UTC (rev 291563)
+++ trunk/Source/WebKit/ChangeLog 2022-03-21 17:44:45 UTC (rev 291564)
@@ -1,3 +1,22 @@
+2022-03-21 Tim Horton <timothy_hor...@apple.com>
+
+ Add an addition point for system background color
+ https://bugs.webkit.org/show_bug.cgi?id=238108
+ <rdar://problem/90463946>
+
+ Reviewed by Aditya Keerthi.
+
+ * UIProcess/API/ios/WKWebViewIOS.mm:
+ (scrollViewBackgroundColor):
+ Adopt systemBackgroundColor().
+
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::contentViewBackgroundColor):
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::platformUnderPageBackgroundColor const):
+ Move the fallback to systemBackgroundColor into PageClientImpl
+ so that it can realize the web view's trait collection.
+
2022-03-21 Adam Mazander <mazan...@apple.com>
Sandbox: Remove telemetry in Network Process sandbox macOS
Modified: trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm (291563 => 291564)
--- trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm 2022-03-21 17:37:08 UTC (rev 291563)
+++ trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm 2022-03-21 17:44:45 UTC (rev 291564)
@@ -61,6 +61,7 @@
#import <WebCore/LocalCurrentTraitCollection.h>
#import <WebCore/MIMETypeRegistry.h>
#import <WebCore/RuntimeApplicationChecks.h>
+#import <WebCore/WebCoreUIColorExtras.h>
#import <pal/spi/cocoa/QuartzCoreSPI.h>
#import <pal/spi/ios/GraphicsServicesSPI.h>
#import <wtf/BlockPtr.h>
@@ -542,7 +543,7 @@
if (!color.isValid()) {
#if HAVE(OS_DARK_MODE_SUPPORT)
- color = WebCore::roundAndClampToSRGBALossy(UIColor.systemBackgroundColor.CGColor);
+ color = WebCore::roundAndClampToSRGBALossy(WebCore::systemBackgroundColor().CGColor);
#else
color = WebCore::Color::white;
#endif
Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (291563 => 291564)
--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2022-03-21 17:37:08 UTC (rev 291563)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2022-03-21 17:44:45 UTC (rev 291564)
@@ -64,6 +64,7 @@
#import <WebCore/Cursor.h>
#import <WebCore/DOMPasteAccess.h>
#import <WebCore/DictionaryLookup.h>
+#import <WebCore/LocalCurrentTraitCollection.h>
#import <WebCore/NotImplemented.h>
#import <WebCore/PlatformScreen.h>
#import <WebCore/PromisedAttachmentInfo.h>
@@ -71,6 +72,7 @@
#import <WebCore/SharedBuffer.h>
#import <WebCore/TextIndicator.h>
#import <WebCore/ValidationBubble.h>
+#import <WebCore/WebCoreUIColorExtras.h>
#import <wtf/BlockPtr.h>
#import <wtf/cocoa/Entitlements.h>
@@ -1018,7 +1020,18 @@
WebCore::Color PageClientImpl::contentViewBackgroundColor()
{
- return WebCore::roundAndClampToSRGBALossy([m_contentView backgroundColor].CGColor);
+#if HAVE(OS_DARK_MODE_SUPPORT)
+ WebCore::LocalCurrentTraitCollection localTraitCollection([m_webView traitCollection]);
+#endif
+
+ WebCore::Color color = WebCore::roundAndClampToSRGBALossy([m_contentView backgroundColor].CGColor);
+ if (color.isValid())
+ return color;
+#if HAVE(OS_DARK_MODE_SUPPORT)
+ return WebCore::roundAndClampToSRGBALossy(WebCore::systemBackgroundColor().CGColor);
+#else
+ return { };
+#endif
}
void PageClientImpl::requestScrollToRect(const FloatRect& targetRect, const FloatPoint& origin)
Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (291563 => 291564)
--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2022-03-21 17:37:08 UTC (rev 291563)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2022-03-21 17:44:45 UTC (rev 291564)
@@ -1600,11 +1600,7 @@
if (auto contentViewBackgroundColor = pageClient().contentViewBackgroundColor(); contentViewBackgroundColor.isValid())
return contentViewBackgroundColor;
-#if HAVE(OS_DARK_MODE_SUPPORT)
- return WebCore::roundAndClampToSRGBALossy(UIColor.systemBackgroundColor.CGColor);
-#else
return WebCore::Color::white;
-#endif
}
} // namespace WebKit