Backed out changeset 010f5faed9cf (bug 956796) for build bustage

This commit is contained in:
Wes Kocher 2014-01-08 15:03:23 -08:00
parent 18d22a9961
commit 8af7a4b53c

View File

@ -137,6 +137,18 @@ public:
NS_IMPL_ISUPPORTS2(SRGBOverrideObserver, nsIObserver, nsISupportsWeakReference)
NS_IMETHODIMP
SRGBOverrideObserver::Observe(nsISupports *aSubject,
const char *aTopic,
const char16_t *someData)
{
NS_ASSERTION(NS_strcmp(someData,
MOZ_UTF16("gfx.color_mangement.force_srgb")),
"Restarting CMS on wrong pref!");
ShutdownCMS();
return NS_OK;
}
#define GFX_DOWNLOADABLE_FONTS_ENABLED "gfx.downloadable_fonts.enabled"
#define GFX_PREF_HARFBUZZ_SCRIPTS "gfx.font_rendering.harfbuzz.scripts"
@ -152,29 +164,10 @@ NS_IMPL_ISUPPORTS2(SRGBOverrideObserver, nsIObserver, nsISupportsWeakReference)
#define BIDI_NUMERAL_PREF "bidi.numeral"
#define GFX_PREF_CMS_RENDERING_INTENT "gfx.color_management.rendering_intent"
#define GFX_PREF_CMS_DISPLAY_PROFILE "gfx.color_management.display_profile"
#define GFX_PREF_CMS_ENABLED_OBSOLETE "gfx.color_management.enabled"
#define GFX_PREF_CMS_FORCE_SRGB "gfx.color_management.force_srgb"
#define GFX_PREF_CMS_ENABLEV4 "gfx.color_management.enablev4"
#define GFX_PREF_CMS_MODE "gfx.color_management.mode"
NS_IMETHODIMP
SRGBOverrideObserver::Observe(nsISupports *aSubject,
const char *aTopic,
const PRUnichar *someData)
{
NS_ASSERTION(NS_strcmp(someData,
MOZ_UTF16(GFX_PREF_CMS_FORCE_SRGB)) == 0,
"Restarting CMS on wrong pref!");
ShutdownCMS();
return NS_OK;
}
static const char* kObservedPrefs[] = {
"gfx.downloadable_fonts.",
"gfx.font_rendering.",
BIDI_NUMERAL_PREF,
"bidi.numeral",
nullptr
};
@ -461,7 +454,7 @@ gfxPlatform::Init()
/* Create and register our CMS Override observer. */
gPlatform->mSRGBOverrideObserver = new SRGBOverrideObserver();
Preferences::AddWeakObserver(gPlatform->mSRGBOverrideObserver, GFX_PREF_CMS_FORCE_SRGB);
Preferences::AddWeakObserver(gPlatform->mSRGBOverrideObserver, "gfx.color_management.force_srgb");
gPlatform->mFontPrefsObserver = new FontPrefsObserver();
Preferences::AddStrongObservers(gPlatform->mFontPrefsObserver, kObservedPrefs);
@ -531,7 +524,7 @@ gfxPlatform::Shutdown()
if (gPlatform) {
/* Unregister our CMS Override callback. */
NS_ASSERTION(gPlatform->mSRGBOverrideObserver, "mSRGBOverrideObserver has alreay gone");
Preferences::RemoveObserver(gPlatform->mSRGBOverrideObserver, GFX_PREF_CMS_FORCE_SRGB);
Preferences::RemoveObserver(gPlatform->mSRGBOverrideObserver, "gfx.color_management.force_srgb");
gPlatform->mSRGBOverrideObserver = nullptr;
NS_ASSERTION(gPlatform->mFontPrefsObserver, "mFontPrefsObserver has alreay gone");
@ -1634,13 +1627,13 @@ gfxPlatform::GetCMSMode()
nsresult rv;
int32_t mode;
rv = Preferences::GetInt(GFX_PREF_CMS_MODE, &mode);
rv = Preferences::GetInt("gfx.color_management.mode", &mode);
if (NS_SUCCEEDED(rv) && (mode >= 0) && (mode < eCMSMode_AllCount)) {
gCMSMode = static_cast<eCMSMode>(mode);
}
bool enableV4;
rv = Preferences::GetBool(GFX_PREF_CMS_ENABLEV4, &enableV4);
rv = Preferences::GetBool("gfx.color_management.enablev4", &enableV4);
if (NS_SUCCEEDED(rv) && enableV4) {
qcms_enable_iccv4();
}
@ -1655,7 +1648,7 @@ gfxPlatform::GetRenderingIntent()
/* Try to query the pref system for a rendering intent. */
int32_t pIntent;
if (NS_SUCCEEDED(Preferences::GetInt(GFX_PREF_CMS_RENDERING_INTENT, &pIntent))) {
if (NS_SUCCEEDED(Preferences::GetInt("gfx.color_management.rendering_intent", &pIntent))) {
/* If the pref is within range, use it as an override. */
if ((pIntent >= QCMS_INTENT_MIN) && (pIntent <= QCMS_INTENT_MAX)) {
gCMSIntent = pIntent;
@ -1720,12 +1713,12 @@ gfxPlatform::CreateCMSOutputProfile()
default value of this preference, which means nsIPrefBranch::GetBoolPref
will typically throw (and leave its out-param untouched).
*/
if (Preferences::GetBool(GFX_PREF_CMS_FORCE_SRGB, false)) {
if (Preferences::GetBool("gfx.color_management.force_srgb", false)) {
gCMSOutputProfile = GetCMSsRGBProfile();
}
if (!gCMSOutputProfile) {
nsAdoptingCString fname = Preferences::GetCString(GFX_PREF_CMS_DISPLAY_PROFILE);
nsAdoptingCString fname = Preferences::GetCString("gfx.color_management.display_profile");
if (!fname.IsEmpty()) {
gCMSOutputProfile = qcms_profile_from_path(fname);
}
@ -1867,11 +1860,11 @@ static void MigratePrefs()
{
/* Migrate from the boolean color_management.enabled pref - we now use
color_management.mode. */
if (Preferences::HasUserValue(GFX_PREF_CMS_ENABLED_OBSOLETE)) {
if (Preferences::GetBool(GFX_PREF_CMS_ENABLED_OBSOLETE, false)) {
Preferences::SetInt(GFX_PREF_CMS_MODE, static_cast<int32_t>(eCMSMode_All));
if (Preferences::HasUserValue("gfx.color_management.enabled")) {
if (Preferences::GetBool("gfx.color_management.enabled", false)) {
Preferences::SetInt("gfx.color_management.mode", static_cast<int32_t>(eCMSMode_All));
}
Preferences::ClearUser(GFX_PREF_CMS_ENABLED_OBSOLETE);
Preferences::ClearUser("gfx.color_management.enabled");
}
}