summaryrefslogtreecommitdiffstats
path: root/dom/base/test/meta_viewport/test_meta_viewport_fixed_width_and_zero_display_width.html
blob: e649ad9fcd49a0d169473842883a3e502c0634e3 (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
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>Fixed meta viewport width, zero display width</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  <meta name="viewport" content="width=100">
  <script src="viewport_helpers.js"></script>
</head>
<body>
  <p>Fixed meta viewport width, zero display width</p>
  <script type="application/javascript">
    "use strict";

    add_task(async function valid_width() {
      // We choose a 2.5 scaleRatio here to make clear that the later check
      // of the viewport height is getting a scaled value.
      await SpecialPowers.pushPrefEnv(scaleRatio(2.5));

      // We request a zero-width viewport because that triggers a special
      // codepath that sets the viewport height to the scaled display height.
      let info = getViewportInfo(0, 500);
      is(info.width, 100, "width should be 100");
      is(info.height, 200, "height should be 200, since 500 / 2.5 = 200");
    });
  </script>
</body>
</html>