forked from mirrors/gecko-dev
Bug 1838415 - Introduce RFPTargets for all CSS media features. r=tjr
Differential Revision: https://phabricator.services.mozilla.com/D181247
This commit is contained in:
parent
04d571f1de
commit
a0e70b744b
2 changed files with 23 additions and 8 deletions
|
|
@ -62,7 +62,7 @@ static nsSize GetSize(const Document& aDocument) {
|
|||
|
||||
// A helper for three features below.
|
||||
static nsSize GetDeviceSize(const Document& aDocument) {
|
||||
if (aDocument.ShouldResistFingerprinting(RFPTarget::Unknown)) {
|
||||
if (aDocument.ShouldResistFingerprinting(RFPTarget::CSSDeviceSize)) {
|
||||
return GetSize(aDocument);
|
||||
}
|
||||
|
||||
|
|
@ -154,7 +154,7 @@ int32_t Gecko_MediaFeatures_GetMonochromeBitsPerPixel(
|
|||
dom::ScreenColorGamut Gecko_MediaFeatures_ColorGamut(
|
||||
const Document* aDocument) {
|
||||
auto colorGamut = dom::ScreenColorGamut::Srgb;
|
||||
if (!aDocument->ShouldResistFingerprinting(RFPTarget::Unknown)) {
|
||||
if (!aDocument->ShouldResistFingerprinting(RFPTarget::CSSColorInfo)) {
|
||||
if (auto* dx = GetDeviceContextFor(aDocument)) {
|
||||
colorGamut = dx->GetColorGamut();
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ int32_t Gecko_MediaFeatures_GetColorDepth(const Document* aDocument) {
|
|||
// rendered.
|
||||
int32_t depth = 24;
|
||||
|
||||
if (!aDocument->ShouldResistFingerprinting(RFPTarget::Unknown)) {
|
||||
if (!aDocument->ShouldResistFingerprinting(RFPTarget::CSSColorInfo)) {
|
||||
if (nsDeviceContext* dx = GetDeviceContextFor(aDocument)) {
|
||||
depth = dx->GetDepth();
|
||||
}
|
||||
|
|
@ -198,7 +198,7 @@ float Gecko_MediaFeatures_GetResolution(const Document* aDocument) {
|
|||
return pc->GetOverrideDPPX();
|
||||
}
|
||||
|
||||
if (aDocument->ShouldResistFingerprinting(RFPTarget::Unknown)) {
|
||||
if (aDocument->ShouldResistFingerprinting(RFPTarget::CSSResolution)) {
|
||||
return pc->DeviceContext()->GetFullZoom();
|
||||
}
|
||||
// Get the actual device pixel ratio, which also takes zoom into account.
|
||||
|
|
@ -285,7 +285,8 @@ bool Gecko_MediaFeatures_PrefersReducedMotion(const Document* aDocument) {
|
|||
}
|
||||
|
||||
bool Gecko_MediaFeatures_PrefersReducedTransparency(const Document* aDocument) {
|
||||
if (aDocument->ShouldResistFingerprinting(RFPTarget::Unknown)) {
|
||||
if (aDocument->ShouldResistFingerprinting(
|
||||
RFPTarget::CSSPrefersReducedTransparency)) {
|
||||
return false;
|
||||
}
|
||||
return LookAndFeel::GetInt(LookAndFeel::IntID::PrefersReducedTransparency,
|
||||
|
|
@ -327,7 +328,7 @@ StylePrefersContrast Gecko_MediaFeatures_PrefersContrast(
|
|||
}
|
||||
|
||||
bool Gecko_MediaFeatures_InvertedColors(const Document* aDocument) {
|
||||
if (aDocument->ShouldResistFingerprinting(RFPTarget::Unknown)) {
|
||||
if (aDocument->ShouldResistFingerprinting(RFPTarget::CSSInvertedColors)) {
|
||||
return false;
|
||||
}
|
||||
return LookAndFeel::GetInt(LookAndFeel::IntID::InvertedColors, 0) == 1;
|
||||
|
|
@ -352,7 +353,7 @@ StyleDynamicRange Gecko_MediaFeatures_DynamicRange(const Document* aDocument) {
|
|||
|
||||
StyleDynamicRange Gecko_MediaFeatures_VideoDynamicRange(
|
||||
const Document* aDocument) {
|
||||
if (aDocument->ShouldResistFingerprinting(RFPTarget::Unknown)) {
|
||||
if (aDocument->ShouldResistFingerprinting(RFPTarget::CSSVideoDynamicRange)) {
|
||||
return StyleDynamicRange::Standard;
|
||||
}
|
||||
// video-dynamic-range: high has 3 requirements:
|
||||
|
|
@ -393,7 +394,8 @@ static PointerCapabilities GetPointerCapabilities(const Document* aDocument,
|
|||
#else
|
||||
PointerCapabilities::Fine | PointerCapabilities::Hover;
|
||||
#endif
|
||||
if (aDocument->ShouldResistFingerprinting(RFPTarget::Unknown)) {
|
||||
if (aDocument->ShouldResistFingerprinting(
|
||||
RFPTarget::CSSPointerCapabilities)) {
|
||||
return kDefaultCapabilities;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,19 @@ ITEM_VALUE(UseStandinsForNativeColors, 1llu << 47)
|
|||
ITEM_VALUE(AudioContext, 1llu << 48)
|
||||
ITEM_VALUE(MediaError, 1llu << 49)
|
||||
ITEM_VALUE(DOMStyleOsxFontSmoothing, 1llu << 50)
|
||||
// `device-height`/`device-width` CSS media features
|
||||
ITEM_VALUE(CSSDeviceSize, 1llu << 51)
|
||||
// `color`/`color-gamut` CSS media features
|
||||
ITEM_VALUE(CSSColorInfo, 1llu << 52)
|
||||
// `resolution` CSS media feature
|
||||
ITEM_VALUE(CSSResolution, 1llu << 53)
|
||||
// `prefers-reduced-transparency` CSS media feature
|
||||
ITEM_VALUE(CSSPrefersReducedTransparency, 1llu << 54)
|
||||
// `inverted-colors` CSS media feature
|
||||
ITEM_VALUE(CSSInvertedColors, 1llu << 55)
|
||||
// `video-dynamic-range` CSS media feature
|
||||
ITEM_VALUE(CSSVideoDynamicRange, 1llu << 56)
|
||||
ITEM_VALUE(CSSPointerCapabilities, 1llu << 57)
|
||||
|
||||
// !!! Don't forget to update kDefaultFingerintingProtections in nsRFPService.cpp
|
||||
// if necessary.
|
||||
|
|
|
|||
Loading…
Reference in a new issue