Bug 1623846 [wpt PR 22349] - [mathml] Map displaystyle attribute using math-style, a=testonly
authorRob Buis <rbuis@igalia.com>
Fri, 27 Mar 2020 20:41:57 +0000
changeset 521280 727479e79954f3a75d65cc0a30604e04dafe0b32
parent 521279 8f13d23c6513f6f95cbebcf112ef24e365cb9e0c
child 521281 428ed412deeba3bfff53451a74339b07199636a8
push id37269
push useraiakab@mozilla.com
push dateTue, 31 Mar 2020 22:58:23 +0000
treeherdermozilla-central@9af589864188 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1623846, 22349, 1023296, 2105317, 752570
milestone76.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1623846 [wpt PR 22349] - [mathml] Map displaystyle attribute using math-style, a=testonly Automatic update from web-platform-tests [mathml] Map displaystyle attribute using math-style Map displaystyle attribute using math-style [1] as defined here [2]. Use the mapped internal math-style value for laying out fractions, i.e. pick the relevant metrics based on the math-style. [1] https://mathml-refresh.github.io/mathml-core/#the-math-style-property [2] https://mathml-refresh.github.io/mathml-core/#dfn-displaystyle Bug: 1023296 Change-Id: Ie12eb43275c5ca773c8f824e1f4c1a0f9f232b85 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2105317 Reviewed-by: Morten Stenshorne <mstensho@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Reviewed-by: Frédéric Wang <fwang@igalia.com> Commit-Queue: Rob Buis <rbuis@igalia.com> Cr-Commit-Position: refs/heads/master@{#752570} -- wpt-commits: ff239e259fa7a403064bbc9a1b4e51950268ba1f wpt-pr: 22349
testing/web-platform/tests/mathml/presentation-markup/fractions/frac-parameters-1.html
testing/web-platform/tests/mathml/presentation-markup/fractions/frac-parameters-2.html
--- a/testing/web-platform/tests/mathml/presentation-markup/fractions/frac-parameters-1.html
+++ b/testing/web-platform/tests/mathml/presentation-markup/fractions/frac-parameters-1.html
@@ -88,31 +88,71 @@
       var v1 = 6000 * emToPx;
       assert_approx_equals(getBox("den0003").top - getBox("ref0003").bottom,
                            v1, epsilon, "mfrac: denominator shift");
     }, "DenominatorDisplayStyleShiftDown");
 
     test(function() {
       assert_true(MathMLFeatureDetection.has_mspace());
 
+      var v1 = 5000 * emToPx;
+      assert_approx_equals(getBox("den0002b").top - getBox("ref0002b").bottom,
+                           v1, epsilon, "mfrac: denominator gap");
+    }, "DenominatorDisplayStyleGapMin Displaystyle");
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
+      var v1 = 6000 * emToPx;
+      assert_approx_equals(getBox("den0003b").top - getBox("ref0003b").bottom,
+                           v1, epsilon, "mfrac: denominator shift");
+    }, "DenominatorDisplayStyleShiftDown Displaystyle");
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
+      var v1 = 5000 * emToPx;
+      assert_approx_equals(getBox("den0002c").top - getBox("ref0002c").bottom,
+                           v1, epsilon, "mfrac: denominator gap");
+    }, "DenominatorDisplayStyleGapMin Displaystyle on fraction");
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
+      var v1 = 6000 * emToPx;
+      assert_approx_equals(getBox("den0003c").top - getBox("ref0003c").bottom,
+                           v1, epsilon, "mfrac: denominator shift");
+    }, "DenominatorDisplayStyleShiftDown Displaystyle on fraction");
+
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
       var v1 = 4000 * emToPx;
       assert_approx_equals(getBox("den0004").top - getBox("ref0004").bottom,
                            v1, epsilon, "mfrac: denominator gap");
     }, "DenominatorGapMin");
 
     test(function() {
       assert_true(MathMLFeatureDetection.has_mspace());
 
       var v1 = 3000 * emToPx;
       assert_approx_equals(getBox("den0005").top - getBox("ref0005").bottom,
                            v1, epsilon, "mfrac: denominator shift");
     }, "DenominatorShiftDown");
 
     test(function() {
       assert_true(MathMLFeatureDetection.has_mspace());
+      var v1 = 4000 * emToPx;
+      assert_approx_equals(getBox("den0004b").top - getBox("ref0004b").bottom,
+                           v1, epsilon, "mfrac: denominator gap");
+    }, "DenominatorGapMin Displaystyle on fraction");
+
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
+
+      var v1 = 3000 * emToPx;
+      assert_approx_equals(getBox("den0005b").top - getBox("ref0005b").bottom,
+                           v1, epsilon, "mfrac: denominator shift");
+    }, "DenominatorShiftDown Displaystyle on fraction");
+
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
 
       var v1 = 8000 * emToPx;
       assert_approx_equals(getBox("ref0006").top - getBox("num0006").bottom,
                            v1, epsilon, "mfrac: numerator gap");
     }, "NumeratorDisplayStyleGapMin");
 
     test(function() {
       assert_true(MathMLFeatureDetection.has_mspace());
@@ -120,16 +160,48 @@
       var v1 = 2000 * emToPx;
       assert_approx_equals(getBox("ref0007").top - getBox("num0007").bottom,
                            v1, epsilon, "mfrac: numerator shift");
     }, "NumeratorDisplayStyleShiftDown");
 
     test(function() {
       assert_true(MathMLFeatureDetection.has_mspace());
 
+      var v1 = 8000 * emToPx;
+      assert_approx_equals(getBox("ref0006b").top - getBox("num0006b").bottom,
+                           v1, epsilon, "mfrac: numerator gap");
+    }, "NumeratorDisplayStyleGapMin Displaystyle");
+
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
+
+      var v1 = 2000 * emToPx;
+      assert_approx_equals(getBox("ref0007b").top - getBox("num0007b").bottom,
+                           v1, epsilon, "mfrac: numerator shift");
+    }, "NumeratorDisplayStyleShiftDown Displaystyle");
+
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
+
+      var v1 = 8000 * emToPx;
+      assert_approx_equals(getBox("ref0006c").top - getBox("num0006c").bottom,
+                           v1, epsilon, "mfrac: numerator gap");
+    }, "NumeratorDisplayStyleGapMin Displaystyle on fraction");
+
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
+
+      var v1 = 2000 * emToPx;
+      assert_approx_equals(getBox("ref0007c").top - getBox("num0007c").bottom,
+                           v1, epsilon, "mfrac: numerator shift");
+    }, "NumeratorDisplayStyleShiftDown Displaystyle on fraction");
+
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
+
       var v1 = 9000 * emToPx;
       assert_approx_equals(getBox("ref0008").top - getBox("num0008").bottom,
                            v1, epsilon, "mfrac: numerator gap");
     }, "NumeratorGapMin");
 
     test(function() {
       assert_true(MathMLFeatureDetection.has_mspace());
 
@@ -179,16 +251,58 @@
       <mfrac>
         <mspace width="3em"/>
         <mspace width="3em" depth="1em" id="den0003" style="background: blue"/>
       </mfrac>
     </math>
   </p>
   <hr/>
   <p>
+    <math displaystyle="true" style="font-family: denominatordisplaystylegapmin5000-rulethickness1000;">
+      <mspace id="ref0002b" width="3em"
+              height=".5em" depth=".5em" style="background: green"/>
+      <mfrac>
+        <mspace width="3em"/>
+        <mspace width="3em" height="1em" id="den0002b" style="background: blue"/>
+      </mfrac>
+    </math>
+  </p>
+  <hr/>
+  <p>
+    <math displaystyle="true" style="font-family: denominatordisplaystyleshiftdown6000-axisheight1000-rulethickness1000;">
+      <mspace id="ref0003b" width="3em" height="1em" style="background: green"/>
+      <mfrac>
+        <mspace width="3em"/>
+        <mspace width="3em" depth="1em" id="den0003b" style="background: blue"/>
+      </mfrac>
+    </math>
+  </p>
+  <hr/>
+  <p>
+    <math style="font-family: denominatordisplaystylegapmin5000-rulethickness1000;">
+      <mspace id="ref0002c" width="3em"
+              height=".5em" depth=".5em" style="background: green"/>
+      <mfrac displaystyle="true">
+        <mspace width="3em"/>
+        <mspace width="3em" height="1em" id="den0002c" style="background: blue"/>
+      </mfrac>
+    </math>
+  </p>
+  <hr/>
+  <p>
+    <math style="font-family: denominatordisplaystyleshiftdown6000-axisheight1000-rulethickness1000;">
+      <mspace id="ref0003c" width="3em" height="1em" style="background: green"/>
+      <mfrac displaystyle="true">
+        <mspace width="3em"/>
+        <mspace width="3em" depth="1em" id="den0003c" style="background: blue"/>
+      </mfrac>
+    </math>
+  </p>
+  <hr/>
+  <p>
     <math style="font-family: denominatorgapmin4000-rulethickness1000;">
       <mspace id="ref0004" width="3em"
               height=".5em" depth=".5em" style="background: green"/>
       <mfrac>
         <mspace width="3em"/>
         <mspace width="3em" height="1em" id="den0004" style="background: blue"/>
       </mfrac>
     </math>
@@ -200,16 +314,37 @@
       <mfrac>
         <mspace width="3em"/>
         <mspace width="3em" depth="1em" id="den0005" style="background: blue"/>
       </mfrac>
     </math>
   </p>
   <hr/>
   <p>
+    <math displaystyle="true" style="font-family: denominatorgapmin4000-rulethickness1000;">
+      <mspace id="ref0004b" width="3em"
+              height=".5em" depth=".5em" style="background: green"/>
+      <mfrac displaystyle="false">
+        <mspace width="3em"/>
+        <mspace width="3em" height="1em" id="den0004b" style="background: blue"/>
+      </mfrac>
+    </math>
+  </p>
+  <hr/>
+  <p>
+    <math displaystyle="true" style="font-family: denominatorshiftdown3000-axisheight1000-rulethickness1000;">
+      <mspace id="ref0005b" width="3em" height="1em" style="background: green"/>
+      <mfrac displaystyle="false">
+        <mspace width="3em"/>
+        <mspace width="3em" depth="1em" id="den0005b" style="background: blue"/>
+      </mfrac>
+    </math>
+  </p>
+  <hr/>
+  <p>
     <math display="block" style="font-family: numeratordisplaystylegapmin8000-rulethickness1000;">
       <mspace id="ref0006" width="3em"
               height=".5em" depth=".5em" style="background: green"/>
       <mfrac>
         <mspace width="3em" depth="1em" id="num0006" style="background: blue"/>
         <mspace width="3em"/>
       </mfrac>
     </math>
@@ -222,16 +357,60 @@
       <mfrac>
         <mspace width="3em" height="1em" id="num0007" style="background: blue"/>
         <mspace width="3em"/>
       </mfrac>
     </math>
   </p>
   <hr/>
   <p>
+    <math displaystyle="true" style="font-family: numeratordisplaystylegapmin8000-rulethickness1000;">
+      <mspace id="ref0006b" width="3em"
+              height=".5em" depth=".5em" style="background: green"/>
+      <mfrac>
+        <mspace width="3em" depth="1em" id="num0006b" style="background: blue"/>
+        <mspace width="3em"/>
+      </mfrac>
+    </math>
+  </p>
+  <hr/>
+  <p>
+    <math displaystyle="true" style="font-family: numeratordisplaystyleshiftup2000-axisheight1000-rulethickness1000;">
+      <mspace id="ref0007b" width="3em"
+              depth="1em" style="background: green"/>
+      <mfrac>
+        <mspace width="3em" height="1em" id="num0007b" style="background: blue"/>
+        <mspace width="3em"/>
+      </mfrac>
+    </math>
+  </p>
+  <hr/>
+  <p>
+    <math style="font-family: numeratordisplaystylegapmin8000-rulethickness1000;">
+      <mspace id="ref0006c" width="3em"
+              height=".5em" depth=".5em" style="background: green"/>
+      <mfrac displaystyle="true">
+        <mspace width="3em" depth="1em" id="num0006c" style="background: blue"/>
+        <mspace width="3em"/>
+      </mfrac>
+    </math>
+  </p>
+  <hr/>
+  <p>
+    <math style="font-family: numeratordisplaystyleshiftup2000-axisheight1000-rulethickness1000;">
+      <mspace id="ref0007c" width="3em"
+              depth="1em" style="background: green"/>
+      <mfrac displaystyle="true">
+        <mspace width="3em" height="1em" id="num0007c" style="background: blue"/>
+        <mspace width="3em"/>
+      </mfrac>
+    </math>
+  </p>
+  <hr/>
+  <p>
     <math style="font-family: numeratorgapmin9000-rulethickness1000;">
       <mspace id="ref0008" width="3em"
               height=".5em" depth=".5em" style="background: green"/>
       <mfrac>
         <mspace width="3em" depth="1em" id="num0008" style="background: blue"/>
         <mspace width="3em"/>
       </mfrac>
     </math>
--- a/testing/web-platform/tests/mathml/presentation-markup/fractions/frac-parameters-2.html
+++ b/testing/web-platform/tests/mathml/presentation-markup/fractions/frac-parameters-2.html
@@ -56,53 +56,109 @@
       var v = 5000 * emToPx;
       assert_approx_equals(getBox("den0002").top - getBox("ref0002").bottom,
                            v, epsilon, "mfrac: denominator shift");
     }, "BottomDisplayStyleShiftDown");
 
     test(function() {
       assert_true(MathMLFeatureDetection.has_mspace());
 
+      var v = 5000 * emToPx;
+      assert_approx_equals(getBox("den0002b").top - getBox("ref0002b").bottom,
+                           v, epsilon, "mfrac: denominator shift");
+    }, "BottomDisplayStyleShiftDown Displaystyle");
+
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
+
+      var v = 5000 * emToPx;
+      assert_approx_equals(getBox("den0002c").top - getBox("ref0002c").bottom,
+                           v, epsilon, "mfrac: denominator shift");
+    }, "BottomDisplayStyleShiftDown Displaystyle om fraction");
+
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
+
       var v = 6000 * emToPx;
       assert_approx_equals(getBox("den0003").top - getBox("ref0003").bottom,
                            v, epsilon, "mfrac: denominator shift");
     }, "BottomShiftDown");
 
     test(function() {
       assert_true(MathMLFeatureDetection.has_mspace());
 
       var v = 4000 * emToPx;
       assert_approx_equals(getBox("den0004").top - getBox("num0004").bottom,
                            v, epsilon, "mfrac: gap");
     }, "DisplayStyleGapMin");
 
     test(function() {
       assert_true(MathMLFeatureDetection.has_mspace());
 
+      var v = 4000 * emToPx;
+      assert_approx_equals(getBox("den0004b").top - getBox("num0004b").bottom,
+                           v, epsilon, "mfrac: gap");
+    }, "DisplayStyleGapMin Dsiplaystyle");
+
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
+
+      var v = 4000 * emToPx;
+      assert_approx_equals(getBox("den0004c").top - getBox("num0004c").bottom,
+                           v, epsilon, "mfrac: gap");
+    }, "DisplayStyleGapMin Dsiplaystyle on fraction");
+
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
+
       var v = 8000 * emToPx;
       assert_approx_equals(getBox("den0005").top - getBox("num0005").bottom,
                            v, epsilon, "mfrac: gap");
     }, "GapMin");
 
     test(function() {
       assert_true(MathMLFeatureDetection.has_mspace());
 
       var v = 3000 * emToPx;
       assert_approx_equals(getBox("ref0006").top - getBox("num0006").bottom,
                            v, epsilon, "mfrac: numerator shift");
     }, "TopDisplayStyleShiftUp");
 
     test(function() {
       assert_true(MathMLFeatureDetection.has_mspace());
 
+      var v = 3000 * emToPx;
+      assert_approx_equals(getBox("ref0006b").top - getBox("num0006b").bottom,
+                           v, epsilon, "mfrac: numerator shift");
+    }, "TopDisplayStyleShiftUp Displaystyle");
+
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
+
+      var v = 3000 * emToPx;
+      assert_approx_equals(getBox("ref0006c").top - getBox("num0006c").bottom,
+                           v, epsilon, "mfrac: numerator shift");
+    }, "TopDisplayStyleShiftUp Displaystyle on fraction");
+
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
+
       var v = 9000 * emToPx;
       assert_approx_equals(getBox("ref0007").top - getBox("num0007").bottom,
                            v, epsilon, "mfrac: numerator shift");
     }, "ToShiftUp");
 
