Bug 531078 - Use MacOS system color for selected text background in inactive windows. r=mstange.
authorstefanh@inbox.com
Tue, 15 Nov 2016 20:38:22 +0100
changeset 324109 befc69f2cf27cd12cbbc053c53ae1f1e78e634b9
parent 324108 d29ab4cddb8299285f431ff521c64712f25ad33e
child 324110 aed16e234d2ebf3372564600ff8cd5f3c7a83f3c
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersmstange
bugs531078
milestone53.0a1
Bug 531078 - Use MacOS system color for selected text background in inactive windows. r=mstange.
widget/cocoa/nsLookAndFeel.mm
widget/nsXPLookAndFeel.cpp
--- a/widget/cocoa/nsLookAndFeel.mm
+++ b/widget/cocoa/nsLookAndFeel.mm
@@ -97,16 +97,21 @@ nsLookAndFeel::NativeGetColor(ColorID aI
       aColor = NS_RGB(0xff,0xff,0xff);
       break;
     case eColorID_TextForeground:
       aColor = NS_RGB(0x00,0x00,0x00);
       break;
     case eColorID_TextSelectBackground:
       aColor = GetColorFromNSColor([NSColor selectedTextBackgroundColor]);
       break;
+    // This is used to gray out the selection when it's not focused. Used with
+    // nsISelectionController::SELECTION_DISABLED.
+    case eColorID_TextSelectBackgroundDisabled:
+      aColor = GetColorFromNSColor([NSColor secondarySelectedControlColor]);
+      break;
     case eColorID_highlight: // CSS2 color
       aColor = GetColorFromNSColor([NSColor alternateSelectedControlColor]);
       break;
     case eColorID__moz_menuhover:
       aColor = GetColorFromNSColor([NSColor alternateSelectedControlColor]);
       break;      
     case eColorID_TextSelectForeground:
       GetColor(eColorID_TextSelectBackground, aColor);
--- a/widget/nsXPLookAndFeel.cpp
+++ b/widget/nsXPLookAndFeel.cpp
@@ -764,22 +764,24 @@ nsXPLookAndFeel::GetColorImpl(ColorID aI
   }
 
   if (!aUseStandinsForNativeColors && IS_COLOR_CACHED(aID)) {
     aResult = sCachedColors[aID];
     return NS_OK;
   }
 
   // There are no system color settings for these, so set them manually
+#ifndef XP_MACOSX
   if (aID == eColorID_TextSelectBackgroundDisabled) {
     // This is used to gray out the selection when it's not focused
     // Used with nsISelectionController::SELECTION_DISABLED
     aResult = NS_RGB(0xb0, 0xb0, 0xb0);
     return NS_OK;
   }
+#endif
 
   if (aID == eColorID_TextSelectBackgroundAttention) {
     if (sFindbarModalHighlight) {
       aResult = NS_RGBA(0, 0, 0, 0);
       return NS_OK;
     }
 
     // This makes the selection stand out when typeaheadfind is on