blob: e86ad817d6e87537606d1b4cfa780672705a6245 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<!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>
|