Diff
Modified: trunk/LayoutTests/ChangeLog (254372 => 254373)
--- trunk/LayoutTests/ChangeLog 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/LayoutTests/ChangeLog 2020-01-10 23:39:54 UTC (rev 254373)
@@ -1,3 +1,16 @@
+2020-01-09 Per Arne Vollan <pvol...@apple.com>
+
+ Map CSS value ID to system color in the UI process
+ https://bugs.webkit.org/show_bug.cgi?id=204314
+
+ Reviewed by Dean Jackson.
+
+ * TestExpectations:
+ * fast/css/ios: Added.
+ * fast/css/ios/system-color-for-css-value-expected.txt: Added.
+ * fast/css/ios/system-color-for-css-value.html: Added.
+ * platform/ios/TestExpectations:
+
2020-01-10 Pablo Saavedra <psaave...@igalia.com>
[WPE][GTK] Gardening after r254357
Modified: trunk/LayoutTests/TestExpectations (254372 => 254373)
--- trunk/LayoutTests/TestExpectations 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/LayoutTests/TestExpectations 2020-01-10 23:39:54 UTC (rev 254373)
@@ -23,6 +23,7 @@
editing/selection/ios [ Skip ]
editing/undo-manager [ Skip ]
tiled-drawing [ Skip ]
+fast/css/ios [ Skip ]
fast/css/watchos [ Skip ]
fast/dom/Window/watchos [ Skip ]
fast/forms/select/mac-wk2 [ Skip ]
Added: trunk/LayoutTests/fast/css/ios/system-color-for-css-value-expected.txt (0 => 254373)
--- trunk/LayoutTests/fast/css/ios/system-color-for-css-value-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/ios/system-color-for-css-value-expected.txt 2020-01-10 23:39:54 UTC (rev 254373)
@@ -0,0 +1,41 @@
+Test that system colors for CSS values are correct.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS internals.systemColorForCSSValue('-apple-system-label', true, false) is 'rgb(255, 255, 255)'
+PASS internals.systemColorForCSSValue('-apple-system-header-text', true, false) is 'rgb(255, 255, 255)'
+PASS internals.systemColorForCSSValue('-apple-system-secondary-label', true, false) is 'rgba(235, 235, 245, 0.6)'
+PASS internals.systemColorForCSSValue('-apple-system-tertiary-label', true, false) is 'rgba(235, 235, 245, 0.298)'
+PASS internals.systemColorForCSSValue('-apple-system-quaternary-label', true, false) is 'rgba(235, 235, 245, 0.18)'
+PASS internals.systemColorForCSSValue('-apple-system-placeholder-text', true, false) is 'rgba(235, 235, 245, 0.298)'
+PASS internals.systemColorForCSSValue('-webkit-control-background', true, false) is 'rgb(0, 0, 0)'
+PASS internals.systemColorForCSSValue('-apple-system-control-background', true, false) is 'rgb(0, 0, 0)'
+PASS internals.systemColorForCSSValue('-apple-system-text-background', true, false) is 'rgb(0, 0, 0)'
+PASS internals.systemColorForCSSValue('-apple-system-background', true, false) is 'rgb(0, 0, 0)'
+PASS internals.systemColorForCSSValue('-apple-system-secondary-background', true, false) is 'rgb(28, 28, 30)'
+PASS internals.systemColorForCSSValue('-apple-system-tertiary-background', true, false) is 'rgb(44, 44, 46)'
+PASS internals.systemColorForCSSValue('-apple-system-grouped-background', true, false) is 'rgb(0, 0, 0)'
+PASS internals.systemColorForCSSValue('-apple-system-secondary-grouped-background', true, false) is 'rgb(28, 28, 30)'
+PASS internals.systemColorForCSSValue('-apple-system-tertiary-grouped-background', true, false) is 'rgb(44, 44, 46)'
+PASS internals.systemColorForCSSValue('-apple-system-grid', true, false) is 'rgba(84, 84, 88, 0.6)'
+PASS internals.systemColorForCSSValue('-apple-system-separator', true, false) is 'rgba(84, 84, 88, 0.6)'
+PASS internals.systemColorForCSSValue('-apple-system-container-border', true, false) is 'rgba(84, 84, 88, 0.6)'
+PASS internals.systemColorForCSSValue('-apple-system-selected-content-background', true, false) is 'rgb(58, 58, 60)'
+PASS internals.systemColorForCSSValue('-apple-system-unemphasized-selected-content-background', true, false) is 'rgb(58, 58, 60)'
+PASS internals.systemColorForCSSValue('-apple-system-brown', true, false) is 'rgb(172, 142, 104)'
+PASS internals.systemColorForCSSValue('-apple-system-indigo', true, false) is 'rgb(94, 92, 230)'
+PASS internals.systemColorForCSSValue('-apple-system-teal', true, false) is 'rgb(100, 210, 255)'
+PASS internals.systemColorForCSSValue('-apple-wireless-playback-target-active', true, false) is 'rgb(10, 132, 255)'
+PASS internals.systemColorForCSSValue('-apple-system-blue', true, false) is 'rgb(10, 132, 255)'
+PASS internals.systemColorForCSSValue('-apple-system-gray', true, false) is 'rgb(142, 142, 147)'
+PASS internals.systemColorForCSSValue('-apple-system-green', true, false) is 'rgb(48, 209, 88)'
+PASS internals.systemColorForCSSValue('-apple-system-orange', true, false) is 'rgb(255, 159, 10)'
+PASS internals.systemColorForCSSValue('-apple-system-pink', true, false) is 'rgb(255, 55, 95)'
+PASS internals.systemColorForCSSValue('-apple-system-purple', true, false) is 'rgb(191, 90, 242)'
+PASS internals.systemColorForCSSValue('-apple-system-red', true, false) is 'rgb(255, 69, 58)'
+PASS internals.systemColorForCSSValue('-apple-system-yellow', true, false) is 'rgb(255, 214, 10)'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/css/ios/system-color-for-css-value.html (0 => 254373)
--- trunk/LayoutTests/fast/css/ios/system-color-for-css-value.html (rev 0)
+++ trunk/LayoutTests/fast/css/ios/system-color-for-css-value.html 2020-01-10 23:39:54 UTC (rev 254373)
@@ -0,0 +1,49 @@
+<html>
+<head id="head">
+<script src=""
+</head>
+<body >
+<script>
+
+description("Test that system colors for CSS values are correct.");
+
+if (window.internals) {
+ shouldBe("internals.systemColorForCSSValue('-apple-system-label', true, false)", "'rgb(255, 255, 255)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-header-text', true, false)", "'rgb(255, 255, 255)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-secondary-label', true, false)", "'rgba(235, 235, 245, 0.6)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-tertiary-label', true, false)", "'rgba(235, 235, 245, 0.298)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-quaternary-label', true, false)", "'rgba(235, 235, 245, 0.18)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-placeholder-text', true, false)", "'rgba(235, 235, 245, 0.298)'");
+ shouldBe("internals.systemColorForCSSValue('-webkit-control-background', true, false)", "'rgb(0, 0, 0)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-control-background', true, false)", "'rgb(0, 0, 0)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-text-background', true, false)", "'rgb(0, 0, 0)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-background', true, false)", "'rgb(0, 0, 0)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-secondary-background', true, false)", "'rgb(28, 28, 30)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-tertiary-background', true, false)", "'rgb(44, 44, 46)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-grouped-background', true, false)", "'rgb(0, 0, 0)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-secondary-grouped-background', true, false)", "'rgb(28, 28, 30)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-tertiary-grouped-background', true, false)", "'rgb(44, 44, 46)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-grid', true, false)", "'rgba(84, 84, 88, 0.6)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-separator', true, false)", "'rgba(84, 84, 88, 0.6)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-container-border', true, false)", "'rgba(84, 84, 88, 0.6)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-selected-content-background', true, false)", "'rgb(58, 58, 60)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-unemphasized-selected-content-background', true, false)", "'rgb(58, 58, 60)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-brown', true, false)", "'rgb(172, 142, 104)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-indigo', true, false)", "'rgb(94, 92, 230)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-teal', true, false)", "'rgb(100, 210, 255)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-wireless-playback-target-active', true, false)", "'rgb(10, 132, 255)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-blue', true, false)", "'rgb(10, 132, 255)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-gray', true, false)", "'rgb(142, 142, 147)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-green', true, false)", "'rgb(48, 209, 88)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-orange', true, false)", "'rgb(255, 159, 10)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-pink', true, false)", "'rgb(255, 55, 95)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-purple', true, false)", "'rgb(191, 90, 242)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-red', true, false)", "'rgb(255, 69, 58)'");
+ shouldBe("internals.systemColorForCSSValue('-apple-system-yellow', true, false)", "'rgb(255, 214, 10)'");
+}
+
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios/TestExpectations (254372 => 254373)
--- trunk/LayoutTests/platform/ios/TestExpectations 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2020-01-10 23:39:54 UTC (rev 254373)
@@ -13,6 +13,7 @@
quicklook [ Pass ]
swipe [ Pass ]
+fast/css/ios [ Pass ]
fast/media/ios [ Pass ]
fast/forms/textarea/ios [ Pass ]
@@ -3458,4 +3459,4 @@
webkit.org/b/204757 imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination-no-load-event.https.html [ Pass Failure ]
-webkit.org/b/205309 scrollingcoordinator/ios/scroll-position-after-reattach.html [ ImageonlyFailure ]
\ No newline at end of file
+webkit.org/b/205309 scrollingcoordinator/ios/scroll-position-after-reattach.html [ ImageOnlyFailure ]
Modified: trunk/Source/WebCore/ChangeLog (254372 => 254373)
--- trunk/Source/WebCore/ChangeLog 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/Source/WebCore/ChangeLog 2020-01-10 23:39:54 UTC (rev 254373)
@@ -1,3 +1,43 @@
+2020-01-09 Per Arne Vollan <pvol...@apple.com>
+
+ Map CSS value ID to system color in the UI process
+ https://bugs.webkit.org/show_bug.cgi?id=204314
+
+ Reviewed by Dean Jackson.
+
+ Currently, RenderThemeIOS is mapping CSS value IDs to system colors in the WebContent process. This mapping leads to
+ invoking selectors on UITraitCollection and UIColor, which will send messages to the runningboard daemon. Since we
+ will be blocking access to this daemon in the WebContent process, this mapping should be moved to the UI process.
+ The UI process will create a mapping between CSS value IDs and system colors, and pass it to the WebContent process.
+
+ Test: fast/css/ios/system-color-for-css-value.html
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/StyleColor.h:
+ * css/parser/CSSPropertyParser.h:
+ * rendering/CSSValueKey.h: Added.
+ (WebCore::operator==):
+ (WebCore::CSSValueKey::encode const):
+ (WebCore::CSSValueKey::decode):
+ (WebCore::CSSValueKey::hash const):
+ (WTF::CSSValueKeyHash::hash):
+ (WTF::CSSValueKeyHash::equal):
+ (WTF::HashTraits<WebCore::CSSValueKey>::emptyValue):
+ (WTF::HashTraits<WebCore::CSSValueKey>::constructDeletedValue):
+ (WTF::HashTraits<WebCore::CSSValueKey>::isDeletedValue):
+ * rendering/RenderThemeIOS.h:
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::cssValueIDSelectorList):
+ (WebCore::systemColorFromCSSValueID):
+ (WebCore::globalCSSValueToSystemColorMap):
+ (WebCore::RenderThemeIOS::getOrCreateCSSValueToSystemColorMap):
+ (WebCore::RenderThemeIOS::setCSSValueToSystemColorMap):
+ (WebCore::RenderThemeIOS::systemColor const):
+ * testing/Internals.cpp:
+ (WebCore::Internals::systemColorForCSSValue):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2020-01-10 Antti Koivisto <an...@apple.com>
[LFC][Integration] Fix accessibility/deleting-iframe-destroys-axcache.html and accessibility/div-within-anchors-causes-crash.html
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (254372 => 254373)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-01-10 23:39:54 UTC (rev 254373)
@@ -4803,6 +4803,7 @@
E3B2F0ED1D7F4CA300B0C9D1 /* LoadableScript.h in Headers */ = {isa = PBXBuildFile; fileRef = E3B2F0E71D7F35EC00B0C9D1 /* LoadableScript.h */; settings = {ATTRIBUTES = (Private, ); }; };
E3B2F0EE1D7F4CA900B0C9D1 /* LoadableScriptClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E3B2F0E81D7F35EC00B0C9D1 /* LoadableScriptClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
E3B2F0F01D7F4CB500B0C9D1 /* LoadableClassicScript.h in Headers */ = {isa = PBXBuildFile; fileRef = E3B2F0E41D7F35EC00B0C9D1 /* LoadableClassicScript.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ E3BBC24723835526006EC39F /* CSSValueKey.h in Headers */ = {isa = PBXBuildFile; fileRef = E3BBC2452383551A006EC39F /* CSSValueKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
E3C99A091DC3D41C00794AD3 /* DOMJITCheckDOM.h in Headers */ = {isa = PBXBuildFile; fileRef = E3C99A081DC3D41700794AD3 /* DOMJITCheckDOM.h */; };
E3C9AECB2113149900419B92 /* JSMicrotaskCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = E3C9AEC92113147400419B92 /* JSMicrotaskCallback.h */; };
E3E4E2A81E3B17100023BB8A /* ScriptElementCachedScriptFetcher.h in Headers */ = {isa = PBXBuildFile; fileRef = E3E4E2A61E3B16FC0023BB8A /* ScriptElementCachedScriptFetcher.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -15152,6 +15153,7 @@
E3B2F0E81D7F35EC00B0C9D1 /* LoadableScriptClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadableScriptClient.h; sourceTree = "<group>"; };
E3B2F0E91D7F3D3C00B0C9D1 /* LoadableScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadableScript.cpp; sourceTree = "<group>"; };
E3B7C0621DC3415A001FB0B8 /* JSDocumentDOMJIT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDocumentDOMJIT.cpp; sourceTree = "<group>"; };
+ E3BBC2452383551A006EC39F /* CSSValueKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSValueKey.h; sourceTree = "<group>"; };
E3BC827322530221005276DE /* NodeList.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = NodeList.cpp; sourceTree = "<group>"; };
E3BF19E122AF2F55009C9926 /* XMLHttpRequestProgressEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XMLHttpRequestProgressEvent.cpp; sourceTree = "<group>"; };
E3BF19E322AF2FA5009C9926 /* OverconstrainedErrorEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = OverconstrainedErrorEvent.cpp; sourceTree = "<group>"; };
@@ -27681,6 +27683,7 @@
9392F14B0AD1861B00691BD4 /* CounterNode.h */,
0F53FB81213B1BB800C40D34 /* CSSFilter.cpp */,
0F53FB83213B1BB800C40D34 /* CSSFilter.h */,
+ E3BBC2452383551A006EC39F /* CSSValueKey.h */,
A8CFF6CA0A1561CD000A4234 /* EllipsisBox.cpp */,
A8CFF6BD0A156118000A4234 /* EllipsisBox.h */,
E4A8D21522578DA000A8463C /* EventRegion.cpp */,
@@ -29570,6 +29573,7 @@
DD7CDF250A23CF9800069928 /* CSSUnknownRule.h in Headers */,
BC7D8FF01BD03B6400FFE540 /* CSSUnsetValue.h in Headers */,
A80E6CEE0A1989CA007FB8C5 /* CSSValue.h in Headers */,
+ E3BBC24723835526006EC39F /* CSSValueKey.h in Headers */,
6565815109D13043000E61D7 /* CSSValueKeywords.h in Headers */,
A80E6CE90A1989CA007FB8C5 /* CSSValueList.h in Headers */,
E49BD9FA131FD2ED003C56F0 /* CSSValuePool.h in Headers */,
Modified: trunk/Source/WebCore/css/StyleColor.h (254372 => 254373)
--- trunk/Source/WebCore/css/StyleColor.h 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/Source/WebCore/css/StyleColor.h 2020-01-10 23:39:54 UTC (rev 254373)
@@ -60,7 +60,7 @@
static Color colorFromKeyword(CSSValueID, OptionSet<Options>);
static bool isColorKeyword(CSSValueID);
- static bool isSystemColor(CSSValueID);
+ WEBCORE_EXPORT static bool isSystemColor(CSSValueID);
private:
Color m_color;
Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.h (254372 => 254373)
--- trunk/Source/WebCore/css/parser/CSSPropertyParser.h 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.h 2020-01-10 23:39:54 UTC (rev 254373)
@@ -122,7 +122,7 @@
};
CSSPropertyID cssPropertyID(StringView);
-CSSValueID cssValueKeywordID(StringView);
+WEBCORE_EXPORT CSSValueID cssValueKeywordID(StringView);
bool isCustomPropertyName(const String&);
#if PLATFORM(IOS_FAMILY)
Added: trunk/Source/WebCore/rendering/CSSValueKey.h (0 => 254373)
--- trunk/Source/WebCore/rendering/CSSValueKey.h (rev 0)
+++ trunk/Source/WebCore/rendering/CSSValueKey.h 2020-01-10 23:39:54 UTC (rev 254373)
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2020 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
+
+#include "CSSValueKeywords.h"
+
+namespace WebCore {
+
+struct CSSValueKey {
+
+ unsigned hash() const;
+
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<CSSValueKey> decode(Decoder&);
+
+ unsigned cssValueID;
+ bool useDarkAppearance;
+ bool useElevatedUserInterfaceLevel;
+};
+
+inline bool operator==(const CSSValueKey& a, const CSSValueKey& b)
+{
+ return a.cssValueID == b.cssValueID && a.useDarkAppearance == b.useDarkAppearance && a.useElevatedUserInterfaceLevel == b.useElevatedUserInterfaceLevel;
+}
+
+template<class Encoder>
+void CSSValueKey::encode(Encoder& encoder) const
+{
+ encoder << cssValueID;
+ encoder << useDarkAppearance;
+ encoder << useElevatedUserInterfaceLevel;
+}
+
+template<class Decoder>
+Optional<CSSValueKey> CSSValueKey::decode(Decoder& decoder)
+{
+ Optional<unsigned> cssValueID;
+ decoder >> cssValueID;
+ if (!cssValueID)
+ return WTF::nullopt;
+ Optional<bool> useDarkAppearance;
+ decoder >> useDarkAppearance;
+ if (!useDarkAppearance)
+ return WTF::nullopt;
+ Optional<bool> useElevatedUserInterfaceLevel;
+ decoder >> useElevatedUserInterfaceLevel;
+ if (!useElevatedUserInterfaceLevel)
+ return WTF::nullopt;
+ return { { WTFMove(*cssValueID), WTFMove(*useDarkAppearance), WTFMove(*useElevatedUserInterfaceLevel) } };
+}
+
+inline unsigned CSSValueKey::hash() const
+{
+ return cssValueID;
+}
+
+} // namespace WebCore
+
+namespace WTF {
+
+struct CSSValueKeyHash {
+ static unsigned hash(const WebCore::CSSValueKey& key) { return key.hash(); }
+ static bool equal(const WebCore::CSSValueKey& a, const WebCore::CSSValueKey& b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = true;
+};
+
+template<> struct HashTraits<WebCore::CSSValueKey> : GenericHashTraits<WebCore::CSSValueKey> {
+ static WebCore::CSSValueKey emptyValue() { return WebCore::CSSValueKey { WebCore::CSSValueInvalid, false, false}; }
+ static void constructDeletedValue(WebCore::CSSValueKey& slot) { slot = WebCore::CSSValueKey { WebCore::CSSValueInvalid, true, true};}
+ static bool isDeletedValue(const WebCore::CSSValueKey& slot) { return slot.cssValueID == WebCore::CSSValueInvalid && slot.useDarkAppearance && slot.useElevatedUserInterfaceLevel; }
+};
+
+template<> struct DefaultHash<WebCore::CSSValueKey> {
+ typedef CSSValueKeyHash Hash;
+};
+
+} // namespace WTF
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.h (254372 => 254373)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.h 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h 2020-01-10 23:39:54 UTC (rev 254373)
@@ -27,6 +27,7 @@
#if PLATFORM(IOS_FAMILY)
+#include "CSSValueKey.h"
#include "RenderThemeCocoa.h"
#if USE(SYSTEM_PREVIEW)
@@ -59,6 +60,11 @@
void paintSystemPreviewBadge(Image&, const PaintInfo&, const FloatRect&) override;
#endif
+ using CSSValueToSystemColorMap = HashMap<CSSValueKey, Color>;
+
+ WEBCORE_EXPORT static const CSSValueToSystemColorMap& cssValueToSystemColorMap();
+ WEBCORE_EXPORT static void setCSSValueToSystemColorMap(CSSValueToSystemColorMap&&);
+
protected:
LengthBox popupInternalPaddingBox(const RenderStyle&) const override;
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (254372 => 254373)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2020-01-10 23:39:54 UTC (rev 254373)
@@ -31,6 +31,7 @@
#import "BitmapImage.h"
#import "CSSPrimitiveValue.h"
#import "CSSToLengthConversionData.h"
+#import "CSSValueKey.h"
#import "CSSValueKeywords.h"
#import "ColorIOS.h"
#import "DateComponents.h"
@@ -1430,6 +1431,113 @@
#endif // ENABLE(VIDEO)
+struct CSSValueIDAndSelector {
+ CSSValueID cssValueID;
+ SEL selector;
+};
+
+static const Vector<CSSValueIDAndSelector>& cssValueIDSelectorList()
+{
+ static NeverDestroyed<Vector<CSSValueIDAndSelector>> cssValueIDSelectorList;
+
+ static std::once_flag initializeOnce;
+ std::call_once(
+ initializeOnce,
+ [] {
+ cssValueIDSelectorList.get() = Vector(std::initializer_list<CSSValueIDAndSelector> {
+#if HAVE(OS_DARK_MODE_SUPPORT)
+ { CSSValueText, @selector(labelColor) },
+ { CSSValueAppleSystemLabel, @selector(labelColor) },
+ { CSSValueAppleSystemHeaderText, @selector(labelColor) },
+ { CSSValueAppleSystemSecondaryLabel, @selector(secondaryLabelColor) },
+ { CSSValueAppleSystemTertiaryLabel, @selector(tertiaryLabelColor) },
+ { CSSValueAppleSystemQuaternaryLabel, @selector(quaternaryLabelColor) },
+ { CSSValueAppleSystemPlaceholderText, @selector(placeholderTextColor) },
+ { CSSValueWebkitControlBackground, @selector(systemBackgroundColor) },
+ { CSSValueAppleSystemControlBackground, @selector(systemBackgroundColor) },
+ { CSSValueAppleSystemTextBackground, @selector(systemBackgroundColor) },
+ { CSSValueAppleSystemBackground, @selector(systemBackgroundColor) },
+ { CSSValueAppleSystemSecondaryBackground, @selector(secondarySystemBackgroundColor) },
+ { CSSValueAppleSystemTertiaryBackground, @selector(tertiarySystemBackgroundColor) },
+ { CSSValueAppleSystemGroupedBackground, @selector(systemGroupedBackgroundColor) },
+ { CSSValueAppleSystemSecondaryGroupedBackground, @selector(secondarySystemGroupedBackgroundColor) },
+ { CSSValueAppleSystemTertiaryGroupedBackground, @selector(tertiarySystemGroupedBackgroundColor) },
+ { CSSValueAppleSystemGrid, @selector(separatorColor) },
+ { CSSValueAppleSystemSeparator, @selector(separatorColor) },
+ { CSSValueAppleSystemContainerBorder, @selector(separatorColor) },
+ { CSSValueAppleSystemSelectedContentBackground, @selector(tableCellDefaultSelectionTintColor) },
+ { CSSValueAppleSystemUnemphasizedSelectedContentBackground, @selector(tableCellDefaultSelectionTintColor) },
+ { CSSValueAppleSystemBrown, @selector(systemBrownColor) },
+ { CSSValueAppleSystemIndigo, @selector(systemIndigoColor) },
+#endif
+ { CSSValueAppleSystemTeal, @selector(systemTealColor) },
+ { CSSValueAppleWirelessPlaybackTargetActive, @selector(systemBlueColor) },
+ { CSSValueAppleSystemBlue, @selector(systemBlueColor) },
+ { CSSValueAppleSystemGray, @selector(systemGrayColor) },
+ { CSSValueAppleSystemGreen, @selector(systemGreenColor) },
+ { CSSValueAppleSystemOrange, @selector(systemOrangeColor) },
+ { CSSValueAppleSystemPink, @selector(systemPinkColor) },
+ { CSSValueAppleSystemPurple, @selector(systemPurpleColor) },
+ { CSSValueAppleSystemRed, @selector(systemRedColor) },
+ { CSSValueAppleSystemYellow, @selector(systemYellowColor) }
+ });
+ });
+
+ return cssValueIDSelectorList;
+}
+
+static Optional<Color> systemColorFromCSSValueID(CSSValueID cssValueID, bool useDarkAppearance, bool useElevatedUserInterfaceLevel)
+{
+ LocalCurrentTraitCollection localTraitCollection(useDarkAppearance, useElevatedUserInterfaceLevel);
+
+ auto cssColorToSelector = [cssValueID] () -> SEL {
+ for (auto& cssValueIDSelector : cssValueIDSelectorList()) {
+ if (cssValueIDSelector.cssValueID == cssValueID)
+ return cssValueIDSelector.selector;
+ }
+ return nullptr;
+ };
+
+ if (auto selector = cssColorToSelector()) {
+ if (auto color = wtfObjCMsgSend<UIColor *>(PAL::getUIColorClass(), selector))
+ return Color(color.CGColor, Color::Semantic);
+ }
+ return WTF::nullopt;
+}
+
+
+static RenderThemeIOS::CSSValueToSystemColorMap& globalCSSValueToSystemColorMap()
+{
+ static NeverDestroyed<RenderThemeIOS::CSSValueToSystemColorMap> colorMap;
+ return colorMap;
+}
+
+const RenderThemeIOS::CSSValueToSystemColorMap& RenderThemeIOS::cssValueToSystemColorMap()
+{
+ static NeverDestroyed<CSSValueToSystemColorMap> map;
+
+ static std::once_flag onceFlag;
+ std::call_once(
+ onceFlag,
+ [] {
+ for (auto& cssValueIDSelector : cssValueIDSelectorList()) {
+ for (bool useDarkAppearance : { false, true }) {
+ for (bool useElevatedUserInterfaceLevel : { false, true }) {
+ if (auto color = systemColorFromCSSValueID(cssValueIDSelector.cssValueID, useDarkAppearance, useElevatedUserInterfaceLevel))
+ map.get().add(CSSValueKey { cssValueIDSelector.cssValueID, useDarkAppearance, useElevatedUserInterfaceLevel }, *color);
+ }
+ }
+ }
+ });
+
+ return map;
+}
+
+void RenderThemeIOS::setCSSValueToSystemColorMap(CSSValueToSystemColorMap&& colorMap)
+{
+ globalCSSValueToSystemColorMap() = WTFMove(colorMap);
+}
+
Color RenderThemeIOS::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::Options> options) const
{
const bool forVisitedLink = options.contains(StyleColor::Options::ForVisitedLink);
@@ -1446,79 +1554,15 @@
return cache.systemStyleColors.ensure(cssValueID, [this, cssValueID, options] () -> Color {
const bool useDarkAppearance = options.contains(StyleColor::Options::UseDarkAppearance);
const bool useElevatedUserInterfaceLevel = options.contains(StyleColor::Options::UseElevatedUserInterfaceLevel);
- LocalCurrentTraitCollection localTraitCollection(useDarkAppearance, useElevatedUserInterfaceLevel);
-
- auto cssColorToSelector = [cssValueID] () -> SEL {
- switch (cssValueID) {
-#if HAVE(OS_DARK_MODE_SUPPORT)
- case CSSValueText:
- case CSSValueAppleSystemLabel:
- case CSSValueAppleSystemHeaderText:
- return @selector(labelColor);
- case CSSValueAppleSystemSecondaryLabel:
- return @selector(secondaryLabelColor);
- case CSSValueAppleSystemTertiaryLabel:
- return @selector(tertiaryLabelColor);
- case CSSValueAppleSystemQuaternaryLabel:
- return @selector(quaternaryLabelColor);
- case CSSValueAppleSystemPlaceholderText:
- return @selector(placeholderTextColor);
- case CSSValueWebkitControlBackground:
- case CSSValueAppleSystemControlBackground:
- case CSSValueAppleSystemTextBackground:
- case CSSValueAppleSystemBackground:
- return @selector(systemBackgroundColor);
- case CSSValueAppleSystemSecondaryBackground:
- return @selector(secondarySystemBackgroundColor);
- case CSSValueAppleSystemTertiaryBackground:
- return @selector(tertiarySystemBackgroundColor);
- case CSSValueAppleSystemGroupedBackground:
- return @selector(systemGroupedBackgroundColor);
- case CSSValueAppleSystemSecondaryGroupedBackground:
- return @selector(secondarySystemGroupedBackgroundColor);
- case CSSValueAppleSystemTertiaryGroupedBackground:
- return @selector(tertiarySystemGroupedBackgroundColor);
- case CSSValueAppleSystemGrid:
- case CSSValueAppleSystemSeparator:
- case CSSValueAppleSystemContainerBorder:
- return @selector(separatorColor);
- case CSSValueAppleSystemSelectedContentBackground:
- case CSSValueAppleSystemUnemphasizedSelectedContentBackground:
- return @selector(tableCellDefaultSelectionTintColor);
- case CSSValueAppleSystemBrown:
- return @selector(systemBrownColor);
- case CSSValueAppleSystemIndigo:
- return @selector(systemIndigoColor);
-#endif
- case CSSValueAppleSystemTeal:
- return @selector(systemTealColor);
- case CSSValueAppleWirelessPlaybackTargetActive:
- case CSSValueAppleSystemBlue:
- return @selector(systemBlueColor);
- case CSSValueAppleSystemGray:
- return @selector(systemGrayColor);
- case CSSValueAppleSystemGreen:
- return @selector(systemGreenColor);
- case CSSValueAppleSystemOrange:
- return @selector(systemOrangeColor);
- case CSSValueAppleSystemPink:
- return @selector(systemPinkColor);
- case CSSValueAppleSystemPurple:
- return @selector(systemPurpleColor);
- case CSSValueAppleSystemRed:
- return @selector(systemRedColor);
- case CSSValueAppleSystemYellow:
- return @selector(systemYellowColor);
- default:
- return nullptr;
- }
- };
-
- if (auto selector = cssColorToSelector()) {
- if (auto color = wtfObjCMsgSend<UIColor *>(PAL::getUIColorClass(), selector))
- return Color(color.CGColor, Color::Semantic);
+ if (!globalCSSValueToSystemColorMap().isEmpty()) {
+ auto it = globalCSSValueToSystemColorMap().find(CSSValueKey { cssValueID, useDarkAppearance, useElevatedUserInterfaceLevel });
+ if (it == globalCSSValueToSystemColorMap().end())
+ return RenderTheme::systemColor(cssValueID, options);
+ return Color(it->value.rgb(), Color::Semantic);
}
-
+ auto color = systemColorFromCSSValueID(cssValueID, useDarkAppearance, useElevatedUserInterfaceLevel);
+ if (color)
+ return *color;
return RenderTheme::systemColor(cssValueID, options);
}).iterator->value;
}
Modified: trunk/Source/WebCore/testing/Internals.cpp (254372 => 254373)
--- trunk/Source/WebCore/testing/Internals.cpp 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/Source/WebCore/testing/Internals.cpp 2020-01-10 23:39:54 UTC (rev 254373)
@@ -39,6 +39,7 @@
#include "CSSAnimationController.h"
#include "CSSKeyframesRule.h"
#include "CSSMediaRule.h"
+#include "CSSPropertyParser.h"
#include "CSSStyleRule.h"
#include "CSSSupportsRule.h"
#include "CacheStorageConnection.h"
@@ -149,6 +150,7 @@
#include "RenderLayerBacking.h"
#include "RenderLayerCompositor.h"
#include "RenderMenuList.h"
+#include "RenderTheme.h"
#include "RenderTreeAsText.h"
#include "RenderView.h"
#include "RenderedDocumentMarker.h"
@@ -5419,4 +5421,18 @@
return window.location().host();
}
+String Internals::systemColorForCSSValue(const String& cssValue, bool useDarkModeAppearance, bool useElevatedUserInterfaceLevel)
+{
+ CSSValueID id = cssValueKeywordID(cssValue);
+ RELEASE_ASSERT(StyleColor::isSystemColor(id));
+
+ OptionSet<StyleColor::Options> options;
+ if (useDarkModeAppearance)
+ options.add(StyleColor::Options::UseDarkAppearance);
+ if (useElevatedUserInterfaceLevel)
+ options.add(StyleColor::Options::UseElevatedUserInterfaceLevel);
+
+ return RenderTheme::singleton().systemColor(id, options).cssText();
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/testing/Internals.h (254372 => 254373)
--- trunk/Source/WebCore/testing/Internals.h 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/Source/WebCore/testing/Internals.h 2020-01-10 23:39:54 UTC (rev 254373)
@@ -924,6 +924,8 @@
String windowLocationHost(DOMWindow&);
+ String systemColorForCSSValue(const String& cssValue, bool useDarkModeAppearance, bool useElevatedUserInterfaceLevel);
+
private:
explicit Internals(Document&);
Document* contextDocument() const;
Modified: trunk/Source/WebCore/testing/Internals.idl (254372 => 254373)
--- trunk/Source/WebCore/testing/Internals.idl 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/Source/WebCore/testing/Internals.idl 2020-01-10 23:39:54 UTC (rev 254373)
@@ -831,4 +831,6 @@
boolean hasSandboxMachLookupAccessToGlobalName(DOMString process, DOMString service);
boolean hasSandboxMachLookupAccessToXPCServiceName(DOMString process, DOMString service);
+
+ DOMString systemColorForCSSValue(DOMString cssValue, boolean useDarkModeAppearance, boolean useElevatedUserInterfaceLevel);
};
Modified: trunk/Source/WebKit/ChangeLog (254372 => 254373)
--- trunk/Source/WebKit/ChangeLog 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/Source/WebKit/ChangeLog 2020-01-10 23:39:54 UTC (rev 254373)
@@ -1,3 +1,22 @@
+2020-01-09 Per Arne Vollan <pvol...@apple.com>
+
+ Map CSS value ID to system color in the UI process
+ https://bugs.webkit.org/show_bug.cgi?id=204314
+
+ Reviewed by Dean Jackson.
+
+ Create mapping between CSS value IDs and system colors in the UI process and send to the WebContent process
+ on process startup.
+
+ * Shared/WebProcessCreationParameters.cpp:
+ (WebKit::WebProcessCreationParameters::encode const):
+ (WebKit::WebProcessCreationParameters::decode):
+ * Shared/WebProcessCreationParameters.h:
+ * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+ (WebKit::WebProcessPool::platformInitializeWebProcess):
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::WebProcess::platformInitializeWebProcess):
+
2020-01-10 Mark Lam <mark....@apple.com>
Gardening: simple build fix after r254119.
Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp (254372 => 254373)
--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp 2020-01-10 23:39:54 UTC (rev 254373)
@@ -170,6 +170,7 @@
#if PLATFORM(IOS_FAMILY)
encoder << currentUserInterfaceIdiomIsPad;
+ encoder << cssValueToSystemColorMap;
#endif
}
@@ -437,6 +438,12 @@
#if PLATFORM(IOS_FAMILY)
if (!decoder.decode(parameters.currentUserInterfaceIdiomIsPad))
return false;
+
+ Optional<WebCore::RenderThemeIOS::CSSValueToSystemColorMap> cssValueToSystemColorMap;
+ decoder >> cssValueToSystemColorMap;
+ if (!cssValueToSystemColorMap)
+ return false;
+ parameters.cssValueToSystemColorMap = WTFMove(*cssValueToSystemColorMap);
#endif
return true;
Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.h (254372 => 254373)
--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.h 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.h 2020-01-10 23:39:54 UTC (rev 254373)
@@ -51,6 +51,10 @@
#include <WebCore/SoupNetworkProxySettings.h>
#endif
+#if PLATFORM(IOS_FAMILY)
+#include <WebCore/RenderThemeIOS.h>
+#endif
+
namespace API {
class Data;
}
@@ -208,6 +212,7 @@
#if PLATFORM(IOS_FAMILY)
bool currentUserInterfaceIdiomIsPad { false };
+ WebCore::RenderThemeIOS::CSSValueToSystemColorMap cssValueToSystemColorMap;
#endif
};
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (254372 => 254373)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2020-01-10 23:39:54 UTC (rev 254373)
@@ -353,6 +353,7 @@
#if PLATFORM(IOS_FAMILY)
parameters.currentUserInterfaceIdiomIsPad = currentUserInterfaceIdiomIsPad();
+ parameters.cssValueToSystemColorMap = RenderThemeIOS::cssValueToSystemColorMap();
#endif
}
Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (254372 => 254373)
--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2020-01-10 23:29:41 UTC (rev 254372)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2020-01-10 23:39:54 UTC (rev 254373)
@@ -259,6 +259,10 @@
SandboxExtension::consumePermanently(*parameters.neSessionManagerExtensionHandle);
NetworkExtensionContentFilter::setHasConsumedSandboxExtensions(parameters.neHelperExtensionHandle.hasValue() && parameters.neSessionManagerExtensionHandle.hasValue());
#endif
+
+#if PLATFORM(IOS_FAMILY)
+ RenderThemeIOS::setCSSValueToSystemColorMap(WTFMove(parameters.cssValueToSystemColorMap));
+#endif
}
void WebProcess::platformSetWebsiteDataStoreParameters(WebProcessDataStoreParameters&& parameters)