mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1330876 - Add a new variant of LookAndFeel::GetColor that uses stand-ins for native colors and accepts default value. r=heycam
MozReview-Commit-ID: 40tmdTJbLy1 --HG-- extra : rebase_source : 391be7415abf32f77ee7371901fd0c7c3875b49e
This commit is contained in:
parent
0aaeee9340
commit
666911d06a
@ -517,14 +517,10 @@ nsPresContext::GetDocumentColorPreferences()
|
||||
if (sUseStandinsForNativeColors) {
|
||||
// Once the preference "ui.use_standins_for_native_colors" is enabled,
|
||||
// use fixed color values instead of prefered colors and system colors.
|
||||
if (NS_FAILED(LookAndFeel::GetColor(
|
||||
LookAndFeel::eColorID_windowtext, true, &mDefaultColor))) {
|
||||
mDefaultColor = NS_RGB(0x00, 0x00, 0x00);
|
||||
}
|
||||
if (NS_FAILED(LookAndFeel::GetColor(
|
||||
LookAndFeel::eColorID_window, true, &mBackgroundColor))) {
|
||||
mBackgroundColor = NS_RGB(0xff, 0xff, 0xff);
|
||||
}
|
||||
mDefaultColor = LookAndFeel::GetColorUsingStandins(
|
||||
LookAndFeel::eColorID_windowtext, NS_RGB(0x00, 0x00, 0x00));
|
||||
mBackgroundColor = LookAndFeel::GetColorUsingStandins(
|
||||
LookAndFeel::eColorID_window, NS_RGB(0xff, 0xff, 0xff));
|
||||
} else if (usePrefColors) {
|
||||
nsAdoptingString colorStr =
|
||||
Preferences::GetString("browser.display.foreground_color");
|
||||
|
@ -537,6 +537,18 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
static nscolor GetColorUsingStandins(ColorID aID,
|
||||
nscolor aDefault = NS_RGB(0, 0, 0))
|
||||
{
|
||||
nscolor result = NS_RGB(0, 0, 0);
|
||||
if (NS_FAILED(GetColor(aID,
|
||||
true, // aUseStandinsForNativeColors
|
||||
&result))) {
|
||||
return aDefault;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static int32_t GetInt(IntID aID, int32_t aDefault = 0)
|
||||
{
|
||||
int32_t result;
|
||||
|
Loading…
Reference in New Issue
Block a user