summaryrefslogtreecommitdiffstats
path: root/dom/base/test/meta_viewport/test_meta_viewport_initial_scale_0_5.html
blob: 99fb5c1d369bdb468691969275d5410983213853 (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
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>initial-scale=0.5 in meta viewport</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  <meta name="viewport" content="initial-scale=0.5">
  <script src="viewport_helpers.js"></script>
</head>
<body>
  <p>initial-scale=0.5</p>
  <script type="application/javascript">
    "use strict";

    add_task(async function initial_scale_0_5() {
      await SpecialPowers.pushPrefEnv(scaleRatio(1.0));

      let info = getViewportInfo(800, 480);
      // 'min-width' is 'display width / initial-scale', thus the value will be
      // bigger than the display width in the case where the initial-scale is
      // less than 1, thus the final viewport width will be the 'min-width'.
      // See 'Resolve initial width and height from min/max descriptors' section
      // in the spec for more detail.
      // height is calculated by the same rule.
      // https://drafts.csswg.org/css-device-adapt/#resolve-initial-width-height
      is(info.width, 1600, "width should be scaled by 1 / initial-scale");
      is(info.height, 960, "height should be scaled by 1 / initial-scale");
      is(info.defaultZoom, 0.5, "initial-scale should be 0.5");
    });
  </script>
</body>
</html>