Bug 1678487 - Color-manage system colors from style too. r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D104947
This commit is contained in:
Emilio Cobos Álvarez 2021-03-08 18:12:07 +00:00
Родитель ec2e64fa12
Коммит 343674f3d5
1 изменённых файлов: 15 добавлений и 18 удалений

Просмотреть файл

@ -824,26 +824,23 @@ 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 if (gfxPlatform::GetCMSMode() == CMSMode::All &&
// the traversal. !IsSpecialColor(aID, aResult)) {
if (!mozilla::ServoStyleSet::IsInServoTraversal()) { qcms_transform* transform = gfxPlatform::GetCMSInverseRGBTransform();
MOZ_ASSERT(NS_IsMainThread()); if (transform) {
if (gfxPlatform::GetCMSMode() == CMSMode::All && uint8_t color[4];
!IsSpecialColor(aID, aResult)) { color[0] = NS_GET_R(aResult);
qcms_transform* transform = gfxPlatform::GetCMSInverseRGBTransform(); color[1] = NS_GET_G(aResult);
if (transform) { color[2] = NS_GET_B(aResult);
uint8_t color[4]; color[3] = NS_GET_A(aResult);
color[0] = NS_GET_R(aResult); qcms_transform_data(transform, color, color, 1);
color[1] = NS_GET_G(aResult); aResult = NS_RGBA(color[0], color[1], color[2], color[3]);
color[2] = NS_GET_B(aResult);
color[3] = NS_GET_A(aResult);
qcms_transform_data(transform, color, color, 1);
aResult = NS_RGBA(color[0], color[1], color[2], color[3]);
}
} }
CACHE_COLOR(aID, aResult);
} }
// NOTE: Servo holds a lock and the main thread is paused, so writing to the
// global cache here is fine.
CACHE_COLOR(aID, aResult);
return NS_OK; return NS_OK;
} }