Bug 1509552 - Ensure MobileViewportManager doesn't choose a zoom level that makes the content smaller than the visual viewport. r=kats

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Botond Ballo 2018-11-30 00:59:11 +00:00
Родитель 647b04cbf1
Коммит 58464bd083
1 изменённых файлов: 15 добавлений и 9 удалений

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

@ -324,9 +324,22 @@ MobileViewportManager::UpdateResolution(const nsViewportInfo& aViewportInfo,
} else { // aType == UpdateType::ContentSize
MOZ_ASSERT(aType == UpdateType::ContentSize);
MOZ_ASSERT(aDisplayWidthChangeRatio.isNothing());
// We try to scale down the contents only IF the document has no initial-scale
// AND IF it's the initial paint AND IF it's not restored documents.
if (mIsFirstPaint && !mRestoreResolution &&
!aViewportInfo.IsDefaultZoomValid()) {
if (zoom != intrinsicScale) {
newZoom = Some(intrinsicScale);
}
} else {
// Even in other scenarios, we want to ensure that zoom level is
// not _smaller_ than the intrinsic scale, otherwise we might be
// trying to show regions where there is no content to show.
if (zoom < intrinsicScale) {
newZoom = Some(intrinsicScale);
}
}
}
// If the zoom has changed, update the pres shell resolution and the
@ -516,13 +529,6 @@ MobileViewportManager::ShrinkToDisplaySizeIfNeeded(
return;
}
// We try to scale down the contents only IF the document has no initial-scale
// AND IF it's the initial paint AND IF it's not restored documents.
if (aViewportInfo.IsDefaultZoomValid() ||
!mIsFirstPaint || mRestoreResolution) {
return;
}
nsIScrollableFrame* rootScrollableFrame =
mPresShell->GetRootScrollFrameAsScrollable();
if (rootScrollableFrame) {