+    test(function() {
+      assert_true(MathMLFeatureDetection.has_mspace());
+
+      var v = 9000 * emToPx;
+      assert_approx_equals(getBox("ref0007b").top - getBox("num0007b").bottom,
+                           v, epsilon, "mfrac: numerator shift");
+    }, "ToShiftUp with Displaystyle on fraction");
+
     done();
   }
 </script>
 </head>
 <body>
   <div id="log"></div>
   <p>
     <math display="block" style="font-family: bottomdisplaystyleshiftdown5000-axisheight1000;">
@@ -110,16 +166,36 @@
       <mfrac linethickness="0px">
         <mspace width="3em"/>
         <mspace width="3em" depth="1em" id="den0002" style="background: blue"/>
       </mfrac>
     </math>
   </p>
   <hr/>
   <p>
+    <math displaystyle="true" style="font-family: bottomdisplaystyleshiftdown5000-axisheight1000;">
+      <mspace id="ref0002b" width="3em" height="1em" style="background: green"/>
+      <mfrac linethickness="0px">
+        <mspace width="3em"/>
+        <mspace width="3em" depth="1em" id="den0002b" style="background: blue"/>
+      </mfrac>
+    </math>
+  </p>
+  <hr/>
+  <p>
+    <math style="font-family: bottomdisplaystyleshiftdown5000-axisheight1000;">
+      <mspace id="ref0002c" width="3em" height="1em" style="background: green"/>
+      <mfrac displaystyle="true" linethickness="0px">
+        <mspace width="3em"/>
+        <mspace width="3em" depth="1em" id="den0002c" style="background: blue"/>
+      </mfrac>
+    </math>
+  </p>
+  <hr/>
+  <p>
     <math style="font-family: bottomshiftdown6000-axisheight1000;">
       <mspace id="ref0003" width="3em" height="1em" style="background: green"/>
       <mfrac linethickness="0px">
         <mspace width="3em"/>
         <mspace width="3em" depth="1em" id="den0003" style="background: blue"/>
       </mfrac>
     </math>
   </p>
