Expose more semantic system colors.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Jun 2018 19:16:59 +0000 (19:16 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Jun 2018 19:16:59 +0000 (19:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186609
rdar://problem/39287277

Reviewed by Tim Horton.

Source/WebCore:

Add the following semantic colors:
 -apple-system-control-accent
 -apple-system-even-alternating-content-background
 -apple-system-odd-alternating-content-background
 -apple-system-selected-content-background
 -apple-system-unemphasized-selected-content-background
 -apple-system-selected-text
 -apple-system-unemphasized-selected-text
 -apple-system-selected-text-background
 -apple-system-unemphasized-selected-text-background
 -apple-system-placeholder-text
 -apple-system-find-highlight-background
 -apple-system-separator

* css/CSSValueKeywords.in:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::systemColor const):

Source/WebCore/PAL:

* pal/spi/cocoa/NSColorSPI.h: Added findHighlightColor and placeholderTextColor.

LayoutTests:

* fast/css/apple-system-control-colors.html: Updated for new colors.
* fast/css/apple-system-control-colors-expected.txt: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232847 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/css/apple-system-control-colors-expected.txt
LayoutTests/fast/css/apple-system-control-colors.html
Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/spi/cocoa/NSColorSPI.h
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/rendering/RenderThemeMac.mm

index a7c30cd..c9b05fa 100644 (file)
@@ -1,3 +1,15 @@
+2018-06-14  Timothy Hatcher  <timothy@apple.com>
+
+        Expose more semantic system colors.
+
+        https://bugs.webkit.org/show_bug.cgi?id=186609
+        rdar://problem/39287277
+
+        Reviewed by Tim Horton.
+
+        * fast/css/apple-system-control-colors.html: Updated for new colors.
+        * fast/css/apple-system-control-colors-expected.txt: Ditto.
+
 2018-06-14  Miguel Gomez  <magomez@igalia.com>
 
         Unreviewed GTK+ gardening after r232834.
index 6ebee22..3bfcca2 100644 (file)
@@ -2,9 +2,21 @@
 -apple-system-text-background : rgb(255, 255, 255)
 -apple-system-control-background : rgb(255, 255, 255)
 -apple-system-alternate-selected-text : rgb(255, 255, 255)
+-apple-system-control-accent : rgb(0, 105, 217)
+-apple-system-even-alternating-content-background : rgb(255, 255, 255)
+-apple-system-odd-alternating-content-background : rgb(245, 245, 245)
+-apple-system-selected-content-background : rgb(0, 105, 217)
+-apple-system-unemphasized-selected-content-background : rgb(212, 212, 212)
+-apple-system-selected-text : rgb(0, 0, 0)
+-apple-system-unemphasized-selected-text : rgb(0, 0, 0)
+-apple-system-selected-text-background : rgb(181, 213, 255)
+-apple-system-unemphasized-selected-text-background : rgb(212, 212, 212)
+-apple-system-placeholder-text : rgba(0, 0, 0, 0.247059)
+-apple-system-find-highlight-background : rgb(255, 204, 0)
 -apple-system-label : rgba(0, 0, 0, 0.85098)
 -apple-system-secondary-label : rgba(0, 0, 0, 0.498039)
 -apple-system-tertiary-label : rgba(0, 0, 0, 0.247059)
 -apple-system-quaternary-label : rgba(0, 0, 0, 0.0980392)
 -apple-system-grid : rgb(204, 204, 204)
+-apple-system-separator : rgb(204, 204, 204)
 current-color with inherited -apple-system-label : rgba(0, 0, 0, 0.85098)
index 1a06fbe..8427965 100644 (file)
 <div><span class="swatch" style="background-color: -apple-system-text-background"></span>-apple-system-text-background</div>
 <div><span class="swatch" style="background-color: -apple-system-control-background"></span>-apple-system-control-background</div>
 <div><span class="swatch" style="background-color: -apple-system-alternate-selected-text"></span>-apple-system-alternate-selected-text</div>
+<div><span class="swatch" style="background-color: -apple-system-control-accent"></span>-apple-system-control-accent</div>
+<div><span class="swatch" style="background-color: -apple-system-even-alternating-content-background"></span>-apple-system-even-alternating-content-background</div>
+<div><span class="swatch" style="background-color: -apple-system-odd-alternating-content-background"></span>-apple-system-odd-alternating-content-background</div>
+<div><span class="swatch" style="background-color: -apple-system-selected-content-background"></span>-apple-system-selected-content-background</div>
+<div><span class="swatch" style="background-color: -apple-system-unemphasized-selected-content-background"></span>-apple-system-unemphasized-selected-content-background</div>
+<div><span class="swatch" style="background-color: -apple-system-selected-text"></span>-apple-system-selected-text</div>
+<div><span class="swatch" style="background-color: -apple-system-unemphasized-selected-text"></span>-apple-system-unemphasized-selected-text</div>
+<div><span class="swatch" style="background-color: -apple-system-selected-text-background"></span>-apple-system-selected-text-background</div>
+<div><span class="swatch" style="background-color: -apple-system-unemphasized-selected-text-background"></span>-apple-system-unemphasized-selected-text-background</div>
+<div><span class="swatch" style="background-color: -apple-system-placeholder-text"></span>-apple-system-placeholder-text</div>
+<div><span class="swatch" style="background-color: -apple-system-find-highlight-background"></span>-apple-system-find-highlight-background</div>
 <div><span class="swatch" style="background-color: -apple-system-label"></span>-apple-system-label</div>
 <div><span class="swatch" style="background-color: -apple-system-secondary-label"></span>-apple-system-secondary-label</div>
 <div><span class="swatch" style="background-color: -apple-system-tertiary-label"></span>-apple-system-tertiary-label</div>
 <div><span class="swatch" style="background-color: -apple-system-quaternary-label"></span>-apple-system-quaternary-label</div>
 <div><span class="swatch" style="background-color: -apple-system-grid"></span>-apple-system-grid</div>
+<div><span class="swatch" style="background-color: -apple-system-separator"></span>-apple-system-separator</div>
 <div style="color: -apple-system-label"><span class="swatch" style="background-color: currentcolor;"></span>current-color with inherited -apple-system-label</div>
index 65ac3e1..101bcfe 100644 (file)
@@ -1,3 +1,30 @@
+2018-06-14  Timothy Hatcher  <timothy@apple.com>
+
+        Expose more semantic system colors.
+
+        https://bugs.webkit.org/show_bug.cgi?id=186609
+        rdar://problem/39287277
+
+        Reviewed by Tim Horton.
+
+        Add the following semantic colors:
+         -apple-system-control-accent
+         -apple-system-even-alternating-content-background
+         -apple-system-odd-alternating-content-background
+         -apple-system-selected-content-background
+         -apple-system-unemphasized-selected-content-background
+         -apple-system-selected-text
+         -apple-system-unemphasized-selected-text
+         -apple-system-selected-text-background
+         -apple-system-unemphasized-selected-text-background
+         -apple-system-placeholder-text
+         -apple-system-find-highlight-background
+         -apple-system-separator
+
+        * css/CSSValueKeywords.in:
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::systemColor const):
+
 2018-06-14  Eric Carlson  <eric.carlson@apple.com>
 
         [iOS] WebAVPlayerController isPlayingOnSecondScreen should be declared read-write
