Backed out 3 changesets (bug 1678487) for causing reftest failures.
CLOSED TREE Backed out changeset f6519420f910 (bug 1678487) Backed out changeset 9beae015d19b (bug 1678487) Backed out changeset 029cc10d2477 (bug 1678487)
This commit is contained in:
@@ -177,13 +177,24 @@ static qcms_transform* gCMSRGBATransform = nullptr;
|
|||||||
static qcms_transform* gCMSBGRATransform = nullptr;
|
static qcms_transform* gCMSBGRATransform = nullptr;
|
||||||
|
|
||||||
static bool gCMSInitialized = false;
|
static bool gCMSInitialized = false;
|
||||||
static CMSMode gCMSMode = CMSMode::Off;
|
static eCMSMode gCMSMode = eCMSMode_Off;
|
||||||
|
|
||||||
static void ShutdownCMS();
|
static void ShutdownCMS();
|
||||||
|
|
||||||
#include "mozilla/gfx/2D.h"
|
#include "mozilla/gfx/2D.h"
|
||||||
#include "mozilla/gfx/SourceSurfaceCairo.h"
|
#include "mozilla/gfx/SourceSurfaceCairo.h"
|
||||||
|
|
||||||
|
/* Class to listen for pref changes so that chrome code can dynamically
|
||||||
|
force sRGB as an output profile. See Bug #452125. */
|
||||||
|
class SRGBOverrideObserver final : public nsIObserver,
|
||||||
|
public nsSupportsWeakReference {
|
||||||
|
~SRGBOverrideObserver() = default;
|
||||||
|
|
||||||
|
public:
|
||||||
|
NS_DECL_ISUPPORTS
|
||||||
|
NS_DECL_NSIOBSERVER
|
||||||
|
};
|
||||||
|
|
||||||
/// This override of the LogForwarder, initially used for the critical graphics
|
/// This override of the LogForwarder, initially used for the critical graphics
|
||||||
/// errors, is sending the log to the crash annotations as well, but only
|
/// errors, is sending the log to the crash annotations as well, but only
|
||||||
/// if the capacity set with the method below is >= 2. We always retain the
|
/// if the capacity set with the method below is >= 2. We always retain the
|
||||||
@@ -394,6 +405,8 @@ void CrashStatsLogForwarder::CrashAction(LogReason aReason) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMPL_ISUPPORTS(SRGBOverrideObserver, nsIObserver, nsISupportsWeakReference)
|
||||||
|
|
||||||
#define GFX_DOWNLOADABLE_FONTS_ENABLED "gfx.downloadable_fonts.enabled"
|
#define GFX_DOWNLOADABLE_FONTS_ENABLED "gfx.downloadable_fonts.enabled"
|
||||||
|
|
||||||
#define GFX_PREF_FALLBACK_USE_CMAPS \
|
#define GFX_PREF_FALLBACK_USE_CMAPS \
|
||||||
@@ -411,8 +424,27 @@ void CrashStatsLogForwarder::CrashAction(LogReason aReason) {
|
|||||||
|
|
||||||
#define BIDI_NUMERAL_PREF "bidi.numeral"
|
#define BIDI_NUMERAL_PREF "bidi.numeral"
|
||||||
|
|
||||||
|
#define GFX_PREF_CMS_FORCE_SRGB "gfx.color_management.force_srgb"
|
||||||
|
|
||||||
#define FONT_VARIATIONS_PREF "layout.css.font-variations.enabled"
|
#define FONT_VARIATIONS_PREF "layout.css.font-variations.enabled"
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
SRGBOverrideObserver::Observe(nsISupports* aSubject, const char* aTopic,
|
||||||
|
const char16_t* someData) {
|
||||||
|
NS_ASSERTION(NS_strcmp(someData, (u"" GFX_PREF_CMS_FORCE_SRGB)) == 0,
|
||||||
|
"Restarting CMS on wrong pref!");
|
||||||
|
ShutdownCMS();
|
||||||
|
// Update current cms profile.
|
||||||
|
gfxPlatform::CreateCMSOutputProfile();
|
||||||
|
// FIXME(aosmond): This is also racy for the transforms but the pref is only
|
||||||
|
// used for dev purposes. It can be made a static pref in a followup once the
|
||||||
|
// dependency on it is removed from the gtest suite (see bug 1620600).
|
||||||
|
gfxPlatform::GetCMSRGBTransform();
|
||||||
|
gfxPlatform::GetCMSRGBATransform();
|
||||||
|
gfxPlatform::GetCMSBGRATransform();
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static const char* kObservedPrefs[] = {"gfx.downloadable_fonts.",
|
static const char* kObservedPrefs[] = {"gfx.downloadable_fonts.",
|
||||||
"gfx.font_rendering.", BIDI_NUMERAL_PREF,
|
"gfx.font_rendering.", BIDI_NUMERAL_PREF,
|
||||||
nullptr};
|
nullptr};
|
||||||
@@ -995,6 +1027,13 @@ void gfxPlatform::Init() {
|
|||||||
MOZ_CRASH("Could not initialize gfxFontCache");
|
MOZ_CRASH("Could not initialize gfxFontCache");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create and register our CMS Override observer. */
|
||||||
|
gPlatform->mSRGBOverrideObserver = new SRGBOverrideObserver();
|
||||||
|
Preferences::AddWeakObserver(gPlatform->mSRGBOverrideObserver,
|
||||||
|
GFX_PREF_CMS_FORCE_SRGB);
|
||||||
|
|
||||||
|
Preferences::RegisterPrefixCallbacks(FontPrefChanged, kObservedPrefs);
|
||||||
|
|
||||||
GLContext::PlatformStartup();
|
GLContext::PlatformStartup();
|
||||||
|
|
||||||
Preferences::RegisterCallbackAndCall(RecordingPrefChanged,
|
Preferences::RegisterCallbackAndCall(RecordingPrefChanged,
|
||||||
@@ -1240,6 +1279,13 @@ void gfxPlatform::Shutdown() {
|
|||||||
// Free the various non-null transforms and loaded profiles
|
// Free the various non-null transforms and loaded profiles
|
||||||
ShutdownCMS();
|
ShutdownCMS();
|
||||||
|
|
||||||
|
/* Unregister our CMS Override callback. */
|
||||||
|
NS_ASSERTION(gPlatform->mSRGBOverrideObserver,
|
||||||
|
"mSRGBOverrideObserver has alreay gone");
|
||||||
|
Preferences::RemoveObserver(gPlatform->mSRGBOverrideObserver,
|
||||||
|
GFX_PREF_CMS_FORCE_SRGB);
|
||||||
|
gPlatform->mSRGBOverrideObserver = nullptr;
|
||||||
|
|
||||||
Preferences::UnregisterPrefixCallbacks(FontPrefChanged, kObservedPrefs);
|
Preferences::UnregisterPrefixCallbacks(FontPrefChanged, kObservedPrefs);
|
||||||
|
|
||||||
NS_ASSERTION(gPlatform->mMemoryPressureObserver,
|
NS_ASSERTION(gPlatform->mMemoryPressureObserver,
|
||||||
@@ -2021,11 +2067,11 @@ bool gfxPlatform::OffMainThreadCompositingEnabled() {
|
|||||||
return UsesOffMainThreadCompositing();
|
return UsesOffMainThreadCompositing();
|
||||||
}
|
}
|
||||||
|
|
||||||
CMSMode gfxPlatform::GetCMSMode() {
|
eCMSMode gfxPlatform::GetCMSMode() {
|
||||||
if (!gCMSInitialized) {
|
if (!gCMSInitialized) {
|
||||||
int32_t mode = StaticPrefs::gfx_color_management_mode();
|
int32_t mode = StaticPrefs::gfx_color_management_mode();
|
||||||
if (mode >= 0 && mode < int32_t(CMSMode::AllCount)) {
|
if (mode >= 0 && mode < eCMSMode_AllCount) {
|
||||||
gCMSMode = CMSMode(mode);
|
gCMSMode = static_cast<eCMSMode>(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool enableV4 = StaticPrefs::gfx_color_management_enablev4();
|
bool enableV4 = StaticPrefs::gfx_color_management_enablev4();
|
||||||
@@ -2037,7 +2083,7 @@ CMSMode gfxPlatform::GetCMSMode() {
|
|||||||
return gCMSMode;
|
return gCMSMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfxPlatform::SetCMSModeOverride(CMSMode aMode) {
|
void gfxPlatform::SetCMSModeOverride(eCMSMode aMode) {
|
||||||
MOZ_ASSERT(gCMSInitialized);
|
MOZ_ASSERT(gCMSInitialized);
|
||||||
gCMSMode = aMode;
|
gCMSMode = aMode;
|
||||||
}
|
}
|
||||||
@@ -2120,7 +2166,7 @@ void gfxPlatform::CreateCMSOutputProfile() {
|
|||||||
of this preference, which means nsIPrefBranch::GetBoolPref will
|
of this preference, which means nsIPrefBranch::GetBoolPref will
|
||||||
typically throw (and leave its out-param untouched).
|
typically throw (and leave its out-param untouched).
|
||||||
*/
|
*/
|
||||||
if (StaticPrefs::gfx_color_management_force_srgb()) {
|
if (Preferences::GetBool(GFX_PREF_CMS_FORCE_SRGB, false)) {
|
||||||
gCMSOutputProfile = GetCMSsRGBProfile();
|
gCMSOutputProfile = GetCMSsRGBProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2283,7 +2329,7 @@ static void ShutdownCMS() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset the state variables
|
// Reset the state variables
|
||||||
gCMSMode = CMSMode::Off;
|
gCMSMode = eCMSMode_Off;
|
||||||
gCMSInitialized = false;
|
gCMSInitialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,11 +74,11 @@ class SystemFontListEntry;
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
enum class CMSMode : int32_t {
|
enum eCMSMode {
|
||||||
Off = 0, // No color management
|
eCMSMode_Off = 0, // No color management
|
||||||
All = 1, // Color manage everything
|
eCMSMode_All = 1, // Color manage everything
|
||||||
TaggedOnly = 2, // Color manage tagged Images Only
|
eCMSMode_TaggedOnly = 2, // Color manage tagged Images Only
|
||||||
AllCount = 3
|
eCMSMode_AllCount = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eGfxLog {
|
enum eGfxLog {
|
||||||
@@ -530,12 +530,12 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
|
|||||||
/**
|
/**
|
||||||
* Are we going to try color management?
|
* Are we going to try color management?
|
||||||
*/
|
*/
|
||||||
static CMSMode GetCMSMode();
|
static eCMSMode GetCMSMode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used only for testing. Override the pref setting.
|
* Used only for testing. Override the pref setting.
|
||||||
*/
|
*/
|
||||||
static void SetCMSModeOverride(CMSMode aMode);
|
static void SetCMSModeOverride(eCMSMode aMode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the rendering intent for color management.
|
* Determines the rendering intent for color management.
|
||||||
@@ -983,6 +983,7 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
|
|||||||
static bool IsDXP016Blocked();
|
static bool IsDXP016Blocked();
|
||||||
|
|
||||||
RefPtr<gfxASurface> mScreenReferenceSurface;
|
RefPtr<gfxASurface> mScreenReferenceSurface;
|
||||||
|
nsCOMPtr<nsIObserver> mSRGBOverrideObserver;
|
||||||
RefPtr<mozilla::layers::MemoryPressureObserver> mMemoryPressureObserver;
|
RefPtr<mozilla::layers::MemoryPressureObserver> mMemoryPressureObserver;
|
||||||
|
|
||||||
// The preferred draw target backend to use for canvas
|
// The preferred draw target backend to use for canvas
|
||||||
|
|||||||
@@ -1464,7 +1464,7 @@ DeviceColor ToDeviceColor(const sRGBColor& aColor) {
|
|||||||
// need to return the same object from all return points in this function. We
|
// need to return the same object from all return points in this function. We
|
||||||
// could declare a local Color variable and use that, but we might as well
|
// could declare a local Color variable and use that, but we might as well
|
||||||
// just use aColor.
|
// just use aColor.
|
||||||
if (gfxPlatform::GetCMSMode() == CMSMode::All) {
|
if (gfxPlatform::GetCMSMode() == eCMSMode_All) {
|
||||||
qcms_transform* transform = gfxPlatform::GetCMSRGBTransform();
|
qcms_transform* transform = gfxPlatform::GetCMSRGBTransform();
|
||||||
if (transform) {
|
if (transform) {
|
||||||
return gfxPlatform::TransformPixel(aColor, transform);
|
return gfxPlatform::TransformPixel(aColor, transform);
|
||||||
|
|||||||
@@ -318,10 +318,10 @@ struct StyleRGBA;
|
|||||||
namespace gfx {
|
namespace gfx {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the CMS mode is CMSMode::All, these functions transform the passed
|
* If the CMS mode is eCMSMode_All, these functions transform the passed
|
||||||
* color to a device color using the transform returned by
|
* color to a device color using the transform returened by gfxPlatform::
|
||||||
* gfxPlatform::GetCMSRGBTransform(). If the CMS mode is some other value, the
|
* GetCMSRGBTransform(). If the CMS mode is some other value, the color is
|
||||||
* color is returned unchanged (other than a type change to Moz2D Color, if
|
* returned unchanged (other than a type change to Moz2D Color, if
|
||||||
* applicable).
|
* applicable).
|
||||||
*/
|
*/
|
||||||
DeviceColor ToDeviceColor(const sRGBColor& aColor);
|
DeviceColor ToDeviceColor(const sRGBColor& aColor);
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ void Decoder::SetSurfaceFlags(SurfaceFlags aSurfaceFlags) {
|
|||||||
MOZ_ASSERT(!mInitialized);
|
MOZ_ASSERT(!mInitialized);
|
||||||
mSurfaceFlags = aSurfaceFlags;
|
mSurfaceFlags = aSurfaceFlags;
|
||||||
if (mSurfaceFlags & SurfaceFlags::NO_COLORSPACE_CONVERSION) {
|
if (mSurfaceFlags & SurfaceFlags::NO_COLORSPACE_CONVERSION) {
|
||||||
mCMSMode = CMSMode::Off;
|
mCMSMode = eCMSMode_Off;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,6 @@
|
|||||||
#include "SurfaceFlags.h"
|
#include "SurfaceFlags.h"
|
||||||
#include "qcms.h"
|
#include "qcms.h"
|
||||||
|
|
||||||
enum class CMSMode : int32_t;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
namespace Telemetry {
|
namespace Telemetry {
|
||||||
@@ -569,7 +567,7 @@ class Decoder {
|
|||||||
uint8_t* mImageData; // Pointer to image data in BGRA/X
|
uint8_t* mImageData; // Pointer to image data in BGRA/X
|
||||||
uint32_t mImageDataLength;
|
uint32_t mImageDataLength;
|
||||||
|
|
||||||
CMSMode mCMSMode;
|
uint32_t mCMSMode;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RefPtr<RasterImage> mImage;
|
RefPtr<RasterImage> mImage;
|
||||||
|
|||||||
@@ -717,7 +717,7 @@ LexerTransition<nsBMPDecoder::State> nsBMPDecoder::ReadBitfields(
|
|||||||
mBytesPerColor = (mH.mBIHSize == InfoHeaderLength::WIN_V2) ? 3 : 4;
|
mBytesPerColor = (mH.mBIHSize == InfoHeaderLength::WIN_V2) ? 3 : 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCMSMode != CMSMode::Off) {
|
if (mCMSMode != eCMSMode_Off) {
|
||||||
switch (mH.mCsType) {
|
switch (mH.mCsType) {
|
||||||
case InfoColorSpace::EMBEDDED:
|
case InfoColorSpace::EMBEDDED:
|
||||||
return SeekColorProfile(aLength);
|
return SeekColorProfile(aLength);
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ void nsGIFDecoder2::ConvertColormap(uint32_t* aColormap, uint32_t aColors) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply CMS transformation if enabled and available
|
// Apply CMS transformation if enabled and available
|
||||||
if (mCMSMode == CMSMode::All) {
|
if (mCMSMode == eCMSMode_All) {
|
||||||
qcms_transform* transform = GetCMSsRGBTransform(SurfaceFormat::R8G8B8);
|
qcms_transform* transform = GetCMSsRGBTransform(SurfaceFormat::R8G8B8);
|
||||||
if (transform) {
|
if (transform) {
|
||||||
qcms_transform_data(transform, aColormap, aColormap, aColors);
|
qcms_transform_data(transform, aColormap, aColormap, aColors);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ LexerTransition<nsIconDecoder::State> nsIconDecoder::ReadHeader(
|
|||||||
// premultiplied, so we can't support the surface flags with icons right now.
|
// premultiplied, so we can't support the surface flags with icons right now.
|
||||||
SurfacePipeFlags pipeFlags = SurfacePipeFlags();
|
SurfacePipeFlags pipeFlags = SurfacePipeFlags();
|
||||||
if (transform) {
|
if (transform) {
|
||||||
if (mCMSMode == CMSMode::All) {
|
if (mCMSMode == eCMSMode_All) {
|
||||||
mTransform = GetCMSsRGBTransform(format);
|
mTransform = GetCMSsRGBTransform(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ LexerTransition<nsJPEGDecoder::State> nsJPEGDecoder::ReadJPEGData(
|
|||||||
return Transition::TerminateFailure();
|
return Transition::TerminateFailure();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCMSMode != CMSMode::Off) {
|
if (mCMSMode != eCMSMode_Off) {
|
||||||
if ((mInProfile = GetICCProfile(mInfo)) != nullptr &&
|
if ((mInProfile = GetICCProfile(mInfo)) != nullptr &&
|
||||||
GetCMSOutputProfile()) {
|
GetCMSOutputProfile()) {
|
||||||
uint32_t profileSpace = qcms_profile_get_color_space(mInProfile);
|
uint32_t profileSpace = qcms_profile_get_color_space(mInProfile);
|
||||||
@@ -326,7 +326,7 @@ LexerTransition<nsJPEGDecoder::State> nsJPEGDecoder::ReadJPEGData(
|
|||||||
GetCMSOutputProfile(),
|
GetCMSOutputProfile(),
|
||||||
outputType, (qcms_intent)intent);
|
outputType, (qcms_intent)intent);
|
||||||
}
|
}
|
||||||
} else if (mCMSMode == CMSMode::All) {
|
} else if (mCMSMode == eCMSMode_All) {
|
||||||
mTransform = GetCMSsRGBTransform(SurfaceFormat::OS_RGBX);
|
mTransform = GetCMSsRGBTransform(SurfaceFormat::OS_RGBX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ nsresult nsPNGDecoder::InitInternal() {
|
|||||||
|
|
||||||
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||||
// Ignore unused chunks
|
// Ignore unused chunks
|
||||||
if (mCMSMode == CMSMode::Off || IsMetadataDecode()) {
|
if (mCMSMode == eCMSMode_Off || IsMetadataDecode()) {
|
||||||
png_set_keep_unknown_chunks(mPNG, 1, color_chunks, 2);
|
png_set_keep_unknown_chunks(mPNG, 1, color_chunks, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,7 +584,7 @@ void nsPNGDecoder::info_callback(png_structp png_ptr, png_infop info_ptr) {
|
|||||||
uint32_t intent = -1;
|
uint32_t intent = -1;
|
||||||
bool sRGBTag = false;
|
bool sRGBTag = false;
|
||||||
if (!decoder->IsMetadataDecode()) {
|
if (!decoder->IsMetadataDecode()) {
|
||||||
if (decoder->mCMSMode != CMSMode::Off) {
|
if (decoder->mCMSMode != eCMSMode_Off) {
|
||||||
intent = gfxPlatform::GetRenderingIntent();
|
intent = gfxPlatform::GetRenderingIntent();
|
||||||
uint32_t pIntent =
|
uint32_t pIntent =
|
||||||
decoder->ReadColorProfile(png_ptr, info_ptr, color_type, &sRGBTag);
|
decoder->ReadColorProfile(png_ptr, info_ptr, color_type, &sRGBTag);
|
||||||
@@ -597,7 +597,7 @@ void nsPNGDecoder::info_callback(png_structp png_ptr, png_infop info_ptr) {
|
|||||||
png_set_gray_to_rgb(png_ptr);
|
png_set_gray_to_rgb(png_ptr);
|
||||||
|
|
||||||
// only do gamma correction if CMS isn't entirely disabled
|
// only do gamma correction if CMS isn't entirely disabled
|
||||||
if (decoder->mCMSMode != CMSMode::Off) {
|
if (decoder->mCMSMode != eCMSMode_Off) {
|
||||||
PNGDoGammaCorrection(png_ptr, info_ptr);
|
PNGDoGammaCorrection(png_ptr, info_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -685,8 +685,8 @@ void nsPNGDecoder::info_callback(png_structp png_ptr, png_infop info_ptr) {
|
|||||||
decoder->mTransform = qcms_transform_create(decoder->mInProfile, inType,
|
decoder->mTransform = qcms_transform_create(decoder->mInProfile, inType,
|
||||||
decoder->GetCMSOutputProfile(),
|
decoder->GetCMSOutputProfile(),
|
||||||
outType, (qcms_intent)intent);
|
outType, (qcms_intent)intent);
|
||||||
} else if ((sRGBTag && decoder->mCMSMode == CMSMode::TaggedOnly) ||
|
} else if ((sRGBTag && decoder->mCMSMode == eCMSMode_TaggedOnly) ||
|
||||||
decoder->mCMSMode == CMSMode::All) {
|
decoder->mCMSMode == eCMSMode_All) {
|
||||||
// If the transform happens with SurfacePipe, it will be in RGBA if we
|
// If the transform happens with SurfacePipe, it will be in RGBA if we
|
||||||
// have an alpha channel, because the swizzle and premultiplication
|
// have an alpha channel, because the swizzle and premultiplication
|
||||||
// happens after color management. Otherwise it will be in OS_RGBA because
|
// happens after color management. Otherwise it will be in OS_RGBA because
|
||||||
|
|||||||
@@ -299,8 +299,8 @@ void nsWebPDecoder::ApplyColorProfile(const char* aProfile, size_t aLength) {
|
|||||||
MOZ_ASSERT(!mGotColorProfile);
|
MOZ_ASSERT(!mGotColorProfile);
|
||||||
mGotColorProfile = true;
|
mGotColorProfile = true;
|
||||||
|
|
||||||
if (mCMSMode == CMSMode::Off || !GetCMSOutputProfile() ||
|
if (mCMSMode == eCMSMode_Off || !GetCMSOutputProfile() ||
|
||||||
(mCMSMode == CMSMode::TaggedOnly && !aProfile)) {
|
(mCMSMode == eCMSMode_TaggedOnly && !aProfile)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ AutoInitializeImageLib::AutoInitializeImageLib() {
|
|||||||
|
|
||||||
// Ensure we always color manage images with gtests.
|
// Ensure we always color manage images with gtests.
|
||||||
gfxPlatform::GetCMSMode();
|
gfxPlatform::GetCMSMode();
|
||||||
gfxPlatform::SetCMSModeOverride(CMSMode::All);
|
gfxPlatform::SetCMSModeOverride(eCMSMode_All);
|
||||||
|
|
||||||
// Depending on initialization order, it is possible that our pref changes
|
// Depending on initialization order, it is possible that our pref changes
|
||||||
// have not taken effect yet because there are pending gfx-related events on
|
// have not taken effect yet because there are pending gfx-related events on
|
||||||
|
|||||||
@@ -4145,18 +4145,13 @@
|
|||||||
#endif
|
#endif
|
||||||
mirror: always
|
mirror: always
|
||||||
|
|
||||||
- name: gfx.color_management.force_srgb
|
|
||||||
type: RelaxedAtomicBool
|
|
||||||
value: false
|
|
||||||
mirror: always
|
|
||||||
|
|
||||||
- name: gfx.color_management.enablev4
|
- name: gfx.color_management.enablev4
|
||||||
type: RelaxedAtomicBool
|
type: RelaxedAtomicBool
|
||||||
value: false
|
value: false
|
||||||
mirror: always
|
mirror: always
|
||||||
|
|
||||||
# 0 = Off, 1 = Full, 2 = Tagged Images Only.
|
# 0 = Off, 1 = Full, 2 = Tagged Images Only.
|
||||||
# See CMSMode in gfx/thebes/gfxPlatform.h.
|
# See eCMSMode in gfx/thebes/gfxPlatform.h.
|
||||||
- name: gfx.color_management.mode
|
- name: gfx.color_management.mode
|
||||||
type: RelaxedAtomicInt32
|
type: RelaxedAtomicInt32
|
||||||
value: 2
|
value: 2
|
||||||
|
|||||||
@@ -509,12 +509,10 @@ nsXPLookAndFeel::~nsXPLookAndFeel() {
|
|||||||
sInstance = nullptr;
|
sInstance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsSpecialColor(LookAndFeel::ColorID aID, nscolor aColor) {
|
bool nsXPLookAndFeel::IsSpecialColor(ColorID aID, nscolor& aColor) {
|
||||||
using ColorID = LookAndFeel::ColorID;
|
|
||||||
|
|
||||||
switch (aID) {
|
switch (aID) {
|
||||||
case ColorID::TextSelectForeground:
|
case ColorID::TextSelectForeground:
|
||||||
return aColor == NS_DONT_CHANGE_COLOR;
|
return (aColor == NS_DONT_CHANGE_COLOR);
|
||||||
case ColorID::IMESelectedRawTextBackground:
|
case ColorID::IMESelectedRawTextBackground:
|
||||||
case ColorID::IMESelectedConvertedTextBackground:
|
case ColorID::IMESelectedConvertedTextBackground:
|
||||||
case ColorID::IMERawInputBackground:
|
case ColorID::IMERawInputBackground:
|
||||||
@@ -530,19 +528,16 @@ static bool IsSpecialColor(LookAndFeel::ColorID aID, nscolor aColor) {
|
|||||||
case ColorID::SpellCheckerUnderline:
|
case ColorID::SpellCheckerUnderline:
|
||||||
return NS_IS_SELECTION_SPECIAL_COLOR(aColor);
|
return NS_IS_SELECTION_SPECIAL_COLOR(aColor);
|
||||||
default:
|
default:
|
||||||
break;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* In GetColor(), every color that is not a special color is color
|
* In GetColor(), every color that is not a special color is color
|
||||||
* corrected. Use false to make other colors color corrected.
|
* corrected. Use false to make other colors color corrected.
|
||||||
*/
|
*/
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns whether there is a CSS color name for this color.
|
bool nsXPLookAndFeel::ColorIsNotCSSAccessible(ColorID aID) {
|
||||||
static bool ColorIsCSSAccessible(LookAndFeel::ColorID aID) {
|
|
||||||
using ColorID = LookAndFeel::ColorID;
|
|
||||||
|
|
||||||
switch (aID) {
|
switch (aID) {
|
||||||
case ColorID::WindowBackground:
|
case ColorID::WindowBackground:
|
||||||
case ColorID::WindowForeground:
|
case ColorID::WindowForeground:
|
||||||
@@ -573,118 +568,265 @@ static bool ColorIsCSSAccessible(LookAndFeel::ColorID aID) {
|
|||||||
case ColorID::IMESelectedConvertedTextForeground:
|
case ColorID::IMESelectedConvertedTextForeground:
|
||||||
case ColorID::IMESelectedConvertedTextUnderline:
|
case ColorID::IMESelectedConvertedTextUnderline:
|
||||||
case ColorID::SpellCheckerUnderline:
|
case ColorID::SpellCheckerUnderline:
|
||||||
return false;
|
return true;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscolor nsXPLookAndFeel::GetStandinForNativeColor(ColorID aID) {
|
nscolor nsXPLookAndFeel::GetStandinForNativeColor(ColorID aID) {
|
||||||
|
nscolor result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||||
|
|
||||||
// The stand-in colors are taken from the Windows 7 Aero theme
|
// The stand-in colors are taken from the Windows 7 Aero theme
|
||||||
// except Mac-specific colors which are taken from Mac OS 10.7.
|
// except Mac-specific colors which are taken from Mac OS 10.7.
|
||||||
|
|
||||||
#define COLOR(name_, r, g, b) \
|
|
||||||
case ColorID::name_: \
|
|
||||||
return NS_RGB(r, g, b);
|
|
||||||
|
|
||||||
switch (aID) {
|
switch (aID) {
|
||||||
// CSS 2 colors:
|
// CSS 2 colors:
|
||||||
COLOR(Activeborder, 0xB4, 0xB4, 0xB4)
|
case ColorID::Activeborder:
|
||||||
COLOR(Activecaption, 0x99, 0xB4, 0xD1)
|
result = NS_RGB(0xB4, 0xB4, 0xB4);
|
||||||
COLOR(Appworkspace, 0xAB, 0xAB, 0xAB)
|
break;
|
||||||
COLOR(Background, 0x00, 0x00, 0x00)
|
case ColorID::Activecaption:
|
||||||
COLOR(Buttonface, 0xF0, 0xF0, 0xF0)
|
result = NS_RGB(0x99, 0xB4, 0xD1);
|
||||||
COLOR(Buttonhighlight, 0xFF, 0xFF, 0xFF)
|
break;
|
||||||
COLOR(Buttonshadow, 0xA0, 0xA0, 0xA0)
|
case ColorID::Appworkspace:
|
||||||
COLOR(Buttontext, 0x00, 0x00, 0x00)
|
result = NS_RGB(0xAB, 0xAB, 0xAB);
|
||||||
COLOR(Captiontext, 0x00, 0x00, 0x00)
|
break;
|
||||||
COLOR(Graytext, 0x6D, 0x6D, 0x6D)
|
case ColorID::Background:
|
||||||
COLOR(Highlight, 0x33, 0x99, 0xFF)
|
result = NS_RGB(0x00, 0x00, 0x00);
|
||||||
COLOR(Highlighttext, 0xFF, 0xFF, 0xFF)
|
break;
|
||||||
COLOR(Inactiveborder, 0xF4, 0xF7, 0xFC)
|
case ColorID::Buttonface:
|
||||||
COLOR(Inactivecaption, 0xBF, 0xCD, 0xDB)
|
result = NS_RGB(0xF0, 0xF0, 0xF0);
|
||||||
COLOR(Inactivecaptiontext, 0x43, 0x4E, 0x54)
|
break;
|
||||||
COLOR(Infobackground, 0xFF, 0xFF, 0xE1)
|
case ColorID::Buttonhighlight:
|
||||||
COLOR(Infotext, 0x00, 0x00, 0x00)
|
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||||
COLOR(Menu, 0xF0, 0xF0, 0xF0)
|
break;
|
||||||
COLOR(Menutext, 0x00, 0x00, 0x00)
|
case ColorID::Buttonshadow:
|
||||||
COLOR(Scrollbar, 0xC8, 0xC8, 0xC8)
|
result = NS_RGB(0xA0, 0xA0, 0xA0);
|
||||||
COLOR(Threeddarkshadow, 0x69, 0x69, 0x69)
|
break;
|
||||||
COLOR(Threedface, 0xF0, 0xF0, 0xF0)
|
case ColorID::Buttontext:
|
||||||
COLOR(Threedhighlight, 0xFF, 0xFF, 0xFF)
|
result = NS_RGB(0x00, 0x00, 0x00);
|
||||||
COLOR(Threedlightshadow, 0xE3, 0xE3, 0xE3)
|
break;
|
||||||
COLOR(Threedshadow, 0xA0, 0xA0, 0xA0)
|
case ColorID::Captiontext:
|
||||||
COLOR(Window, 0xFF, 0xFF, 0xFF)
|
result = NS_RGB(0x00, 0x00, 0x00);
|
||||||
COLOR(Windowframe, 0x64, 0x64, 0x64)
|
break;
|
||||||
COLOR(Windowtext, 0x00, 0x00, 0x00)
|
case ColorID::Graytext:
|
||||||
COLOR(MozButtondefault, 0x69, 0x69, 0x69)
|
result = NS_RGB(0x6D, 0x6D, 0x6D);
|
||||||
COLOR(Field, 0xFF, 0xFF, 0xFF)
|
break;
|
||||||
COLOR(Fieldtext, 0x00, 0x00, 0x00)
|
case ColorID::Highlight:
|
||||||
COLOR(MozDialog, 0xF0, 0xF0, 0xF0)
|
result = NS_RGB(0x33, 0x99, 0xFF);
|
||||||
COLOR(MozDialogtext, 0x00, 0x00, 0x00)
|
break;
|
||||||
COLOR(MozColheadertext, 0x00, 0x00, 0x00)
|
case ColorID::Highlighttext:
|
||||||
COLOR(MozColheaderhovertext, 0x00, 0x00, 0x00)
|
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||||
COLOR(MozDragtargetzone, 0xFF, 0xFF, 0xFF)
|
break;
|
||||||
COLOR(MozCellhighlight, 0xF0, 0xF0, 0xF0)
|
case ColorID::Inactiveborder:
|
||||||
COLOR(MozCellhighlighttext, 0x00, 0x00, 0x00)
|
result = NS_RGB(0xF4, 0xF7, 0xFC);
|
||||||
COLOR(MozHtmlCellhighlight, 0x33, 0x99, 0xFF)
|
break;
|
||||||
COLOR(MozHtmlCellhighlighttext, 0xFF, 0xFF, 0xFF)
|
case ColorID::Inactivecaption:
|
||||||
COLOR(MozButtonhoverface, 0xF0, 0xF0, 0xF0)
|
result = NS_RGB(0xBF, 0xCD, 0xDB);
|
||||||
COLOR(MozGtkButtonactivetext, 0x00, 0x00, 0x00)
|
break;
|
||||||
COLOR(MozButtonhovertext, 0x00, 0x00, 0x00)
|
case ColorID::Inactivecaptiontext:
|
||||||
COLOR(MozMenuhover, 0x33, 0x99, 0xFF)
|
result = NS_RGB(0x43, 0x4E, 0x54);
|
||||||
COLOR(MozMenuhovertext, 0x00, 0x00, 0x00)
|
break;
|
||||||
COLOR(MozMenubartext, 0x00, 0x00, 0x00)
|
case ColorID::Infobackground:
|
||||||
COLOR(MozMenubarhovertext, 0x00, 0x00, 0x00)
|
result = NS_RGB(0xFF, 0xFF, 0xE1);
|
||||||
COLOR(MozOddtreerow, 0xFF, 0xFF, 0xFF)
|
break;
|
||||||
COLOR(MozMacChromeActive, 0xB2, 0xB2, 0xB2)
|
case ColorID::Infotext:
|
||||||
COLOR(MozMacChromeInactive, 0xE1, 0xE1, 0xE1)
|
result = NS_RGB(0x00, 0x00, 0x00);
|
||||||
COLOR(MozMacFocusring, 0x60, 0x9D, 0xD7)
|
break;
|
||||||
COLOR(MozMacMenuselect, 0x38, 0x75, 0xD7)
|
case ColorID::Menu:
|
||||||
COLOR(MozMacMenushadow, 0xA3, 0xA3, 0xA3)
|
result = NS_RGB(0xF0, 0xF0, 0xF0);
|
||||||
COLOR(MozMacMenutextdisable, 0x88, 0x88, 0x88)
|
break;
|
||||||
COLOR(MozMacMenutextselect, 0xFF, 0xFF, 0xFF)
|
case ColorID::Menutext:
|
||||||
COLOR(MozMacDisabledtoolbartext, 0x3F, 0x3F, 0x3F)
|
result = NS_RGB(0x00, 0x00, 0x00);
|
||||||
COLOR(MozMacSecondaryhighlight, 0xD4, 0xD4, 0xD4)
|
break;
|
||||||
COLOR(MozMacVibrancyLight, 0xf7, 0xf7, 0xf7)
|
case ColorID::Scrollbar:
|
||||||
COLOR(MozMacVibrantTitlebarLight, 0xf7, 0xf7, 0xf7)
|
result = NS_RGB(0xC8, 0xC8, 0xC8);
|
||||||
COLOR(MozMacVibrancyDark, 0x28, 0x28, 0x28)
|
break;
|
||||||
COLOR(MozMacVibrantTitlebarDark, 0x28, 0x28, 0x28)
|
case ColorID::Threeddarkshadow:
|
||||||
COLOR(MozMacMenupopup, 0xe6, 0xe6, 0xe6)
|
result = NS_RGB(0x69, 0x69, 0x69);
|
||||||
COLOR(MozMacMenuitem, 0xe6, 0xe6, 0xe6)
|
break;
|
||||||
COLOR(MozMacActiveMenuitem, 0x0a, 0x64, 0xdc)
|
case ColorID::Threedface:
|
||||||
COLOR(MozMacSourceList, 0xf7, 0xf7, 0xf7)
|
result = NS_RGB(0xF0, 0xF0, 0xF0);
|
||||||
COLOR(MozMacSourceListSelection, 0xc8, 0xc8, 0xc8)
|
break;
|
||||||
COLOR(MozMacActiveSourceListSelection, 0x0a, 0x64, 0xdc)
|
case ColorID::Threedhighlight:
|
||||||
COLOR(MozMacTooltip, 0xf7, 0xf7, 0xf7)
|
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||||
|
break;
|
||||||
|
case ColorID::Threedlightshadow:
|
||||||
|
result = NS_RGB(0xE3, 0xE3, 0xE3);
|
||||||
|
break;
|
||||||
|
case ColorID::Threedshadow:
|
||||||
|
result = NS_RGB(0xA0, 0xA0, 0xA0);
|
||||||
|
break;
|
||||||
|
case ColorID::Window:
|
||||||
|
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||||
|
break;
|
||||||
|
case ColorID::Windowframe:
|
||||||
|
result = NS_RGB(0x64, 0x64, 0x64);
|
||||||
|
break;
|
||||||
|
case ColorID::Windowtext:
|
||||||
|
result = NS_RGB(0x00, 0x00, 0x00);
|
||||||
|
break;
|
||||||
|
case ColorID::MozButtondefault:
|
||||||
|
result = NS_RGB(0x69, 0x69, 0x69);
|
||||||
|
break;
|
||||||
|
case ColorID::Field:
|
||||||
|
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||||
|
break;
|
||||||
|
case ColorID::Fieldtext:
|
||||||
|
result = NS_RGB(0x00, 0x00, 0x00);
|
||||||
|
break;
|
||||||
|
case ColorID::MozDialog:
|
||||||
|
result = NS_RGB(0xF0, 0xF0, 0xF0);
|
||||||
|
break;
|
||||||
|
case ColorID::MozDialogtext:
|
||||||
|
case ColorID::MozColheadertext:
|
||||||
|
case ColorID::MozColheaderhovertext:
|
||||||
|
result = NS_RGB(0x00, 0x00, 0x00);
|
||||||
|
break;
|
||||||
|
case ColorID::MozDragtargetzone:
|
||||||
|
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||||
|
break;
|
||||||
|
case ColorID::MozCellhighlight:
|
||||||
|
result = NS_RGB(0xF0, 0xF0, 0xF0);
|
||||||
|
break;
|
||||||
|
case ColorID::MozCellhighlighttext:
|
||||||
|
result = NS_RGB(0x00, 0x00, 0x00);
|
||||||
|
break;
|
||||||
|
case ColorID::MozHtmlCellhighlight:
|
||||||
|
result = NS_RGB(0x33, 0x99, 0xFF);
|
||||||
|
break;
|
||||||
|
case ColorID::MozHtmlCellhighlighttext:
|
||||||
|
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||||
|
break;
|
||||||
|
case ColorID::MozButtonhoverface:
|
||||||
|
result = NS_RGB(0xF0, 0xF0, 0xF0);
|
||||||
|
break;
|
||||||
|
case ColorID::MozGtkButtonactivetext:
|
||||||
|
case ColorID::MozButtonhovertext:
|
||||||
|
result = NS_RGB(0x00, 0x00, 0x00);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMenuhover:
|
||||||
|
result = NS_RGB(0x33, 0x99, 0xFF);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMenuhovertext:
|
||||||
|
result = NS_RGB(0x00, 0x00, 0x00);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMenubartext:
|
||||||
|
result = NS_RGB(0x00, 0x00, 0x00);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMenubarhovertext:
|
||||||
|
result = NS_RGB(0x00, 0x00, 0x00);
|
||||||
|
break;
|
||||||
|
case ColorID::MozOddtreerow:
|
||||||
|
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacChromeActive:
|
||||||
|
result = NS_RGB(0xB2, 0xB2, 0xB2);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacChromeInactive:
|
||||||
|
result = NS_RGB(0xE1, 0xE1, 0xE1);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacFocusring:
|
||||||
|
result = NS_RGB(0x60, 0x9D, 0xD7);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacMenuselect:
|
||||||
|
result = NS_RGB(0x38, 0x75, 0xD7);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacMenushadow:
|
||||||
|
result = NS_RGB(0xA3, 0xA3, 0xA3);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacMenutextdisable:
|
||||||
|
result = NS_RGB(0x88, 0x88, 0x88);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacMenutextselect:
|
||||||
|
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacDisabledtoolbartext:
|
||||||
|
result = NS_RGB(0x3F, 0x3F, 0x3F);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacSecondaryhighlight:
|
||||||
|
result = NS_RGB(0xD4, 0xD4, 0xD4);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacVibrancyLight:
|
||||||
|
case ColorID::MozMacVibrantTitlebarLight:
|
||||||
|
result = NS_RGB(0xf7, 0xf7, 0xf7);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacVibrancyDark:
|
||||||
|
case ColorID::MozMacVibrantTitlebarDark:
|
||||||
|
result = NS_RGB(0x28, 0x28, 0x28);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacMenupopup:
|
||||||
|
result = NS_RGB(0xe6, 0xe6, 0xe6);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacMenuitem:
|
||||||
|
result = NS_RGB(0xe6, 0xe6, 0xe6);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacActiveMenuitem:
|
||||||
|
result = NS_RGB(0x0a, 0x64, 0xdc);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacSourceList:
|
||||||
|
result = NS_RGB(0xf7, 0xf7, 0xf7);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacSourceListSelection:
|
||||||
|
result = NS_RGB(0xc8, 0xc8, 0xc8);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacActiveSourceListSelection:
|
||||||
|
result = NS_RGB(0x0a, 0x64, 0xdc);
|
||||||
|
break;
|
||||||
|
case ColorID::MozMacTooltip:
|
||||||
|
result = NS_RGB(0xf7, 0xf7, 0xf7);
|
||||||
|
break;
|
||||||
|
case ColorID::MozWinAccentcolor:
|
||||||
// Seems to be the default color (hardcoded because of bug 1065998)
|
// Seems to be the default color (hardcoded because of bug 1065998)
|
||||||
COLOR(MozWinAccentcolor, 0x9E, 0x9E, 0x9E)
|
result = NS_RGB(0x9E, 0x9E, 0x9E);
|
||||||
COLOR(MozWinAccentcolortext, 0x00, 0x00, 0x00)
|
break;
|
||||||
COLOR(MozWinMediatext, 0xFF, 0xFF, 0xFF)
|
case ColorID::MozWinAccentcolortext:
|
||||||
COLOR(MozWinCommunicationstext, 0xFF, 0xFF, 0xFF)
|
result = NS_RGB(0x00, 0x00, 0x00);
|
||||||
COLOR(MozNativehyperlinktext, 0x00, 0x66, 0xCC)
|
break;
|
||||||
COLOR(MozComboboxtext, 0x00, 0x00, 0x00)
|
case ColorID::MozWinMediatext:
|
||||||
COLOR(MozCombobox, 0xFF, 0xFF, 0xFF)
|
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||||
|
break;
|
||||||
|
case ColorID::MozWinCommunicationstext:
|
||||||
|
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||||
|
break;
|
||||||
|
case ColorID::MozNativehyperlinktext:
|
||||||
|
result = NS_RGB(0x00, 0x66, 0xCC);
|
||||||
|
break;
|
||||||
|
case ColorID::MozComboboxtext:
|
||||||
|
result = NS_RGB(0x00, 0x00, 0x00);
|
||||||
|
break;
|
||||||
|
case ColorID::MozCombobox:
|
||||||
|
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return NS_RGB(0xFF, 0xFF, 0xFF);
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uncomment the #define below if you want to debug system color use in a skin
|
|
||||||
// that uses them. When set, it will make all system color pairs that are
|
|
||||||
// appropriate for foreground/background pairing the same. This means if the
|
|
||||||
// skin is using system colors correctly you will not be able to see *any* text.
|
|
||||||
//
|
//
|
||||||
// #define DEBUG_SYSTEM_COLOR_USE
|
// All these routines will return NS_OK if they have a value,
|
||||||
|
// in which case the nsLookAndFeel should use that value;
|
||||||
|
// otherwise we'll return NS_ERROR_NOT_AVAILABLE, in which case, the
|
||||||
|
// platform-specific nsLookAndFeel should use its own values instead.
|
||||||
|
//
|
||||||
|
nsresult nsXPLookAndFeel::GetColorValue(ColorID aID,
|
||||||
|
bool aUseStandinsForNativeColors,
|
||||||
|
nscolor& aResult) {
|
||||||
|
if (!sInitialized) Init();
|
||||||
|
|
||||||
|
// define DEBUG_SYSTEM_COLOR_USE if you want to debug system color
|
||||||
|
// use in a skin that uses them. When set, it will make all system
|
||||||
|
// color pairs that are appropriate for foreground/background
|
||||||
|
// pairing the same. This means if the skin is using system colors
|
||||||
|
// correctly you will not be able to see *any* text.
|
||||||
|
#undef DEBUG_SYSTEM_COLOR_USE
|
||||||
|
|
||||||
#ifdef DEBUG_SYSTEM_COLOR_USE
|
#ifdef DEBUG_SYSTEM_COLOR_USE
|
||||||
static nsresult SystemColorUseDebuggingColor(LookAndFeel::ColorID aID,
|
{
|
||||||
nscolor& aResult) {
|
nsresult rv = NS_OK;
|
||||||
using ColorID = LookAndFeel::ColorID;
|
|
||||||
|
|
||||||
switch (aID) {
|
switch (aID) {
|
||||||
// css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
|
// css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
|
||||||
case ColorID::Activecaption:
|
case ColorID::Activecaption:
|
||||||
@@ -749,33 +891,15 @@ static nsresult SystemColorUseDebuggingColor(LookAndFeel::ColorID aID,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
rv = NS_ERROR_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
if (NS_SUCCEEDED(rv)) return rv;
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// All these routines will return NS_OK if they have a value,
|
|
||||||
// in which case the nsLookAndFeel should use that value;
|
|
||||||
// otherwise we'll return NS_ERROR_NOT_AVAILABLE, in which case, the
|
|
||||||
// platform-specific nsLookAndFeel should use its own values instead.
|
|
||||||
nsresult nsXPLookAndFeel::GetColorValue(ColorID aID,
|
|
||||||
bool aUseStandinsForNativeColors,
|
|
||||||
nscolor& aResult) {
|
|
||||||
if (!sInitialized) {
|
|
||||||
Init();
|
|
||||||
}
|
}
|
||||||
|
#endif // DEBUG_SYSTEM_COLOR_USE
|
||||||
|
|
||||||
#ifdef DEBUG_SYSTEM_COLOR_USE
|
if (aUseStandinsForNativeColors && ColorIsNotCSSAccessible(aID)) {
|
||||||
if (NS_SUCCEEDED(SystemColorUseDebuggingColor(aID, aResult))) {
|
aUseStandinsForNativeColors = false;
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// We only use standins for colors that we can access via CSS.
|
|
||||||
aUseStandinsForNativeColors =
|
|
||||||
aUseStandinsForNativeColors && ColorIsCSSAccessible(aID);
|
|
||||||
|
|
||||||
if (!aUseStandinsForNativeColors && IS_COLOR_CACHED(aID)) {
|
if (!aUseStandinsForNativeColors && IS_COLOR_CACHED(aID)) {
|
||||||
aResult = sCachedColors[uint32_t(aID)];
|
aResult = sCachedColors[uint32_t(aID)];
|
||||||
@@ -824,11 +948,9 @@ nsresult nsXPLookAndFeel::GetColorValue(ColorID aID,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (NS_SUCCEEDED(NativeGetColor(aID, aResult))) {
|
if (NS_SUCCEEDED(NativeGetColor(aID, aResult))) {
|
||||||
// TODO(bug 1678487): We should color-correct style colors as well when in
|
|
||||||
// the traversal.
|
|
||||||
if (!mozilla::ServoStyleSet::IsInServoTraversal()) {
|
if (!mozilla::ServoStyleSet::IsInServoTraversal()) {
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
if (gfxPlatform::GetCMSMode() == CMSMode::All &&
|
if ((gfxPlatform::GetCMSMode() == eCMSMode_All) &&
|
||||||
!IsSpecialColor(aID, aResult)) {
|
!IsSpecialColor(aID, aResult)) {
|
||||||
qcms_transform* transform = gfxPlatform::GetCMSInverseRGBTransform();
|
qcms_transform* transform = gfxPlatform::GetCMSInverseRGBTransform();
|
||||||
if (transform) {
|
if (transform) {
|
||||||
|
|||||||
@@ -103,10 +103,12 @@ class nsXPLookAndFeel : public mozilla::LookAndFeel {
|
|||||||
static void IntPrefChanged(nsLookAndFeelIntPref* data);
|
static void IntPrefChanged(nsLookAndFeelIntPref* data);
|
||||||
static void FloatPrefChanged(nsLookAndFeelFloatPref* data);
|
static void FloatPrefChanged(nsLookAndFeelFloatPref* data);
|
||||||
static void ColorPrefChanged(unsigned int index, const char* prefName);
|
static void ColorPrefChanged(unsigned int index, const char* prefName);
|
||||||
static nscolor GetStandinForNativeColor(ColorID);
|
|
||||||
void InitFromPref(nsLookAndFeelIntPref* aPref);
|
void InitFromPref(nsLookAndFeelIntPref* aPref);
|
||||||
void InitFromPref(nsLookAndFeelFloatPref* aPref);
|
void InitFromPref(nsLookAndFeelFloatPref* aPref);
|
||||||
void InitColorFromPref(int32_t aIndex);
|
void InitColorFromPref(int32_t aIndex);
|
||||||
|
bool IsSpecialColor(ColorID aID, nscolor& aColor);
|
||||||
|
bool ColorIsNotCSSAccessible(ColorID aID);
|
||||||
|
nscolor GetStandinForNativeColor(ColorID aID);
|
||||||
void RecordTelemetry();
|
void RecordTelemetry();
|
||||||
virtual void RecordLookAndFeelSpecificTelemetry() {}
|
virtual void RecordLookAndFeelSpecificTelemetry() {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user