summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-tables/tentative/baseline-td.html
blob: 4090c5db64e37159164f4965f224859dfd44cc5c (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!doctype html>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<script src="/resources/check-layout-th.js"></script>
<meta name="flags" content="ahem">
<title>TD baseline</title>
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<link rel="stylesheet" type="text/css" href="./support/table-tentative.css">
<link rel="author" title="Aleks Totic" href="atotic@chromium.org" />
<link rel="help" href="https://drafts.csswg.org/css-tables-3/" />
<link rel="help" href="https://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align" />
<style>
  table {
    background: #AAA;
    border-spacing: 8px 0px;
  }
  td {
    padding: 0;
    background: #BFB;
  }
  .ahem {
    font: 25px/2 Ahem;
  }
  .ahem td, .ahem .display-cell {
    font: 25px/2 Ahem;
    color: rgba(0,120,0, 0.5);
  }
  .vgrad {
    background: linear-gradient(180deg, #DDD 0%, #DDD 60%, #999 60%, #999 100%) !important;
  }
  .m {
    display:inline-block;
  }
  .display-table {
    display:table;
    background: #AAA;
    border-spacing: 8px 0px;
  }
  .display-cell {
    display:table-cell;
    padding: 0;
  }
</style>
<main>
<h2>&lt;TD&gt; baseline tests</h2>

<p class="testdesc">All the baseline values.
Many text values map to plain baseline. </p>
<table style="height:100px" class="ahem vgrad">
  <td style="font: 75px/1 Ahem;vertical-align:baseline;"><div class="m" data-offset-y=0>Xp</div></td>
  <td style="" title="default"><div class="m" data-offset-y=25>Xp</div></td>
  <td style="vertical-align: top"><div class="m" data-offset-y=0>Xp</div></td>
  <td style="vertical-align: middle"><div class="m" data-offset-y=25>Xp</div></td>
  <td style="vertical-align: bottom"><div class="m" data-offset-y=50>Xp</div></td>
  <td style="vertical-align: baseline"><div class="m" data-offset-y=28>Xp</div></td>
  <td style="vertical-align: sub"><div class="m" data-offset-y=28>Xp</div></td>
  <td style="vertical-align: super"><div class="m" data-offset-y=28>Xp</div></td>
  <td style="vertical-align: text-top"><div class="m" data-offset-y=28>Xp</div></td>
  <td style="vertical-align: text-bottom"><div class="m" data-offset-y=28>Xp</div></td>
  <td style="vertical-align: 100px"><div class="m" data-offset-y=28>Xp</div></td>
  <td style="vertical-align: 100%"><div class="m" data-offset-y=28>Xp</div></td>
</table>

<p class="testdesc">All the baseline values.
Same as test before, but use display:table/table-cell. Default td alignment is baseline, not middle.</p>
<div style="height:100px;position:relative" class="ahem vgrad display-table">
  <div class="display-cell" style="font: 75px/1 Ahem;vertical-align:baseline;"><div class="m" data-offset-y=0>Xp</div></div>
  <div class="display-cell" style="" title="default"><div class="m" data-offset-y=28>Xp</div></div>
  <div class="display-cell" style="vertical-align: top"><div class="m" data-offset-y=0>Xp</div></div>
  <div class="display-cell" style="vertical-align: middle"><div class="m" data-offset-y=25>Xp</div></div>
  <div class="display-cell" style="vertical-align: bottom"><div class="m" data-offset-y=50>Xp</div></div>
  <div class="display-cell" style="vertical-align: baseline"><div class="m" data-offset-y=28>Xp</div></div>
  <div class="display-cell" style="vertical-align: sub"><div class="m" data-offset-y=28>Xp</div></div>
  <div class="display-cell" style="vertical-align: super"><div class="m" data-offset-y=28>Xp</div></div>
  <div class="display-cell" style="vertical-align: text-top"><div class="m" data-offset-y=28>Xp</div></div>
  <div class="display-cell" style="vertical-align: text-bottom"><div class="m" data-offset-y=28>Xp</div></div>
  <div class="display-cell" style="vertical-align: 100px"><div class="m" data-offset-y=28>Xp</div></div>
  <div class="display-cell" style="vertical-align: 100%"><div class="m" data-offset-y=28>Xp</div></div>
</div>


<p class="testdesc">Baselines with %ge children</p>
<p class="error">FF/Edge fails here</p>
<div>
  inline table
  <table style="height:100px;position:relative;display:inline-table">
    <td style="vertical-align:baseline">
      <div style="width:100px;height:50%;background:rgba(0,120,0, 0.5)" data-offset-y=30></div>
    </td>
     <td style="vertical-align:baseline">
      <div style="width:100px;height:80%;background:rgba(0,120,0, 0.5)" data-offset-y=0></div>
    </td>
  </table>
</div>
<p class="testdesc">Baseline and td height
If td is baseline aligned, and has a height, how tall should the td be?
</p>
<p class="error">Legacy/FF apply height to below baseline?. With baseline alignment, this makes the cell taller.</p>
<table style="border: 1px solid black" data-expected-height=202>
  <tr>
    <td style="vertical-align:baseline;height:200px">base</td>
    <td style="vertical-align:baseline">
      <div style="background:yellow;width:50px;height:100px"></div>
    </td>
  </tr>
</table>

<p class="testdesc">Baseline of rowspanned cell
rowspanned td's should contribute to baseline, but not to the row height.</p>
<table class="ahem">
  <tr data-expected-height=100>
    <td style="vertical-align:baseline;height:100px;background-color:#DFD;">Xp</td>
    <td style="vertical-align:baseline;font-size:40px;line-height:1.5" rowspan=2><div class="m">Xp</div><br>Xp<br>Xp</td>
  </tr>
  <tr data-expected-height=100>
    <td style="vertical-align:baseline;height:100px">Xp</td>
  </tr>
</table>

</main>
<script>
  checkLayout("table, .display-table");
</script>