Title: [276307] trunk
Revision
276307
Author
[email protected]
Date
2021-04-20 09:16:43 -0700 (Tue, 20 Apr 2021)

Log Message

REGRESSION (r275523): [iOS] Opaque system fill colors are incorrect in dark mode
https://bugs.webkit.org/show_bug.cgi?id=224800
<rdar://problem/76878335>

Reviewed by Darin Adler.

Source/WebCore:

r275523 updated form control backgrounds to use opaque variants of
system colors. This change was implemented by blending the system
colors over a white background. However, in dark mode, the colors
should be blended over a black background, to retain a dark appearance.

Updated an existing test to validate the colors in light and dark mode.

* rendering/RenderThemeIOS.mm:
(WebCore::systemColorFromCSSValueSystemColorInformation):

Added a useDarkAppearance parameter, so that the system color can be
blended over black when necessary.

(WebCore::systemColorFromCSSValueID):
(WebCore::RenderThemeIOS::cssValueToSystemColorMap const):

LayoutTests:

* fast/css/ios/system-color-for-css-value-expected.txt:
* fast/css/ios/system-color-for-css-value.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (276306 => 276307)


--- trunk/LayoutTests/ChangeLog	2021-04-20 15:47:23 UTC (rev 276306)
+++ trunk/LayoutTests/ChangeLog	2021-04-20 16:16:43 UTC (rev 276307)
@@ -1,3 +1,14 @@
+2021-04-20  Aditya Keerthi  <[email protected]>
+
+        REGRESSION (r275523): [iOS] Opaque system fill colors are incorrect in dark mode
+        https://bugs.webkit.org/show_bug.cgi?id=224800
+        <rdar://problem/76878335>
+
+        Reviewed by Darin Adler.
+
+        * fast/css/ios/system-color-for-css-value-expected.txt:
+        * fast/css/ios/system-color-for-css-value.html:
+
 2021-04-20  Manuel Rego Casasnovas  <[email protected]>
 
         [WPE] Update expectations for 2 :focus-visible tests

Modified: trunk/LayoutTests/fast/css/ios/system-color-for-css-value-expected.txt (276306 => 276307)


--- trunk/LayoutTests/fast/css/ios/system-color-for-css-value-expected.txt	2021-04-20 15:47:23 UTC (rev 276306)
+++ trunk/LayoutTests/fast/css/ios/system-color-for-css-value-expected.txt	2021-04-20 16:16:43 UTC (rev 276307)
@@ -35,6 +35,14 @@
 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 internals.systemColorForCSSValue('-apple-system-opaque-fill', true, false) is 'rgb(43, 43, 46)'
+PASS internals.systemColorForCSSValue('-apple-system-opaque-fill', false, false) is 'rgb(228, 228, 229)'
+PASS internals.systemColorForCSSValue('-apple-system-opaque-secondary-fill', true, false) is 'rgb(38, 38, 41)'
+PASS internals.systemColorForCSSValue('-apple-system-opaque-secondary-fill', false, false) is 'rgb(233, 233, 234)'
+PASS internals.systemColorForCSSValue('-apple-system-opaque-secondary-fill-disabled', true, false) is 'rgb(29, 29, 31)'
+PASS internals.systemColorForCSSValue('-apple-system-opaque-secondary-fill-disabled', false, false) is 'rgb(238, 238, 239)'
+PASS internals.systemColorForCSSValue('-apple-system-opaque-tertiary-fill', true, false) is 'rgb(28, 28, 30)'
+PASS internals.systemColorForCSSValue('-apple-system-opaque-tertiary-fill', false, false) is 'rgb(238, 238, 239)'
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/css/ios/system-color-for-css-value.html (276306 => 276307)


--- trunk/LayoutTests/fast/css/ios/system-color-for-css-value.html	2021-04-20 15:47:23 UTC (rev 276306)
+++ trunk/LayoutTests/fast/css/ios/system-color-for-css-value.html	2021-04-20 16:16:43 UTC (rev 276307)
@@ -40,6 +40,14 @@
     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)'");
+    shouldBe("internals.systemColorForCSSValue('-apple-system-opaque-fill', true, false)", "'rgb(43, 43, 46)'");
+    shouldBe("internals.systemColorForCSSValue('-apple-system-opaque-fill', false, false)", "'rgb(228, 228, 229)'");
+    shouldBe("internals.systemColorForCSSValue('-apple-system-opaque-secondary-fill', true, false)", "'rgb(38, 38, 41)'");
+    shouldBe("internals.systemColorForCSSValue('-apple-system-opaque-secondary-fill', false, false)", "'rgb(233, 233, 234)'");
+    shouldBe("internals.systemColorForCSSValue('-apple-system-opaque-secondary-fill-disabled', true, false)", "'rgb(29, 29, 31)'");
+    shouldBe("internals.systemColorForCSSValue('-apple-system-opaque-secondary-fill-disabled', false, false)", "'rgb(238, 238, 239)'");
+    shouldBe("internals.systemColorForCSSValue('-apple-system-opaque-tertiary-fill', true, false)", "'rgb(28, 28, 30)'");
+    shouldBe("internals.systemColorForCSSValue('-apple-system-opaque-tertiary-fill', false, false)", "'rgb(238, 238, 239)'");
 }
 
 </script>

