summaryrefslogtreecommitdiffstats
path: root/layout/style/nsMediaFeatures.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layout/style/nsMediaFeatures.cpp')
-rw-r--r--layout/style/nsMediaFeatures.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp
index f888c127d4..cc86d1abf6 100644
--- a/layout/style/nsMediaFeatures.cpp
+++ b/layout/style/nsMediaFeatures.cpp
@@ -336,18 +336,19 @@ StyleDynamicRange Gecko_MediaFeatures_DynamicRange(const Document* aDocument) {
StyleDynamicRange Gecko_MediaFeatures_VideoDynamicRange(
const Document* aDocument) {
- if (aDocument->ShouldResistFingerprinting(RFPTarget::CSSVideoDynamicRange)) {
+ if (aDocument->ShouldResistFingerprinting(RFPTarget::CSSVideoDynamicRange) ||
+ !StaticPrefs::layout_css_video_dynamic_range_allows_high()) {
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.
+
+ // As a proxy for those requirements, return 'High' if the screen associated
+ // with the device context claims to be HDR capable.
if (nsDeviceContext* dx = GetDeviceContextFor(aDocument)) {
- if (dx->GetDepth() > 24 &&
- LookAndFeel::GetInt(LookAndFeel::IntID::VideoDynamicRange)) {
+ if (dx->GetScreenIsHDR()) {
return StyleDynamicRange::High;
}
}