Bug 1568673 part 2: Add a few more assertions to validate that mobile viewport zoom factors are positive. r=botond

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Daniel Holbert 2019-07-26 23:38:18 +00:00
Родитель 45de18b006
Коммит 12c9a1ee6c
1 изменённых файлов: 9 добавлений и 0 удалений

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

@ -180,6 +180,15 @@ CSSToScreenScale MobileViewportManager::ClampZoom(
zoom = aViewportInfo.GetMaxZoom();
MVM_LOG("%p: Clamped to %f\n", this, zoom.scale);
}
// Non-positive zoom factors can produce NaN or negative viewport sizes,
// so we better be sure we've got a positive zoom factor. Just for good
// measure, we check our min/max as well as the final clamped value.
MOZ_ASSERT(aViewportInfo.GetMinZoom() > CSSToScreenScale(0.0f),
"zoom factor must be positive");
MOZ_ASSERT(aViewportInfo.GetMaxZoom() > CSSToScreenScale(0.0f),
"zoom factor must be positive");
MOZ_ASSERT(zoom > CSSToScreenScale(0.0f), "zoom factor must be positive");
return zoom;
}