Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>meta viewport viewport-fit test</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<meta name="viewport" content="viewport-fit=cover">
<script src="viewport_helpers.js"></script>
</head>
<body>
<p>viewport-fit=cover</p>
<script type="application/javascript">
"use strict";
add_task(async function test1() {
await SpecialPowers.pushPrefEnv(scaleRatio(1.0));
let viewportFit = SpecialPowers.getDOMWindowUtils(window).getViewportFitInfo();
is(viewportFit, "cover", "viewport-fit is cover correctly");
let elements = document.getElementsByTagName("meta");
for (let meta of elements) {
if (meta.getAttribute("name") == "viewport") {
meta.setAttribute("content", "viewport-fit=contain");
}
}
viewportFit = SpecialPowers.getDOMWindowUtils(window).getViewportFitInfo();
is(viewportFit, "contain", "viewport-fit is contain correctly");
});
</script>
</body>
</html>