Bug 1575097 Part 4: Make nsMediaFeatures::GetDeviceSize return unscaled browser sizes for RDM documents. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D42986

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brad Werth 2019-08-25 23:54:16 +00:00
Родитель 5ba85219c5
Коммит 2ca2008ad6
1 изменённых файлов: 9 добавлений и 10 удалений

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

@ -66,21 +66,20 @@ static nsSize GetSize(const Document* aDocument) {
return pc->GetVisibleArea().Size();
}
static bool IsDeviceSizePageSize(const Document* aDocument) {
nsIDocShell* docShell = aDocument->GetDocShell();
if (!docShell) {
return false;
}
return docShell->GetDeviceSizeIsPageSize();
}
// A helper for three features below.
static nsSize GetDeviceSize(const Document* aDocument) {
if (nsContentUtils::ShouldResistFingerprinting(aDocument) ||
IsDeviceSizePageSize(aDocument)) {
if (nsContentUtils::ShouldResistFingerprinting(aDocument)) {
return GetSize(aDocument);
}
// Media queries in documents in an RDM pane should use the simulated
// device size.
Maybe<CSSIntSize> deviceSize =
nsGlobalWindowOuter::GetRDMDeviceSize(*aDocument);
if (deviceSize.isSome()) {
return CSSPixel::ToAppUnits(deviceSize.value());
}
nsPresContext* pc = aDocument->GetPresContext();
// NOTE(emilio): We should probably figure out how to return an appropriate
// device size here, though in a multi-screen world that makes no sense