From b8dab54f0341d6ac829c58ca3e7962415fc74774 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Wed, 17 Sep 2008 18:23:58 +0200 Subject: [PATCH] Bug 448767 - Add -moz-system-metric(mac-graphite-theme), r=vlad sr=dbaron --- layout/style/nsCSSRuleProcessor.cpp | 5 +++++ widget/public/nsILookAndFeel.h | 9 +++++++++ widget/src/beos/nsLookAndFeel.cpp | 4 ++++ widget/src/cocoa/nsLookAndFeel.mm | 4 ++++ widget/src/gtk2/nsLookAndFeel.cpp | 4 ++++ widget/src/os2/nsLookAndFeel.cpp | 4 ++++ widget/src/photon/nsLookAndFeel.cpp | 4 ++++ widget/src/windows/nsLookAndFeel.cpp | 4 ++++ 8 files changed, 38 insertions(+) diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index c9446fef3e7..8538e4b9e63 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -792,6 +792,11 @@ InitSystemMetrics() sSystemMetrics->AppendElement(do_GetAtom("windows-default-theme")); } + rv = lookAndFeel->GetMetric(nsILookAndFeel::eMetric_MacGraphiteTheme, metricResult); + if (NS_SUCCEEDED(rv) && metricResult) { + sSystemMetrics->AppendElement(do_GetAtom("mac-graphite-theme")); + } + rv = lookAndFeel->GetMetric(nsILookAndFeel::eMetric_DWMCompositor, metricResult); if (NS_SUCCEEDED(rv) && metricResult) { sSystemMetrics->AppendElement(do_GetAtom("windows-compositor")); diff --git a/widget/public/nsILookAndFeel.h b/widget/public/nsILookAndFeel.h index 5cdf77df092..7af2c8e8e4f 100644 --- a/widget/public/nsILookAndFeel.h +++ b/widget/public/nsILookAndFeel.h @@ -255,6 +255,15 @@ public: */ eMetric_WindowsClassic, + /* + * A Boolean value to determine whether the Mac graphite theme is + * being used. + * + * The value of this metric is not used on other platforms. These platforms + * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric. + */ + eMetric_MacGraphiteTheme, + /* * eMetric_AlertNotificationOrigin indicates from which corner of the * screen alerts slide in, and from which direction (horizontal/vertical). diff --git a/widget/src/beos/nsLookAndFeel.cpp b/widget/src/beos/nsLookAndFeel.cpp index fff49ca04e7..f1aba04ac46 100644 --- a/widget/src/beos/nsLookAndFeel.cpp +++ b/widget/src/beos/nsLookAndFeel.cpp @@ -427,6 +427,10 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) aMetric = 0; res = NS_ERROR_NOT_IMPLEMENTED; break; + case eMetric_MacGraphiteTheme: + aMetric = 0; + res = NS_ERROR_NOT_IMPLEMENTED; + break; case eMetric_IMERawInputUnderlineStyle: case eMetric_IMEConvertedTextUnderlineStyle: aMetric = NS_UNDERLINE_STYLE_SOLID; diff --git a/widget/src/cocoa/nsLookAndFeel.mm b/widget/src/cocoa/nsLookAndFeel.mm index d384d6aed13..688f3c26d14 100644 --- a/widget/src/cocoa/nsLookAndFeel.mm +++ b/widget/src/cocoa/nsLookAndFeel.mm @@ -43,6 +43,7 @@ #include "nsNativeThemeColors.h" #import +#import nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel() { @@ -613,6 +614,9 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) aMetric = 0; res = NS_ERROR_NOT_IMPLEMENTED; break; + case eMetric_MacGraphiteTheme: + aMetric = [NSColor currentControlTint] == NSGraphiteControlTint; + break; case eMetric_TabFocusModel: { // we should probably cache this diff --git a/widget/src/gtk2/nsLookAndFeel.cpp b/widget/src/gtk2/nsLookAndFeel.cpp index 04b14d13fb5..ef642399bd5 100644 --- a/widget/src/gtk2/nsLookAndFeel.cpp +++ b/widget/src/gtk2/nsLookAndFeel.cpp @@ -560,6 +560,10 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) aMetric = 0; res = NS_ERROR_NOT_IMPLEMENTED; break; + case eMetric_MacGraphiteTheme: + aMetric = 0; + res = NS_ERROR_NOT_IMPLEMENTED; + break; case eMetric_IMERawInputUnderlineStyle: case eMetric_IMEConvertedTextUnderlineStyle: aMetric = NS_UNDERLINE_STYLE_SOLID; diff --git a/widget/src/os2/nsLookAndFeel.cpp b/widget/src/os2/nsLookAndFeel.cpp index f3fcb7410dc..ef5a8143e4d 100644 --- a/widget/src/os2/nsLookAndFeel.cpp +++ b/widget/src/os2/nsLookAndFeel.cpp @@ -375,6 +375,10 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) aMetric = 0; res = NS_ERROR_NOT_IMPLEMENTED; break; + case eMetric_MacGraphiteTheme: + aMetric = 0; + res = NS_ERROR_NOT_IMPLEMENTED; + break; case eMetric_IMERawInputUnderlineStyle: case eMetric_IMEConvertedTextUnderlineStyle: aMetric = NS_UNDERLINE_STYLE_SOLID; diff --git a/widget/src/photon/nsLookAndFeel.cpp b/widget/src/photon/nsLookAndFeel.cpp index 61ababf3e1a..6d22a0a461d 100644 --- a/widget/src/photon/nsLookAndFeel.cpp +++ b/widget/src/photon/nsLookAndFeel.cpp @@ -369,6 +369,10 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) aMetric = 0; res = NS_ERROR_NOT_IMPLEMENTED; break; + case eMetric_MacGraphiteTheme: + aMetric = 0; + res = NS_ERROR_NOT_IMPLEMENTED; + break; case eMetric_IMERawInputUnderlineStyle: case eMetric_IMEConvertedTextUnderlineStyle: aMetric = NS_UNDERLINE_STYLE_SOLID; diff --git a/widget/src/windows/nsLookAndFeel.cpp b/widget/src/windows/nsLookAndFeel.cpp index 35dc7ddaaee..5e77caeab60 100644 --- a/widget/src/windows/nsLookAndFeel.cpp +++ b/widget/src/windows/nsLookAndFeel.cpp @@ -522,6 +522,10 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) res = NS_ERROR_NOT_IMPLEMENTED; } break; + case eMetric_MacGraphiteTheme: + aMetric = 0; + res = NS_ERROR_NOT_IMPLEMENTED; + break; #ifndef WINCE case eMetric_DWMCompositor: aMetric = nsUXThemeData::sHaveCompositor;