summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css/ex-unit-with-no-x-height.html
blob: c01b02299e7d0678378c320db5a9860f9cc61dc0 (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
<!doctype html>
<svg xmlns = 'http://www.w3.org/2000/svg' style='display:none'>
  <defs>
    <font id="Font1">
      <font-face font-family="block" />
    </font>
  </defs>
</svg>

<style>
.em { height: .5em; width: .5em; }
.ex { height: 1ex; width: 1ex; }
.cover { background: green; }
.back { background: red; }
.one { left: 10px; }
.two { left: 70px; }
#test > div { font-family: block; font-size: 100px; position: absolute; top: 10px; }
#description { margin-top: 70px; }
</style>

<div id='test'>
  <div class='back em one'></div>
  <div class='cover ex one' id='ex'></div>

  <div class='back ex two'></div>
  <div class='cover em two'></div>
</div>
<script src="../js/resources/js-test-pre.js"></script>
<script>
description("This test ensures that the CSS 'ex' unit is treated as half the size of the CSS 'em' unit when a font has no x-height information.")

function measureExBox() {
  return getComputedStyle(document.getElementById('ex')).width;
}

shouldBe("measureExBox();", "'50px'")
</script>