@@ -129,16 +205,34 @@
       <mfrac linethickness="0px">
         <mspace width="3em" height="1em" id="num0004" style="background: blue"/>
         <mspace width="3em" depth="1em" id="den0004" style="background: green"/>
       </mfrac>
     </math>
   </p>
   <hr/>
   <p>
+    <math displaystyle="true" style="font-family: displaystylegapmin4000;">
+      <mfrac linethickness="0px">
+        <mspace width="3em" height="1em" id="num0004b" style="background: blue"/>
+        <mspace width="3em" depth="1em" id="den0004b" style="background: green"/>
+      </mfrac>
+    </math>
+  </p>
+  <hr/>
+  <p>
+    <math style="font-family: displaystylegapmin4000;">
+      <mfrac displaystyle="true" linethickness="0px">
+        <mspace width="3em" height="1em" id="num0004c" style="background: blue"/>
+        <mspace width="3em" depth="1em" id="den0004c" style="background: green"/>
+      </mfrac>
+    </math>
+  </p>
+  <hr/>
+  <p>
     <math style="font-family: gapmin8000;">
       <mfrac linethickness="0px">
         <mspace width="3em" height="1em" id="num0005" style="background: blue"/>
         <mspace width="3em" depth="1em" id="den0005" style="background: green"/>
       </mfrac>
     </math>
   </p>
   <hr/>
