зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1751217 Part 4: Make macOS declare video-dynamic-range: high with new-enough OS. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D141056
This commit is contained in:
Родитель
37d4a36187
Коммит
ac55f07b1b
|
@ -292,11 +292,30 @@ StylePrefersContrast Gecko_MediaFeatures_PrefersContrast(
|
|||
}
|
||||
|
||||
StyleDynamicRange Gecko_MediaFeatures_DynamicRange(const Document* aDocument) {
|
||||
// Bug 1759772: Once HDR color is available, update each platform
|
||||
// LookAndFeel implementation to return StyleDynamicRange::High when
|
||||
// appropriate.
|
||||
return StyleDynamicRange::Standard;
|
||||
}
|
||||
|
||||
StyleDynamicRange Gecko_MediaFeatures_VideoDynamicRange(
|
||||
const Document* aDocument) {
|
||||
if (nsContentUtils::ShouldResistFingerprinting(aDocument)) {
|
||||
return StyleDynamicRange::Standard;
|
||||
}
|
||||
// video-dynamic-range: high has 3 requirements:
|
||||
// 1) high peak brightness
|
||||
// 2) high contrast ratio
|
||||
// 3) color depth > 24
|
||||
// We check the color depth requirement before asking the LookAndFeel
|
||||
// if it is HDR capable.
|
||||
if (nsDeviceContext* dx = GetDeviceContextFor(aDocument)) {
|
||||
if (dx->GetDepth() > 24 &&
|
||||
LookAndFeel::GetInt(LookAndFeel::IntID::VideoDynamicRange)) {
|
||||
return StyleDynamicRange::High;
|
||||
}
|
||||
}
|
||||
|
||||
return StyleDynamicRange::Standard;
|
||||
}
|
||||
|
||||
|
|
|
@ -324,6 +324,15 @@ class LookAndFeel {
|
|||
/** GTK menu radius */
|
||||
GtkMenuRadius,
|
||||
|
||||
/**
|
||||
* Corresponding to dynamic-range.
|
||||
* https://drafts.csswg.org/mediaqueries-5/#dynamic-range
|
||||
* 0: Standard
|
||||
* 1: High
|
||||
*/
|
||||
DynamicRange,
|
||||
VideoDynamicRange,
|
||||
|
||||
/*
|
||||
* Not an ID; used to define the range of valid IDs. Must be last.
|
||||
*/
|
||||
|
|
|
@ -499,6 +499,8 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
|
|||
case IntID::UseAccessibilityTheme:
|
||||
aResult = NSWorkspace.sharedWorkspace.accessibilityDisplayShouldIncreaseContrast;
|
||||
break;
|
||||
case IntID::VideoDynamicRange:
|
||||
aResult = nsCocoaFeatures::OnHighSierraOrLater();
|
||||
break;
|
||||
default:
|
||||
aResult = 0;
|
||||
|
|
|
@ -109,7 +109,7 @@ static EnumeratedCache<FontID, widget::LookAndFeelFont, FontID::End> sFontCache;
|
|||
//
|
||||
// This needs to be of the same length and in the same order as
|
||||
// LookAndFeel::IntID values.
|
||||
static const char sIntPrefs[][43] = {
|
||||
static const char sIntPrefs[][45] = {
|
||||
"ui.caretBlinkTime",
|
||||
"ui.caretBlinkCount",
|
||||
"ui.caretWidth",
|
||||
|
@ -176,6 +176,8 @@ static const char sIntPrefs[][43] = {
|
|||
"ui.touchDeviceSupportPresent",
|
||||
"ui.titlebarRadius",
|
||||
"ui.GtkMenuRadius",
|
||||
"ui.dynamicRange",
|
||||
"ui.videoDynamicRange",
|
||||
};
|
||||
|
||||
static_assert(ArrayLength(sIntPrefs) == size_t(LookAndFeel::IntID::End),
|
||||
|
|
Загрузка…
Ссылка в новой задаче