Modified: trunk/Source/WebCore/ChangeLog (276306 => 276307)


--- trunk/Source/WebCore/ChangeLog	2021-04-20 15:47:23 UTC (rev 276306)
+++ trunk/Source/WebCore/ChangeLog	2021-04-20 16:16:43 UTC (rev 276307)
@@ -1,3 +1,27 @@
+2021-04-20  Aditya Keerthi  <[email protected]>
+
+        REGRESSION (r275523): [iOS] Opaque system fill colors are incorrect in dark mode
+        https://bugs.webkit.org/show_bug.cgi?id=224800
+        <rdar://problem/76878335>
+
+        Reviewed by Darin Adler.
+
+        r275523 updated form control backgrounds to use opaque variants of
+        system colors. This change was implemented by blending the system
+        colors over a white background. However, in dark mode, the colors
+        should be blended over a black background, to retain a dark appearance.
+
+        Updated an existing test to validate the colors in light and dark mode.
+
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::systemColorFromCSSValueSystemColorInformation):
+
+        Added a useDarkAppearance parameter, so that the system color can be
+        blended over black when necessary.
+
+        (WebCore::systemColorFromCSSValueID):
+        (WebCore::RenderThemeIOS::cssValueToSystemColorMap const):
+
 2021-04-20  Basuke Suzuki  <[email protected]>
 
         Remove UNUSED warnings based on the configuration.

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (276306 => 276307)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2021-04-20 15:47:23 UTC (rev 276306)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2021-04-20 16:16:43 UTC (rev 276307)
@@ -1270,7 +1270,7 @@
 struct CSSValueSystemColorInformation {
     CSSValueID cssValueID;
     SEL selector;
-    bool blendOverWhite { false };
+    bool makeOpaque { false };
     float opacity { 1.0f };
 };
 
@@ -1328,7 +1328,7 @@
     return cssValueSystemColorInformationList;
 }
 
-static inline Optional<Color> systemColorFromCSSValueSystemColorInformation(CSSValueSystemColorInformation systemColorInformation)
+static inline Optional<Color> systemColorFromCSSValueSystemColorInformation(CSSValueSystemColorInformation systemColorInformation, bool useDarkAppearance)
 {
     if (auto color = wtfObjCMsgSend<UIColor *>(PAL::getUIColorClass(), systemColorInformation.selector)) {
         Color systemColor = { color.CGColor, Color::Flags::Semantic };
@@ -1336,8 +1336,8 @@
         if (systemColorInformation.opacity < 1.0f)
             systemColor = systemColor.colorWithAlphaMultipliedBy(systemColorInformation.opacity);
 
-        if (systemColorInformation.blendOverWhite)
-            return blendSourceOver(Color::white, systemColor);
+        if (systemColorInformation.makeOpaque)
+            return blendSourceOver(useDarkAppearance ? Color::black : Color::white, systemColor);
 
         return systemColor;
     }
@@ -1351,7 +1351,7 @@
 
     for (auto& cssValueSystemColorInformation : cssValueSystemColorInformationList()) {
         if (cssValueSystemColorInformation.cssValueID == cssValueID)
-            return systemColorFromCSSValueSystemColorInformation(cssValueSystemColorInformation);
+            return systemColorFromCSSValueSystemColorInformation(cssValueSystemColorInformation, useDarkAppearance);
     }
 
     return WTF::nullopt;
@@ -1372,7 +1372,7 @@
             for (bool useElevatedUserInterfaceLevel : { false, true }) {
                 LocalCurrentTraitCollection localTraitCollection(useDarkAppearance, useElevatedUserInterfaceLevel);
                 for (auto& cssValueSystemColorInformation : cssValueSystemColorInformationList()) {
-                    if (auto color = systemColorFromCSSValueSystemColorInformation(cssValueSystemColorInformation))
+                    if (auto color = systemColorFromCSSValueSystemColorInformation(cssValueSystemColorInformation, useDarkAppearance))
                         map.add(CSSValueKey { cssValueSystemColorInformation.cssValueID, useDarkAppearance, useElevatedUserInterfaceLevel }, WTFMove(*color));
                 }
             }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to