Title: [253784] trunk/Source
Revision
253784
Author
pvol...@apple.com
Date
2019-12-19 13:20:33 -0800 (Thu, 19 Dec 2019)

Log Message

REGRESSION (r253530): Incorrect colors in Dark Mode
https://bugs.webkit.org/show_bug.cgi?id=205457

Unreviewed rollout of r253530.


Source/WebCore:

* WebCore.xcodeproj/project.pbxproj:
* rendering/CSSValueKey.h: Removed.
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::systemColor const):
(WebCore::cssValueIDSelectorList): Deleted.
(WebCore::systemColorFromCSSValueID): Deleted.
(WebCore::globalCSSValueToSystemColorMap): Deleted.
(WebCore::RenderThemeIOS::getOrCreateCSSValueToSystemColorMap): Deleted.
(WebCore::RenderThemeIOS::setCSSValueToSystemColorMap): Deleted.

Source/WebKit:

* 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):

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (253783 => 253784)


--- trunk/Source/WebCore/ChangeLog	2019-12-19 21:18:39 UTC (rev 253783)
+++ trunk/Source/WebCore/ChangeLog	2019-12-19 21:20:33 UTC (rev 253784)
@@ -1,3 +1,21 @@
+2019-12-19  Per Arne Vollan  <pvol...@apple.com>
+
+        REGRESSION (r253530): Incorrect colors in Dark Mode
+        https://bugs.webkit.org/show_bug.cgi?id=205457
+
+        Unreviewed rollout of r253530.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * rendering/CSSValueKey.h: Removed.
+        * rendering/RenderThemeIOS.h:
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderThemeIOS::systemColor const):
+        (WebCore::cssValueIDSelectorList): Deleted.
+        (WebCore::systemColorFromCSSValueID): Deleted.
+        (WebCore::globalCSSValueToSystemColorMap): Deleted.
+        (WebCore::RenderThemeIOS::getOrCreateCSSValueToSystemColorMap): Deleted.
+        (WebCore::RenderThemeIOS::setCSSValueToSystemColorMap): Deleted.
+
 2019-12-19  James Darpinian  <jdarpin...@chromium.org>
 
         ANGLE: Fix last WebGL conformance regressions

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (253783 => 253784)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-12-19 21:18:39 UTC (rev 253783)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-12-19 21:20:33 UTC (rev 253784)
@@ -4797,7 +4797,6 @@
 		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, ); }; };
@@ -15130,7 +15129,6 @@
 		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>"; };
@@ -27651,7 +27649,6 @@
 				9392F14B0AD1861B00691BD4 /* CounterNode.h */,
 				0F53FB81213B1BB800C40D34 /* CSSFilter.cpp */,
 				0F53FB83213B1BB800C40D34 /* CSSFilter.h */,
-				E3BBC2452383551A006EC39F /* CSSValueKey.h */,
 				A8CFF6CA0A1561CD000A4234 /* EllipsisBox.cpp */,
 				A8CFF6BD0A156118000A4234 /* EllipsisBox.h */,
 				E4A8D21522578DA000A8463C /* EventRegion.cpp */,
@@ -29533,7 +29530,6 @@
 				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 */,

Deleted: trunk/Source/WebCore/rendering/CSSValueKey.h (253783 => 253784)


--- trunk/Source/WebCore/rendering/CSSValueKey.h	2019-12-19 21:18:39 UTC (rev 253783)
+++ trunk/Source/WebCore/rendering/CSSValueKey.h	2019-12-19 21:20:33 UTC (rev 253784)
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2019 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 (253783 => 253784)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.h	2019-12-19 21:18:39 UTC (rev 253783)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h	2019-12-19 21:20:33 UTC (rev 253784)
@@ -27,7 +27,6 @@
 
 #if PLATFORM(IOS_FAMILY)
 
-#include "CSSValueKey.h"
 #include "RenderThemeCocoa.h"
 
 #if USE(SYSTEM_PREVIEW)
@@ -60,9 +59,6 @@
     void paintSystemPreviewBadge(Image&, const PaintInfo&, const FloatRect&) override;
 #endif
 
-    WEBCORE_EXPORT static const HashMap<CSSValueKey, Color>& getOrCreateCSSValueToSystemColorMap();
-    WEBCORE_EXPORT static void setCSSValueToSystemColorMap(HashMap<CSSValueKey, Color>&&);
-    
 protected:
     LengthBox popupInternalPaddingBox(const RenderStyle&) const override;
     

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (253783 => 253784)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2019-12-19 21:18:39 UTC (rev 253783)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2019-12-19 21:20:33 UTC (rev 253784)
@@ -31,7 +31,6 @@
 #import "BitmapImage.h"
 #import "CSSPrimitiveValue.h"
 #import "CSSToLengthConversionData.h"
-#import "CSSValueKey.h"
 #import "CSSValueKeywords.h"
 #import "ColorIOS.h"
 #import "DateComponents.h"
@@ -1431,113 +1430,6 @@
 
 #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 HashMap<CSSValueKey, Color>& globalCSSValueToSystemColorMap()
