author | vincentliu <vliu@mozilla.com> |
Fri, 05 May 2017 14:22:51 +0800 | |
changeset 356566 | 33df8c04309cf792b214c5c6c903a391048f5516 |
parent 356565 | e9bb619755c4d9dbb67ada4f51d1d2b85163b8f8 |
child 356567 | 31cfb8c2491f23a6bec8c7cee66ac25cd6de99f6 |
push id | 89940 |
push user | vliu@mozilla.com |
push date | Fri, 05 May 2017 06:25:42 +0000 |
treeherder | mozilla-inbound@33df8c04309c [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | milan |
bugs | 1357307 |
milestone | 55.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/widget/nsXPLookAndFeel.cpp +++ b/widget/nsXPLookAndFeel.cpp @@ -14,16 +14,17 @@ #include "nsFont.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/Preferences.h" #include "mozilla/ServoStyleSet.h" #include "mozilla/gfx/2D.h" #include "mozilla/widget/WidgetMessageUtils.h" #include "gfxPlatform.h" +#include "gfxPrefs.h" #include "qcms.h" #ifdef DEBUG #include "nsSize.h" #endif using namespace mozilla; @@ -815,31 +816,35 @@ nsXPLookAndFeel::GetColorImpl(ColorID aI } if (sUseNativeColors && aUseStandinsForNativeColors) { aResult = GetStandinForNativeColor(aID); return NS_OK; } if (sUseNativeColors && NS_SUCCEEDED(NativeGetColor(aID, aResult))) { - if ((gfxPlatform::GetCMSMode() == eCMSMode_All) && - !IsSpecialColor(aID, aResult)) { - qcms_transform *transform = gfxPlatform::GetCMSInverseRGBTransform(); - if (transform) { - uint8_t color[3]; - color[0] = NS_GET_R(aResult); - color[1] = NS_GET_G(aResult); - color[2] = NS_GET_B(aResult); - qcms_transform_data(transform, color, color, 1); - aResult = NS_RGB(color[0], color[1], color[2]); - } - } - if (!mozilla::ServoStyleSet::IsInServoTraversal()) { MOZ_ASSERT(NS_IsMainThread()); + // Make sure the preferences are initialized. In the normal run, + // they would already be, because gfxPlatform would have been created, + // but with some addon, that is not the case. See Bug 1357307. + gfxPrefs::GetSingleton(); + if ((gfxPlatform::GetCMSMode() == eCMSMode_All) && + !IsSpecialColor(aID, aResult)) { + qcms_transform *transform = gfxPlatform::GetCMSInverseRGBTransform(); + if (transform) { + uint8_t color[3]; + color[0] = NS_GET_R(aResult); + color[1] = NS_GET_G(aResult); + color[2] = NS_GET_B(aResult); + qcms_transform_data(transform, color, color, 1); + aResult = NS_RGB(color[0], color[1], color[2]); + } + } + CACHE_COLOR(aID, aResult); } return NS_OK; } return NS_ERROR_NOT_AVAILABLE; }