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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>displaystyle</title>
<link rel="help" href="https://w3c.github.io/mathml-core/#css-styling">
<link rel="help" href="https://w3c.github.io/mathml-core/#the-displaystyle-and-scriptlevel-attributes">
<link rel="help" href="https://w3c.github.io/mathml-core/#the-math-style-property">
<meta name="assert" content="Verify interaction between automatic displaystyle and specified displaystyle on descendants.">
<style>
@font-face {
font-family: TestFont;
src: url("/fonts/math/largeop-displayoperatorminheight5000.woff");
}
math, math * {
font-family: TestFont;
font-size: 10px;
}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mathml/support/attribute-values.js"></script>
<script src="/mathml/support/fonts.js"></script>
<script>
setup({ explicit_done: true });
var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
var epsilon = 5;
function verify_displaystyle(elementId, displaystyle, description) {
var expectedSize = (displaystyle ? 5000 : 1000) * emToPx;
var elementSize = document.getElementById(elementId).
getBoundingClientRect().height;
assert_approx_equals(elementSize, expectedSize, epsilon, description);
}
window.addEventListener("load", () => { loadAllFonts().then(runTests); });
function runTests() {
for (transform in AttributeValueTransforms) {
TransformAttributeValues(transform, ["display", "displaystyle"]);
test(function() {
verify_displaystyle("cell_false", false, "cell with displaystyle false");
verify_displaystyle("cell_true", true, "cell with displaystyle true");
}, `mtable element (${transform})`);
test(function() {
verify_displaystyle("mfrac_numerator", true, "numerator");
verify_displaystyle("mfrac_denominator", true, "denominator");
}, `mfrac element (${transform})`);
test(function() {
verify_displaystyle("mroot_base", false, "base");
verify_displaystyle("mroot_index", true, "index");
}, `mroot element (${transform})`);
test(function() {
verify_displaystyle("msub_base", false, "base");
verify_displaystyle("msub_subscript", true, "subscript");
}, `msub element (${transform})`);
test(function() {
verify_displaystyle("msup_base", false, "base");
verify_displaystyle("msup_superscript", true, "superscript");
}, `msup element (${transform})`);
test(function() {
verify_displaystyle("msubsup_base", false, "base");
verify_displaystyle("msubsup_subscript", true, "subscript");
verify_displaystyle("msubsup_superscript", true, "superscript");
}, `msubsup element (${transform})`);
test(function() {
verify_displaystyle("munder_base", false, "base");
verify_displaystyle("munder_underscript", true, "underscript");
}, `munder element (${transform})`);
test(function() {
verify_displaystyle("mover_base", false, "base");
verify_displaystyle("mover_overscript", true, "overscript");
}, `mover element (${transform})`);
test(function() {
verify_displaystyle("munderover_base", false, "base");
verify_displaystyle("munderover_underscript", true, "underscript");
verify_displaystyle("munderover_overscript", true, "overscript");
}, `munderover element (${transform})`);
}
done();
}
</script>
</head>
<body>
<div id="log"></div>
<math displaystyle="true">
<mtable>
<mtr>
<mtd>
<mstyle displaystyle="false">
<mo id="cell_false">⫿</mo>
</mstyle>
</mtd>
<mtd>
<mstyle displaystyle="true">
<mo id="cell_true">⫿</mo>
</mstyle>
</mtd>
</mtr>
</mtable>
</math>
<math>
<mfrac>
<mstyle displaystyle="true">
<mo id="mfrac_numerator">⫿</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="mfrac_denominator">⫿</mo>
</mstyle>
</mfrac>
</math>
<math displaystyle="true">
<mroot>
<mstyle displaystyle="false">
<mo id="mroot_base">⫿</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="mroot_index">⫿</mo>
</mstyle>
</mroot>
</math>
<math displaystyle="true">
<msub>
<mstyle displaystyle="false">
<mo id="msub_base">⫿</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="msub_subscript">⫿</mo>
</mstyle>
</msub>
</math>
<math displaystyle="true">
<msup>
<mstyle displaystyle="false">
<mo id="msup_base">⫿</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="msup_superscript">⫿</mo>
</mstyle>
</msup>
</math>
<math displaystyle="true">
<msubsup>
<mstyle displaystyle="false">
<mo id="msubsup_base">⫿</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="msubsup_subscript">⫿</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="msubsup_superscript">⫿</mo>
</mstyle>
</msubsup>
</math>
<math displaystyle="true">
<mmultiscripts>
<mstyle displaystyle="false">
<mo id="mmultiscripts_base">⫿</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="mmultiscripts_subscript">⫿</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="mmultiscripts_superscript">⫿</mo>
</mstyle>
<mprescripts/>
<mstyle displaystyle="true">
<mo id="mmultiscripts_presubscript">⫿</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="mmultiscripts_presuperscript">⫿</mo>
</mstyle>
</mmultiscripts>
</math>
<math displaystyle="true">
<munder>
<mstyle displaystyle="false">
<mo id="munder_base">⫿</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="munder_underscript">⫿</mo>
</mstyle>
</munder>
</math>
<math displaystyle="true">
<mover>
<mstyle displaystyle="false">
<mo id="mover_base">⫿</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="mover_overscript">⫿</mo>
</mstyle>
</mover>
</math>
<math displaystyle="true">
<munderover>
<mstyle displaystyle="false">
<mo id="munderover_base">⫿</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="munderover_underscript">⫿</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="munderover_overscript">⫿</mo>
</mstyle>
</munderover>
</math>
</body>
</html>
|