@@ -148,18 +242,48 @@
       <mfrac linethickness="0px">
         <mspace width="3em" height="1em" id="num0006" style="background: blue"/>
         <mspace width="3em"/>
       </mfrac>
     </math>
   </p>
   <hr/>
   <p>
+    <math displaystyle="true" style="font-family: topdisplaystyleshiftup3000-axisheight1000;">
+      <mspace id="ref0006b" width="3em" depth="1em" style="background: green"/>
+      <mfrac linethickness="0px">
+        <mspace width="3em" height="1em" id="num0006b" style="background: blue"/>
+        <mspace width="3em"/>
+      </mfrac>
+    </math>
+  </p>
+  <hr/>
+  <p>
+    <math style="font-family: topdisplaystyleshiftup3000-axisheight1000;">
+      <mspace id="ref0006c" width="3em" depth="1em" style="background: green"/>
+      <mfrac displaystyle="true" linethickness="0px">
+        <mspace width="3em" height="1em" id="num0006c" style="background: blue"/>
+        <mspace width="3em"/>
+      </mfrac>
+    </math>
+  </p>
+  <hr/>
+  <p>
     <math style="font-family: topshiftup9000-axisheight1000;">
       <mspace id="ref0007" width="3em" depth="1em" style="background: green"/>
       <mfrac linethickness="0px">
         <mspace width="3em" height="1em" id="num0007" style="background: blue"/>
         <mspace width="3em"/>
       </mfrac>
     </math>
   </p>
+  <hr/>
+  <p>
+    <math displaystyle="true" style="font-family: topshiftup9000-axisheight1000;">
+      <mspace id="ref0007b" width="3em" depth="1em" style="background: green"/>
+      <mfrac displaystyle="false" linethickness="0px">
+        <mspace width="3em" height="1em" id="num0007b" style="background: blue"/>
+        <mspace width="3em"/>
+      </mfrac>
+    </math>
+  </p>
 </body>
 </html>