tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

size-and-position-of-stretchy-fences-with-default-font-001.html (3059B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Size of nested stretchy fences with inner mo</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=40066018">
      7 <link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=40068339">
      8 <link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=40856331">
      9 
     10 <div id="log"></div>
     11 
     12 <p>
     13  <math>
     14    <mrow>
     15      <mo id="left1">(</mo>
     16      <mrow>
     17        <mo>(</mo>
     18        <mrow>
     19          <mi>x</mi>
     20          <mo>+</mo>
     21          <mi>y</mi>
     22        </mrow>
     23        <mo>)</mo>
     24      </mrow>
     25      <mo id="right1">)</mo>
     26    </mrow>
     27  </math>
     28  <math>
     29    <mrow>
     30      <mo id="left2">(</mo>
     31      <mrow>
     32        <mo>(</mo>
     33        <mrow>
     34          <mi>x</mi>
     35        </mrow>
     36        <mo>)</mo>
     37      </mrow>
     38      <mo id="right2">)</mo>
     39    </mrow>
     40  </math>
     41 </p>
     42 
     43 <p>
     44  <math>
     45    <mn id="plus3">+</mn>
     46    <mrow>
     47      <mo id="left3" fence="true" form="prefix">(</mo>
     48      <mi>x</mi>
     49      <mo id="right3" fence="true" form="postfix">)</mo>
     50    </mrow>
     51  </math>
     52 </p>
     53 
     54 <p>
     55  <math display="block">
     56    <mrow>
     57      <mo id="left4" fence="false" symmetric="true" minsize="2.4em" maxsize="2.4em">(</mo>
     58      <mfrac>
     59        <msup>
     60          <mi></mi>
     61          <mn>2</mn>
     62        </msup>
     63        <mrow>
     64          <mi></mi>
     65          <msup>
     66            <mi>x</mi>
     67            <mn>2</mn>
     68          </msup>
     69        </mrow>
     70      </mfrac>
     71      <mo id="plus4">+</mo>
     72      <mfrac>
     73        <msup>
     74          <mi></mi>
     75          <mn>2</mn>
     76        </msup>
     77        <mrow>
     78          <mi></mi>
     79          <msup>
     80            <mi>y</mi>
     81            <mn>2</mn>
     82          </msup>
     83        </mrow>
     84      </mfrac>
     85      <mo id="right4" fence="false" symmetric="true" minsize="2.4em" maxsize="2.4em">)</mo>
     86    </mrow>
     87  </math>
     88 </p>
     89 
     90 <script>
     91  function getBox(id) {
     92      return document.getElementById(id).getBoundingClientRect();
     93  }
     94  function middleOf(id) {
     95      let box = getBox(id);
     96      return (box.top + box.bottom) / 2;
     97  }
     98  const epsilon = 2;
     99 
    100  test(t => {
    101      assert_approx_equals(getBox("left1").top, getBox("left2").top, epsilon);
    102      assert_approx_equals(getBox("left1").bottom, getBox("left2").bottom, epsilon);
    103      assert_approx_equals(getBox("right1").top, getBox("right2").top, epsilon);
    104      assert_approx_equals(getBox("right1").bottom, getBox("right2").bottom, epsilon);
    105  }, "Inner binary operator should not affect position and size of outer fences.");
    106 
    107  test(t => {
    108      const math_axis_3 = middleOf("plus3")
    109      assert_approx_equals(middleOf("left3"), math_axis_3, epsilon);
    110      assert_approx_equals(middleOf("right3"), math_axis_3, epsilon);
    111      const math_axis_4 = middleOf("plus4")
    112      assert_approx_equals(middleOf("left4"), math_axis_4, epsilon);
    113      assert_approx_equals(middleOf("right4"), math_axis_4, epsilon);
    114  }, "Fences are stretched symmetrically with respect to the math axis");
    115 </script>