From 910e575ee4d90f16dcdeaac02b37d0ad689dc9c8 Mon Sep 17 00:00:00 2001 From: "joshmoz%gmail.com" Date: Mon, 12 Jun 2006 19:33:07 +0000 Subject: [PATCH] selection highlight color changed in 0.5+ to no longer use system selection color. b=240320 r=josh sr=roc git-svn-id: svn://10.0.0.236/trunk@199742 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/style/nsCSSKeywordList.h | 2 ++ mozilla/layout/style/nsCSSProps.cpp | 2 ++ mozilla/widget/public/nsILookAndFeel.h | 4 ++++ mozilla/widget/src/mac/nsLookAndFeel.cpp | 16 ++++++++++++++++ 4 files changed, 24 insertions(+) diff --git a/mozilla/layout/style/nsCSSKeywordList.h b/mozilla/layout/style/nsCSSKeywordList.h index a54afb29fd2..ca88212ea84 100644 --- a/mozilla/layout/style/nsCSSKeywordList.h +++ b/mozilla/layout/style/nsCSSKeywordList.h @@ -138,10 +138,12 @@ CSS_KEY(-moz-mac-accentlightesthighlight, _moz_mac_accentlightesthighlight) CSS_KEY(-moz-mac-accentlightshadow, _moz_mac_accentlightshadow) CSS_KEY(-moz-mac-accentregularhighlight, _moz_mac_accentregularhighlight) CSS_KEY(-moz-mac-accentregularshadow, _moz_mac_accentregularshadow) +CSS_KEY(-moz-mac-alternateprimaryhighlight, _moz_mac_alternateprimaryhighlight) CSS_KEY(-moz-mac-focusring, _moz_mac_focusring) CSS_KEY(-moz-mac-menuselect, _moz_mac_menuselect) CSS_KEY(-moz-mac-menushadow, _moz_mac_menushadow) CSS_KEY(-moz-mac-menutextselect, _moz_mac_menutextselect) +CSS_KEY(-moz-mac-secondaryhighlight, _moz_mac_secondaryhighlight) CSS_KEY(-moz-malayalam, _moz_malayalam) CSS_KEY(-moz-marker, _moz_marker) // Disabled because not supported correctly. CSS_KEY(-moz-menuhover, _moz_menuhover) diff --git a/mozilla/layout/style/nsCSSProps.cpp b/mozilla/layout/style/nsCSSProps.cpp index 1f3f413dbd6..9626ae6a632 100644 --- a/mozilla/layout/style/nsCSSProps.cpp +++ b/mozilla/layout/style/nsCSSProps.cpp @@ -442,6 +442,8 @@ const PRInt32 nsCSSProps::kColorKTable[] = { eCSSKeyword__moz_mac_accentregularshadow, nsILookAndFeel::eColor__moz_mac_accentregularshadow, eCSSKeyword__moz_mac_accentdarkshadow, nsILookAndFeel::eColor__moz_mac_accentdarkshadow, eCSSKeyword__moz_mac_accentdarkestshadow, nsILookAndFeel::eColor__moz_mac_accentdarkestshadow, + eCSSKeyword__moz_mac_alternateprimaryhighlight, nsILookAndFeel::eColor__moz_mac_alternateprimaryhighlight, + eCSSKeyword__moz_mac_secondaryhighlight, nsILookAndFeel::eColor__moz_mac_secondaryhighlight, eCSSKeyword__moz_menuhover, nsILookAndFeel::eColor__moz_menuhover, eCSSKeyword__moz_menuhovertext, nsILookAndFeel::eColor__moz_menuhovertext, eCSSKeyword__moz_menubarhovertext, nsILookAndFeel::eColor__moz_menubarhovertext, diff --git a/mozilla/widget/public/nsILookAndFeel.h b/mozilla/widget/public/nsILookAndFeel.h index e6db06c263c..3f1a921f5ff 100644 --- a/mozilla/widget/public/nsILookAndFeel.h +++ b/mozilla/widget/public/nsILookAndFeel.h @@ -149,6 +149,10 @@ public: eColor__moz_mac_accentregularshadow, eColor__moz_mac_accentdarkshadow, eColor__moz_mac_accentdarkestshadow, + + //new in 10.2 + eColor__moz_mac_alternateprimaryhighlight, //active list highlight + eColor__moz_mac_secondaryhighlight, //inactive light hightlight // keep this one last, please eColor_LAST_COLOR diff --git a/mozilla/widget/src/mac/nsLookAndFeel.cpp b/mozilla/widget/src/mac/nsLookAndFeel.cpp index 61258fa8d76..2464f67ff9f 100644 --- a/mozilla/widget/src/mac/nsLookAndFeel.cpp +++ b/mozilla/widget/src/mac/nsLookAndFeel.cpp @@ -42,6 +42,11 @@ #include #include +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3 +// This theme brush is available in 10.2 and later, but was not +// formally documented in the SDK until 10.3. +#define kThemeBrushAlternatePrimaryHighlightColor -5 +#endif //------------------------------------------------------------------------- // @@ -354,6 +359,17 @@ nsresult nsLookAndFeel::NativeGetColor(const nsColorID aID, nscolor &aColor) case eColor__moz_buttondefault: res = GetMacBrushColor(kThemeBrushButtonActiveDarkShadow, aColor, NS_RGB(0x77,0x77,0x77)); break; + case eColor__moz_mac_alternateprimaryhighlight: + // For proper styling of lists when active, on 10.2+ + // On older OSs may have to fall back to primary highlight color + nscolor fallbackColor; + GetMacBrushColor(kThemeBrushPrimaryHighlightColor, fallbackColor, NS_RGB(0x00,0x00,0x00)); + res = GetMacBrushColor(kThemeBrushAlternatePrimaryHighlightColor, aColor, fallbackColor); + break; + case eColor__moz_mac_secondaryhighlight: + // For inactive list selection + res = GetMacBrushColor(kThemeBrushSecondaryHighlightColor, aColor, NS_RGB(0x00,0x00,0x00)); + break; default: NS_WARNING("Someone asked nsILookAndFeel for a color I don't know about"); aColor = NS_RGB(0xff,0xff,0xff);