Bug 1822445: Cut ScreenOrientation over to RFPTarget r=timhuang

Differential Revision: https://phabricator.services.mozilla.com/D172640
This commit is contained in:
Tom Ritter 2023-03-22 15:03:34 +00:00
Родитель 540cf0521d
Коммит 420d6154ec
4 изменённых файлов: 17 добавлений и 12 удалений

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

@ -624,16 +624,16 @@ void ScreenOrientation::CleanupFullscreenListener() {
}
OrientationType ScreenOrientation::DeviceType(CallerType aCallerType) const {
if (nsContentUtils::ShouldResistFingerprinting(aCallerType,
GetOwnerGlobal())) {
if (nsContentUtils::ShouldResistFingerprinting(
aCallerType, GetOwnerGlobal(), RFPTarget::ScreenOrientation)) {
return OrientationType::Landscape_primary;
}
return mType;
}
uint16_t ScreenOrientation::DeviceAngle(CallerType aCallerType) const {
if (nsContentUtils::ShouldResistFingerprinting(aCallerType,
GetOwnerGlobal())) {
if (nsContentUtils::ShouldResistFingerprinting(
aCallerType, GetOwnerGlobal(), RFPTarget::ScreenOrientation)) {
return 0;
}
return mAngle;
@ -641,8 +641,8 @@ uint16_t ScreenOrientation::DeviceAngle(CallerType aCallerType) const {
OrientationType ScreenOrientation::GetType(CallerType aCallerType,
ErrorResult& aRv) const {
if (nsContentUtils::ShouldResistFingerprinting(aCallerType,
GetOwnerGlobal())) {
if (nsContentUtils::ShouldResistFingerprinting(
aCallerType, GetOwnerGlobal(), RFPTarget::ScreenOrientation)) {
return OrientationType::Landscape_primary;
}
@ -658,8 +658,8 @@ OrientationType ScreenOrientation::GetType(CallerType aCallerType,
uint16_t ScreenOrientation::GetAngle(CallerType aCallerType,
ErrorResult& aRv) const {
if (nsContentUtils::ShouldResistFingerprinting(aCallerType,
GetOwnerGlobal())) {
if (nsContentUtils::ShouldResistFingerprinting(
aCallerType, GetOwnerGlobal(), RFPTarget::ScreenOrientation)) {
return 0;
}
@ -717,7 +717,7 @@ Document* ScreenOrientation::GetResponsibleDocument() const {
void ScreenOrientation::MaybeChanged() {
Document* doc = GetResponsibleDocument();
if (!doc || doc->ShouldResistFingerprinting()) {
if (!doc || doc->ShouldResistFingerprinting(RFPTarget::ScreenOrientation)) {
return;
}

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

@ -5505,7 +5505,7 @@ nsresult nsGlobalWindowInner::Observe(nsISupports* aSubject, const char* aTopic,
if (!nsCRT::strcmp(aTopic, "screen-information-changed")) {
if (mScreen) {
if (RefPtr<ScreenOrientation> orientation =
if (RefPtr<mozilla::dom::ScreenOrientation> orientation =
mScreen->GetOrientationIfExists()) {
orientation->MaybeChanged();
}

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

@ -36,7 +36,7 @@ already_AddRefed<nsScreen> nsScreen::Create(nsPIDOMWindowInner* aWindow) {
nsScreen::nsScreen(nsPIDOMWindowInner* aWindow)
: DOMEventTargetHelper(aWindow),
mScreenOrientation(new ScreenOrientation(aWindow, this)) {}
mScreenOrientation(new mozilla::dom::ScreenOrientation(aWindow, this)) {}
nsScreen::~nsScreen() = default;
@ -161,7 +161,9 @@ hal::ScreenOrientation nsScreen::GetOrientationType() const {
return s->GetOrientationType();
}
ScreenOrientation* nsScreen::Orientation() const { return mScreenOrientation; }
mozilla::dom::ScreenOrientation* nsScreen::Orientation() const {
return mScreenOrientation;
}
void nsScreen::GetMozOrientation(nsString& aOrientation,
CallerType aCallerType) const {

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

@ -4,6 +4,9 @@
ITEM_VALUE(TouchEvents, 0x0001)
// Reserving 2-4 for Keyboard Events and Pointer Events
ITEM_VALUE(ScreenOrientation, 0x0005)
/*