index 362ad5c..fc3f81b 100644 (file)
@@ -1,3 +1,14 @@
+2018-06-14  Timothy Hatcher  <timothy@apple.com>
+
+        Expose more semantic system colors.
+
+        https://bugs.webkit.org/show_bug.cgi?id=186609
+        rdar://problem/39287277
+
+        Reviewed by Tim Horton.
+
+        * pal/spi/cocoa/NSColorSPI.h: Added findHighlightColor and placeholderTextColor.
+
 2018-06-09  Dan Bernstein  <mitz@apple.com>
 
         [Xcode] Clean up and modernize some build setting definitions
index c9719a8..b43a018 100644 (file)
@@ -42,6 +42,8 @@
 + (NSColor *)systemPurpleColor;
 + (NSColor *)systemGrayColor;
 + (NSColor *)linkColor;
++ (NSColor *)findHighlightColor;
++ (NSColor *)placeholderTextColor;
 @end
 
 #endif
index 69359fc..0ae57ff 100644 (file)
@@ -226,11 +226,23 @@ windowtext
 -apple-system-text-background
 -apple-system-control-background
 -apple-system-alternate-selected-text
+-apple-system-control-accent
+-apple-system-even-alternating-content-background
+-apple-system-odd-alternating-content-background
+-apple-system-selected-content-background
+-apple-system-unemphasized-selected-content-background
+-apple-system-selected-text
+-apple-system-unemphasized-selected-text
+-apple-system-selected-text-background
+-apple-system-unemphasized-selected-text-background
+-apple-system-placeholder-text
+-apple-system-find-highlight-background
 -apple-system-label
 -apple-system-secondary-label
 -apple-system-tertiary-label
 -apple-system-quaternary-label
 -apple-system-grid