-{
-    static NeverDestroyed<HashMap<CSSValueKey, Color>> colorMap;
-    return colorMap;
-}
-
-const HashMap<CSSValueKey, Color>& RenderThemeIOS::getOrCreateCSSValueToSystemColorMap()
-{
-    static NeverDestroyed<HashMap<CSSValueKey, Color>> 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(HashMap<CSSValueKey, Color>&& colorMap)
-{
-    globalCSSValueToSystemColorMap() = WTFMove(colorMap);
-}
-
 Color RenderThemeIOS::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::Options> options) const
 {
     const bool forVisitedLink = options.contains(StyleColor::Options::ForVisitedLink);
@@ -1554,15 +1446,79 @@
     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);
-        if (!globalCSSValueToSystemColorMap().isEmpty()) {
-            auto it = globalCSSValueToSystemColorMap().find(CSSValueKey { cssValueID, useDarkAppearance, useElevatedUserInterfaceLevel });
-            if (it == globalCSSValueToSystemColorMap().end())
-                return RenderTheme::systemColor(cssValueID, options);
-            return it->value;
+        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);
         }
-        auto color = systemColorFromCSSValueID(cssValueID, useDarkAppearance, useElevatedUserInterfaceLevel);
-        if (color)
-            return *color;
+
         return RenderTheme::systemColor(cssValueID, options);
     }).iterator->value;
 }

Modified: trunk/Source/WebKit/ChangeLog (253783 => 253784)


--- trunk/Source/WebKit/ChangeLog	2019-12-19 21:18:39 UTC (rev 253783)
+++ trunk/Source/WebKit/ChangeLog	2019-12-19 21:20:33 UTC (rev 253784)
@@ -1,3 +1,19 @@
+2019-12-19  Per Arne Vollan  <pvol...@apple.com>
+
+        REGRESSION (r253530): Incorrect colors in Dark Mode
+        https://bugs.webkit.org/show_bug.cgi?id=205457
+
+        Unreviewed rollout of r253530.
+
+        * 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):
+
 2019-12-19  Alex Christensen  <achristen...@webkit.org>
 
         Deprecate _WKRemoteObjectInterface methods without ofReply:

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp (253783 => 253784)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2019-12-19 21:18:39 UTC (rev 253783)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2019-12-19 21:20:33 UTC (rev 253784)
@@ -171,10 +171,6 @@
     encoder << neSessionManagerExtensionHandle;
 #endif
 
-#if PLATFORM(IOS)
-    encoder << cssValueToSystemColorMap;
-#endif
-
 #if PLATFORM(IOS_FAMILY)
     encoder << currentUserInterfaceIdiomIsPad;
 #endif
@@ -444,14 +440,6 @@
     parameters.neSessionManagerExtensionHandle = WTFMove(*neSessionManagerExtensionHandle);
 #endif
 
-#if PLATFORM(IOS)
-    Optional<HashMap<WebCore::CSSValueKey, WebCore::Color>> cssValueToSystemColorMap;
-    decoder >> cssValueToSystemColorMap;
-    if (!cssValueToSystemColorMap)
-        return false;
-    parameters.cssValueToSystemColorMap = WTFMove(*cssValueToSystemColorMap);
-#endif
-
 #if PLATFORM(IOS_FAMILY)
     if (!decoder.decode(parameters.currentUserInterfaceIdiomIsPad))
         return false;

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.h (253783 => 253784)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2019-12-19 21:18:39 UTC (rev 253783)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2019-12-19 21:20:33 UTC (rev 253784)
@@ -51,10 +51,6 @@
 #include <WebCore/SoupNetworkProxySettings.h>
 #endif
 
-#if PLATFORM(IOS)
-#include <WebCore/RenderThemeIOS.h>
-#endif
-
 namespace API {
 class Data;
 }
@@ -213,10 +209,6 @@
     Optional<SandboxExtension::Handle> neSessionManagerExtensionHandle;
 #endif
 
-#if PLATFORM(IOS)
-    HashMap<WebCore::CSSValueKey, WebCore::Color> cssValueToSystemColorMap;
-#endif
-
 #if PLATFORM(IOS_FAMILY)
     bool currentUserInterfaceIdiomIsPad { false };
 #endif

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (253783 => 253784)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2019-12-19 21:18:39 UTC (rev 253783)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2019-12-19 21:20:33 UTC (rev 253784)
@@ -339,10 +339,6 @@
     }
 #endif
     
-#if PLATFORM(IOS)
-    parameters.cssValueToSystemColorMap = RenderThemeIOS::getOrCreateCSSValueToSystemColorMap();
-#endif
-    
 #if PLATFORM(IOS_FAMILY)
     parameters.currentUserInterfaceIdiomIsPad = currentUserInterfaceIdiomIsPad();
 #endif

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (253783 => 253784)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2019-12-19 21:18:39 UTC (rev 253783)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2019-12-19 21:20:33 UTC (rev 253784)
@@ -251,10 +251,6 @@
         SandboxExtension::consumePermanently(*parameters.neSessionManagerExtensionHandle);
     NetworkExtensionContentFilter::setHasConsumedSandboxExtensions(parameters.neHelperExtensionHandle.hasValue() && parameters.neSessionManagerExtensionHandle.hasValue());
 #endif
-
-#if PLATFORM(IOS)
-    RenderThemeIOS::setCSSValueToSystemColorMap(WTFMove(parameters.cssValueToSystemColorMap));
-#endif
 }
 
 void WebProcess::platformSetWebsiteDataStoreParameters(WebProcessDataStoreParameters&& parameters)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to