| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<title>italic correction for subscripts</title> |
| 5 |
<meta charset="utf-8"/> |
| 6 |
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=945254"> |
| 7 |
<link rel="help" href="https://w3c.github.io/mathml-core/#dfn-italic-correction"> |
| 8 |
<script src="/resources/testharness.js"></script> |
| 9 |
<script src="/resources/testharnessreport.js"></script> |
| 10 |
<script type="text/javascript"> |
| 11 |
function verifyItalicCorrections() |
| 12 |
{ |
| 13 |
var epsilon = 2; |
| 14 |
for (var i = 0; i < 8; i += 2) { |
| 15 |
var sub = document.getElementById("s" + i); |
| 16 |
var sup = document.getElementById("s" + (i+1)); |
| 17 |
var italicCorrection = |
| 18 |
sup.getBoundingClientRect().left - sub.getBoundingClientRect().left; |
| 19 |
assert_greater_than(italicCorrection, epsilon); |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
promise_test(() => { |
| 24 |
return new Promise(resolve => { |
| 25 |
window.addEventListener("load", resolve); |
| 26 |
}).then(verifyItalicCorrections); |
| 27 |
}, "Italic correction of base is used to place subscripts."); |
| 28 |
</script> |
| 29 |
<style> |
| 30 |
math { font-size: 50px; } |
| 31 |
</style> |
| 32 |
</head> |
| 33 |
<body> |
| 34 |
|
| 35 |
<div> |
| 36 |
<math> |
| 37 |
<msubsup> |
| 38 |
<mi mathbackground="#5f5">f</mi> |
| 39 |
<mspace id="s0" width="50px" height="50px" mathbackground="blue"/> |
| 40 |
<mspace id="s1" width="50px" height="50px" mathbackground="blue"/> |
| 41 |
</msubsup> |
| 42 |
</math> |
| 43 |
</div> |
| 44 |
|
| 45 |
<br/> |
| 46 |
|
| 47 |
<div> |
| 48 |
<math> |
| 49 |
<mmultiscripts> |
| 50 |
<mi mathbackground="#5f5">f</mi> |
| 51 |
<mspace id="s2" width="50px" height="50px" mathbackground="blue"/> |
| 52 |
<mspace id="s3" width="50px" height="50px" mathbackground="blue"/> |
| 53 |
<mspace id="s4" width="50px" height="50px" mathbackground="blue"/> |
| 54 |
<mspace id="s5" width="50px" height="50px" mathbackground="blue"/> |
| 55 |
<mspace id="s6" width="50px" height="50px" mathbackground="blue"/> |
| 56 |
<mspace id="s7" width="50px" height="50px" mathbackground="blue"/> |
| 57 |
</mmultiscripts> |
| 58 |
</math> |
| 59 |
</div> |
| 60 |
|
| 61 |
</body> |
| 62 |
</html> |