summaryrefslogtreecommitdiffstats
path: root/layout/reftests/svg/as-image/img-novb-width-all-1-ref.html
blob: 9d99b4da67b0a8b328ae585a8c2c6c27c3edc356 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE HTML>
<html>
<head>
  <link rel="stylesheet" type="text/css" href="svg-image-util.css" />
  <script src="svg-image-util.js"></script>
</head>
<body style="height: 600px"><!-- height for pct vals to resolve against -->
  <script>
      var svgParams = {
        viewBox:  null,   // This gets set on a case-by-case basis below.
        width  :  "20px",
        height :  "20%",
        meetOrSlice: null // This means "use pAR=none"
      };

      // Descriptions below describe the behavior of the rows of <img> elements
      // in the corresponding test cases, which we mimic with specially-crafted
      // <embed> elements.

      // * FIRST TWO ROWS: <img> has width=auto height=auto
      //  - Each <img> renders w/ height = 150px (default)
      //  - Synthesized viewBox has height = 20% * viewport_height = .2*150 = 30
      //  - <img> & viewBox both get width=20px, from <svg> width attr
      svgParams.viewBox = [0, 0, 20, 30],
      appendSVGSubArrayWithParams(svgParams, "embed", "20px", "150px");

      // * SECOND TWO ROWS: <img> has width=auto, height=20px
      //  - <img> now renders w/ height = 20px (imposed by <img> height attr)
      //  - Synthesized viewBox has height = 20% * viewport_width = .2*20 = 4
      //  - <img> & viewBox both get width=20px, from <svg> width attr
      svgParams.viewBox = [0, 0, 20, 4],
      appendSVGSubArrayWithParams(svgParams, "embed", "20px", "20px");

      // * THIRD TWO ROWS: <img> has width=30px height=auto
      // Calculations are as with "FIRST TWO ROWS", except <img> now imposes
      // width="30px".
      svgParams.viewBox = [0, 0, 20, 30],
      appendSVGSubArrayWithParams(svgParams, "embed", "30px", "150px");

      // * FOURTH TWO ROWS: <img> has width=30px height=20px
      // Calculations are as with "SECOND TWO ROWS", except <img> now imposes
      // width="30px".
      svgParams.viewBox = [0, 0, 20, 4],
      appendSVGSubArrayWithParams(svgParams, "embed", "30px", "20px");

  </script>
  <!-- Body gets populated by script -->
</body>
</html>