File: size-and-position-of-stretchy-fences-with-default-font-001.html

package info (click to toggle)
firefox 143.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,617,328 kB
  • sloc: cpp: 7,478,492; javascript: 6,417,157; ansic: 3,720,058; python: 1,396,372; xml: 627,523; asm: 438,677; java: 186,156; sh: 63,477; makefile: 19,171; objc: 13,059; perl: 12,983; yacc: 4,583; cs: 3,846; pascal: 3,405; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 53; csh: 10
file content (115 lines) | stat: -rw-r--r-- 3,059 bytes parent folder | download | duplicates (11)
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
<!DOCTYPE html>
<meta charset="utf-8">
<title>Size of nested stretchy fences with inner mo</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=40066018">
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=40068339">
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=40856331">

<div id="log"></div>

<p>
  <math>
    <mrow>
      <mo id="left1">(</mo>
      <mrow>
        <mo>(</mo>
        <mrow>
          <mi>x</mi>
          <mo>+</mo>
          <mi>y</mi>
        </mrow>
        <mo>)</mo>
      </mrow>
      <mo id="right1">)</mo>
    </mrow>
  </math>
  <math>
    <mrow>
      <mo id="left2">(</mo>
      <mrow>
        <mo>(</mo>
        <mrow>
          <mi>x</mi>
        </mrow>
        <mo>)</mo>
      </mrow>
      <mo id="right2">)</mo>
    </mrow>
  </math>
</p>

<p>
  <math>
    <mn id="plus3">+</mn>
    <mrow>
      <mo id="left3" fence="true" form="prefix">(</mo>
      <mi>x</mi>
      <mo id="right3" fence="true" form="postfix">)</mo>
    </mrow>
  </math>
</p>

<p>
  <math display="block">
    <mrow>
      <mo id="left4" fence="false" symmetric="true" minsize="2.4em" maxsize="2.4em">(</mo>
      <mfrac>
        <msup>
          <mi>∂</mi>
          <mn>2</mn>
        </msup>
        <mrow>
          <mi>∂</mi>
          <msup>
            <mi>x</mi>
            <mn>2</mn>
          </msup>
        </mrow>
      </mfrac>
      <mo id="plus4">+</mo>
      <mfrac>
        <msup>
          <mi>∂</mi>
          <mn>2</mn>
        </msup>
        <mrow>
          <mi>∂</mi>
          <msup>
            <mi>y</mi>
            <mn>2</mn>
          </msup>
        </mrow>
      </mfrac>
      <mo id="right4" fence="false" symmetric="true" minsize="2.4em" maxsize="2.4em">)</mo>
    </mrow>
  </math>
</p>

<script>
  function getBox(id) {
      return document.getElementById(id).getBoundingClientRect();
  }
  function middleOf(id) {
      let box = getBox(id);
      return (box.top + box.bottom) / 2;
  }
  const epsilon = 2;

  test(t => {
      assert_approx_equals(getBox("left1").top, getBox("left2").top, epsilon);
      assert_approx_equals(getBox("left1").bottom, getBox("left2").bottom, epsilon);
      assert_approx_equals(getBox("right1").top, getBox("right2").top, epsilon);
      assert_approx_equals(getBox("right1").bottom, getBox("right2").bottom, epsilon);
  }, "Inner binary operator should not affect position and size of outer fences.");

  test(t => {
      const math_axis_3 = middleOf("plus3")
      assert_approx_equals(middleOf("left3"), math_axis_3, epsilon);
      assert_approx_equals(middleOf("right3"), math_axis_3, epsilon);
      const math_axis_4 = middleOf("plus4")
      assert_approx_equals(middleOf("left4"), math_axis_4, epsilon);
      assert_approx_equals(middleOf("right4"), math_axis_4, epsilon);
  }, "Fences are stretched symmetrically with respect to the math axis");
</script>