+-apple-system-separator
 -apple-wireless-playback-target-active
 -apple-system-blue
 -apple-system-brown
index 8295887..a58d733 100644 (file)
@@ -574,6 +574,48 @@ Color RenderThemeMac::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::O
                 return @selector(controlBackgroundColor);
             case CSSValueAppleSystemAlternateSelectedText:
                 return @selector(alternateSelectedControlTextColor);
+            case CSSValueAppleSystemControlAccent:
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+                return @selector(controlAccentColor);
+#else
+                return @selector(alternateSelectedControlColor);
+#endif
+            case CSSValueAppleSystemSelectedContentBackground:
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+                return @selector(selectedContentBackgroundColor);
+#else
+                return @selector(alternateSelectedControlColor);
+#endif
+            case CSSValueAppleSystemUnemphasizedSelectedContentBackground:
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+                return @selector(unemphasizedSelectedContentBackgroundColor);
+#else
+                return @selector(secondarySelectedControlColor);
+#endif
+            case CSSValueAppleSystemSelectedText:
+                return @selector(selectedTextColor);
+            case CSSValueAppleSystemUnemphasizedSelectedText:
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+                return @selector(unemphasizedSelectedTextColor);
+#else
+                return @selector(textColor);
+#endif
+            case CSSValueAppleSystemSelectedTextBackground:
+                return @selector(selectedTextBackgroundColor);
+            case CSSValueAppleSystemUnemphasizedSelectedTextBackground:
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+                return @selector(unemphasizedSelectedTextBackgroundColor);
+#else
+                return @selector(secondarySelectedControlColor);
+#endif
+            case CSSValueAppleSystemPlaceholderText:
+                return @selector(placeholderTextColor);
+            case CSSValueAppleSystemFindHighlightBackground:
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
+                return @selector(findHighlightColor);
+#else
+                return @selector(systemYellowColor);
+#endif
             case CSSValueAppleSystemLabel:
                 return @selector(labelColor);
             case CSSValueAppleSystemSecondaryLabel:
@@ -584,6 +626,12 @@ Color RenderThemeMac::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::O
                 return @selector(quaternaryLabelColor);
             case CSSValueAppleSystemGrid:
                 return @selector(gridColor);
+            case CSSValueAppleSystemSeparator:
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+                return @selector(separatorColor);
+#else
+                return @selector(gridColor);
+#endif
             case CSSValueAppleWirelessPlaybackTargetActive:
                 return @selector(systemBlueColor);
             case CSSValueAppleSystemBlue:
@@ -618,19 +666,44 @@ Color RenderThemeMac::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::O
         case CSSValueActivebuttontext:
             // No corresponding NSColor for this so we use a hard coded value.
             return Color::white;
+
         case CSSValueButtonface:
         case CSSValueThreedface:
             // We selected this value instead of [NSColor controlColor] to avoid website incompatibilities.
             // We may want to consider changing to [NSColor controlColor] some day.
             return 0xFFC0C0C0;
+
         case CSSValueInfobackground:
             // No corresponding NSColor for this so we use a hard coded value.
             return 0xFFFBFCC5;
+
         case CSSValueMenu:
             return menuBackgroundColor();
+
+        case CSSValueAppleSystemEvenAlternatingContentBackground: {
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+            NSArray<NSColor *> *alternateColors = [NSColor alternatingContentBackgroundColors];
+#else
+            NSArray<NSColor *> *alternateColors = [NSColor controlAlternatingRowBackgroundColors];
+#endif
+            ASSERT(alternateColors.count >= 2);
+            return colorFromNSColor(alternateColors[0]);
+        }
+
+        case CSSValueAppleSystemOddAlternatingContentBackground: {
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+            NSArray<NSColor *> *alternateColors = [NSColor alternatingContentBackgroundColors];
+#else
+            NSArray<NSColor *> *alternateColors = [NSColor controlAlternatingRowBackgroundColors];
+#endif
+            ASSERT(alternateColors.count >= 2);
+            return colorFromNSColor(alternateColors[1]);
+        }
+
         case CSSValueBackground:
             // Use platform-independent value returned by base class.
             FALLTHROUGH;
+
         default:
             return RenderTheme::systemColor(cssValueID, options);
         }