summaryrefslogtreecommitdiffstats
path: root/layout/reftests/mathml/subscript-italic-correction.html
blob: 04be7ba5f9ae4d24a3f51bcf2a8319acfc98e6ac (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
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html class="reftest-wait">
  <head>
    <title>subscript</title>
    <meta charset="utf-8"/>
    <script type="text/javascript">
      function verifyItalicCorrections()
      {
        var epsilon = 2;
        for (var i = 0; i < 8; i += 2) {
          var sub = document.getElementById("s" + i);
          var sup = document.getElementById("s" + (i+1));
          var italicCorrection =
           sup.getBoundingClientRect().left - sub.getBoundingClientRect().left;
           if (italicCorrection < epsilon) {
             return false;
           }
        }
        return true;
      }

      function doTest()
      {
        if (verifyItalicCorrections()) {
          document.body.style.background = "#5f5";
        }
        document.documentElement.removeAttribute("class");
      }
      window.addEventListener("MozReftestInvalidate", doTest);
    </script>
  </head>
  <body style="background: #f00; font-size: 50px;">

    <div>
      <math>
        <msubsup>
          <mi mathbackground="#5f5">f</mi>
          <mspace id="s0" width="50px" height="50px" mathbackground="blue"/>
          <mspace id="s1" width="50px" height="50px" mathbackground="blue"/>
        </msubsup>
      </math>
    </div>

    <br/>

    <div>
      <math>
        <mmultiscripts>
          <mi mathbackground="#5f5">f</mi>
          <mspace id="s2" width="50px" height="50px" mathbackground="blue"/>
          <mspace id="s3" width="50px" height="50px" mathbackground="blue"/>
          <mspace id="s4" width="50px" height="50px" mathbackground="blue"/>
          <mspace id="s5" width="50px" height="50px" mathbackground="blue"/>
          <mspace id="s6" width="50px" height="50px" mathbackground="blue"/>
          <mspace id="s7" width="50px" height="50px" mathbackground="blue"/>
        </mmultiscripts>
      </math>
    </div>

  </body>
</html>