зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
5ba85219c5
Коммит
2ca2008ad6
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче