Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4335716855bb893798267c14053068e6c8ad010e
https://github.com/WebKit/WebKit/commit/4335716855bb893798267c14053068e6c8ad010e
Author: Devin Rousso <[email protected]>
Date: 2026-05-28 (Thu, 28 May 2026)
Changed paths:
M Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h
M Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp
M Source/WebCore/dom/Document.cpp
M Source/WebCore/dom/Document.h
M Source/WebCore/page/Page.cpp
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
M Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm
M Tools/TestWebKitAPI/Helpers/cocoa/TestCocoa.h
M Tools/TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ApplicationManifest.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebViewThemeColor.mm
M
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebViewUnderPageBackgroundColor.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ios/WKScrollViewTests.mm
Log Message:
-----------
Implement `color_scheme_dark` manifest member
https://bugs.webkit.org/show_bug.cgi?id=311727
<rdar://problem/174315709>
Reviewed by Aditya Keerthi.
This allows developers to specify both a light and dark theme color (and
background color) instead of only having a single color for both.
Tests: Tools/TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ApplicationManifest.mm
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebViewThemeColor.mm
* Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp:
(WebCore::ApplicationManifestParser::parseManifest):
When parsing, look for a `color_scheme_dark` object and (if it exists) pull out
additional `background_color` and `theme_color` properties.
Save them in separate member variables since the manifest itself has no
knowledge of the system appearance (i.e. it just holds the data for someone
else to use).
* Source/WebCore/dom/Document.h:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::themeColor):
(WebCore::Document::processApplicationManifest):
(WebCore::Document::appearanceDidChange): Added.
* Source/WebCore/page/Page.cpp:
(WebCore::Page::appearanceDidChange):
Notify the `Document` whenever the system appearance changes so that it can
re-evaluate which `theme_color` to use from the manifest.
* Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm:
(-[_WKApplicationManifest initWithCoder:]):
(-[_WKApplicationManifest encodeWithCoder:]):
(-[_WKApplicationManifest backgroundColor]):
(-[_WKApplicationManifest themeColor]):
Modify the existing SPI for these colors to use dynamic providers for the dark
color (if given) is used when in dark mode.
* Tools/TestWebKitAPI/Helpers/cocoa/TestCocoa.h:
* Tools/TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp:
(ApplicationManifestParserTest::testBackgroundColorDark): Added.
(ApplicationManifestParserTest::testThemeColorDark): Added.
(TEST_F(ApplicationManifestParserTest, BackgroundColorDark)): Added.
(TEST_F(ApplicationManifestParserTest, ThemeColorDark)): Added.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ApplicationManifest.mm:
(TestWebKitAPI::TEST(ApplicationManifest, Coding)):
(TestWebKitAPI::TEST(ApplicationManifest, Basic)):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebViewThemeColor.mm:
(TEST(WKWebViewThemeColor, ApplicationManifest)):
(TEST(WKWebViewThemeColor, MetaElementOverridesApplicationManifest)):
*
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebViewUnderPageBackgroundColor.mm:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ios/WKScrollViewTests.mm:
Canonical link: https://commits.webkit.org/314109@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications