From 4d7b2dacaf5bd299473e4193b360c5aa6f8eb5b0 Mon Sep 17 00:00:00 2001 From: "stefanh@inbox.com" Date: Tue, 15 Nov 2016 20:38:22 +0100 Subject: [PATCH] Bug 531078 - Use MacOS system color for selected text background in inactive windows. r=mstange. --- widget/cocoa/nsLookAndFeel.mm | 5 +++++ widget/nsXPLookAndFeel.cpp | 2 ++ 2 files changed, 7 insertions(+) diff --git a/widget/cocoa/nsLookAndFeel.mm b/widget/cocoa/nsLookAndFeel.mm index cbee90f5810c..792e34a48504 100644 --- a/widget/cocoa/nsLookAndFeel.mm +++ b/widget/cocoa/nsLookAndFeel.mm @@ -102,6 +102,11 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) 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; diff --git a/widget/nsXPLookAndFeel.cpp b/widget/nsXPLookAndFeel.cpp index 54c61982943f..15d8c46a0094 100644 --- a/widget/nsXPLookAndFeel.cpp +++ b/widget/nsXPLookAndFeel.cpp @@ -769,12 +769,14 @@ nsXPLookAndFeel::GetColorImpl(ColorID aID, bool aUseStandinsForNativeColors, } // 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) {