Bug 1274796 - Support spaces in MathML namedspaces. r=fredw
☠☠ backed out by dd1492bae3eb ☠ ☠
authorJames Kitchener <jkitch.bug@gmail.com>
Sat, 21 May 2016 19:00:00 +0200
changeset 337785 607941762a739605634e780db410fdbec8c7651a
parent 337784 697e260a0fd86092dc62e9c876ad5e6e3b642774
child 337786 0b2a710d35e6d029e78efef10de305450e8697d8
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfredw
bugs1274796
milestone49.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 1274796 - Support spaces in MathML namedspaces. r=fredw
dom/mathml/nsMathMLElement.cpp
layout/mathml/imptests/fonts/xheight500.woff
layout/mathml/imptests/mochitest.ini
layout/mathml/imptests/test_lengths-3.html
--- a/dom/mathml/nsMathMLElement.cpp
+++ b/dom/mathml/nsMathMLElement.cpp
@@ -376,17 +376,17 @@ nsMathMLElement::ParseNumericValue(const
   int32_t stringLength = str.Length();
   if (!stringLength) {
     if (!(aFlags & PARSE_SUPPRESS_WARNINGS)) {
       ReportLengthParseError(aString, aDocument);
     }
     return false;
   }
 
-  if (ParseNamedSpaceValue(aString, aCSSValue, aFlags)) {
+  if (ParseNamedSpaceValue(str, aCSSValue, aFlags)) {
     return true;
   }
 
   nsAutoString number, unit;
 
   // see if the negative sign is there
   int32_t i = 0;
   char16_t c = str[0];
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..fe9f88893a640c872aeeca7b79dc1b7f4e01475b
GIT binary patch
literal 1044
zc$_QucXRU(3GruOU=d;9VgLd*1qMb2tiajLO@V=d8HgFq0PzheISmgtw-8^T*c%{U
z5{P9gAEcW22kRR#Ffe)m`3^vwAap}0EIBu^fPsPO0Fdtrl=EVE%-WEVnwSFQe*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X5wtzn{v#9$z`HTkp5=^G98c-xmYV-8jos
zba}s&*}iyFrMrvn-nF;db#qtc4u-G#?j?}0N?~X^t@P?=f)y~a_pmWoda-^4`k(m)
H1cLwo#37GQ
--- a/layout/mathml/imptests/mochitest.ini
+++ b/layout/mathml/imptests/mochitest.ini
@@ -7,16 +7,19 @@ support-files =
   fonts/fraction-denominatordisplaystyleshiftdown6000-rulethickness1000.woff
   fonts/fraction-denominatorgapmin4000-rulethickness1000.woff
   fonts/fraction-denominatorshiftdown3000-rulethickness1000.woff
   fonts/fraction-numeratordisplaystylegapmin8000-rulethickness1000.woff
   fonts/fraction-numeratordisplaystyleshiftup2000-rulethickness1000.woff
   fonts/fraction-numeratorgapmin9000-rulethickness1000.woff
   fonts/fraction-numeratorshiftup11000-rulethickness1000.woff
   fonts/fraction-rulethickness10000.woff
+[test_lengths-3.html]
+support-files =
+  fonts/xheight500.woff
 [test_stack-parameters.html]
 support-files =
   fonts/stack-axisheight7000.woff
   fonts/stack-bottomdisplaystyleshiftdown5000.woff
   fonts/stack-bottomshiftdown6000.woff
   fonts/stack-displaystylegapmin4000.woff
   fonts/stack-gapmin8000.woff
   fonts/stack-topdisplaystyleshiftup3000.woff
new file mode 100644
--- /dev/null
+++ b/layout/mathml/imptests/test_lengths-3.html
@@ -0,0 +1,158 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>MathML lengths</title>
+<link rel="help" href="http://www.mathml-association.org/MathMLinHTML5/S2.html#SS3.SSS1"/>
+<meta name="assert" content="Verify various cases of the MathML length syntax.">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+  @font-face {
+    font-family: TestFont;
+    src: url("fonts/xheight500.woff");
+  }
+  math {
+    font-family: TestFont;
+    font-size: 10px;
+  }
+</style>
+<script>
+  var epsilon = 1;
+
+  function getBox(aId) {
+    return document.getElementById(aId).getBoundingClientRect();
+  }
+
+  setup({ explicit_done: true });
+  window.addEventListener("load", function() {
+    document.fonts.ready.then(runTests);
+  });
+
+  function runTests() {
+    test(function() {
+      assert_approx_equals(getBox("unitCm").width, 96, epsilon, "cm");
+      assert_approx_equals(getBox("unitEm").width, 120, epsilon, "em");
+      assert_approx_equals(getBox("unitEx").width, 500, epsilon, "ex");
+      assert_approx_equals(getBox("unitIn").width, 288, epsilon, "in");
+      assert_approx_equals(getBox("unitNamed").width, 389, epsilon, "namedspace");
+      assert_approx_equals(getBox("unitMm").width, 576, epsilon, "mm");
+      assert_approx_equals(getBox("unitPc").width, 96, epsilon, "pc");
+      assert_approx_equals(getBox("unitPercentage").width, 60, epsilon, "%");
+      assert_approx_equals(getBox("unitPt").width, 96, epsilon, "pt");
+      assert_approx_equals(getBox("unitPx").width, 123, epsilon, "px");
+      assert_approx_equals(getBox("unitNone").width, 150, epsilon, "Unitless");
+    }, "Units");
+
+    test(function() {
+      assert_approx_equals(getBox("spaceCm").width, 96, epsilon, "cm");
+      assert_approx_equals(getBox("spaceEm").width, 120, epsilon, "em");
+      assert_approx_equals(getBox("spaceEx").width, 500, epsilon, "ex");
+      assert_approx_equals(getBox("spaceIn").width, 288, epsilon, "in");
+      assert_approx_equals(getBox("spaceNamed").width, 389, epsilon, "namedspace");
+      assert_approx_equals(getBox("spaceMm").width, 576, epsilon, "mm");
+      assert_approx_equals(getBox("spacePc").width, 96, epsilon, "pc");
+      assert_approx_equals(getBox("spacePercentage").width, 60, epsilon, "%");
+      assert_approx_equals(getBox("spacePt").width, 96, epsilon, "pt");
+      assert_approx_equals(getBox("spacePx").width, 123, epsilon, "px");
+      assert_approx_equals(getBox("spaceNone").width, 150, epsilon, "Unitless");
+    }, "Trimming of space");
+
+    test(function() {
+      assert_approx_equals(getBox("n0").width, 0, epsilon, "n0");
+      assert_approx_equals(getBox("n1").width, 90, epsilon, "n1");
+      assert_approx_equals(getBox("n2").width, 8, epsilon, "n2");
+      assert_approx_equals(getBox("n3").width, 70, epsilon, "n3");
+      assert_approx_equals(getBox("n4").width, 650, epsilon, "n4");
+      assert_approx_equals(getBox("n5").width, 4320, epsilon, "n5");
+      assert_approx_equals(getBox("n6").width, 1, epsilon, "n6");
+      assert_approx_equals(getBox("n7").width, 8, epsilon, "n7");
+      assert_approx_equals(getBox("n8").width, 65, epsilon, "n8");
+      assert_approx_equals(getBox("n9").width, 432, epsilon, "n9");
+      assert_approx_equals(getBox("n10").width, 123, epsilon, "n10");
+    }, "Non-negative numbers");
+
+    test(function() {
+      var topRef = getBox("ref").top;
+      assert_approx_equals(getBox("N0").top - topRef, -0, epsilon, "N0");
+      assert_approx_equals(topRef - getBox("N1").top, -90, epsilon, "N1");
+      assert_approx_equals(topRef - getBox("N2").top, -8, epsilon, "N2");
+      assert_approx_equals(topRef - getBox("N3").top, -70, epsilon, "N3");
+      assert_approx_equals(topRef - getBox("N4").top, -650, epsilon, "N4");
+      assert_approx_equals(topRef - getBox("N5").top, -4320, epsilon, "N5");
+      assert_approx_equals(topRef - getBox("N6").top, -1, epsilon, "N6");
+      assert_approx_equals(topRef - getBox("N7").top, -8, epsilon, "N7");
+      assert_approx_equals(topRef - getBox("N8").top, -65, epsilon, "N8");
+      assert_approx_equals(topRef - getBox("N9").top, -432, epsilon, "N9");
+      assert_approx_equals(topRef - getBox("N10").top, -123, epsilon, "N10");
+    }, "Non-positive numbers");
+
+    done();
+  }
+</script>
+</head>
+<body>
+  <p>
+    <math>
+      <mspace id="unitCm" width="2.54cm"/>
+      <mspace id="unitEm" width="12em"/>
+      <mspace id="unitEx" width="100ex"/>
+      <mspace id="unitIn" width="3in"/>
+      <mspace style="font-size: 1000px" id="unitNamed" width="veryverythickmathspace"/>
+      <mspace id="unitMm" width="152.4mm"/>
+      <mspace id="unitPc" width="6pc"/>
+      <mstyle mathsize="200%"><mspace id="unitPercentage" width="3em"/></mstyle>
+      <mspace id="unitPt" width="72pt"/>
+      <mspace id="unitPx" width="123px"/>
+      <mstyle mathsize="5"><mspace id="unitNone" width="3em"/></mstyle>
+    </math>
+  </p>
+  <p>
+    <math>
+      <mspace id="spaceCm" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;2.54cm&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+      <mspace id="spaceEm" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;12em&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+      <mspace id="spaceEx" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;100ex&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+      <mspace id="spaceIn" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;3in&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+      <mspace style="font-size: 1000px" id="spaceNamed" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;veryverythickmathspace&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+      <mspace id="spaceMm" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;152.4mm&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+      <mspace id="spacePc" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;6pc&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+      <mstyle mathsize="200%"><mspace id="spacePercentage" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;3em&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/></mstyle>
+      <mspace id="spacePt" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;72pt&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+      <mspace id="spacePx" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;123px&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+      <mstyle mathsize="5"><mspace id="spaceNone" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;3em&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/></mstyle>
+    </math>
+  </p>
+  <p>
+    <math>
+      <mspace id="n0" width="0em"/>
+      <mspace id="n1" width="9em"/>
+      <mspace id="n2" width=".8em"/>
+      <mspace id="n3" width="7.em"/>
+      <mspace id="n4" width="65em"/>
+      <mspace id="n5" width="432em"/>
+      <mspace id="n6" width=".10em"/>
+      <mspace id="n7" width=".789em"/>
+      <mspace id="n8" width="6.5em"/>
+      <mspace id="n9" width="43.21em"/>
+      <mspace id="n10" width="012.345em"/>
+    </math>
+  </p>
+  <p>
+    <math>
+      <mspace id="ref"></mspace>
+      <mpadded voffset="-0em"><mspace id="N0"/></mpadded>
+      <mpadded voffset="-9em"><mspace id="N1"/></mpadded>
+      <mpadded voffset="-.8em"><mspace id="N2"/></mpadded>
+      <mpadded voffset="-7.em"><mspace id="N3"/></mpadded>
+      <mpadded voffset="-65em"><mspace id="N4"/></mpadded>
+      <mpadded voffset="-432em"><mspace id="N5"/></mpadded>
+      <mpadded voffset="-.10em"><mspace id="N6"/></mpadded>
+      <mpadded voffset="-.789em"><mspace id="N7"/></mpadded>
+      <mpadded voffset="-6.5em"><mspace id="N8"/></mpadded>
+      <mpadded voffset="-43.21em"><mspace id="N9"/></mpadded>
+      <mpadded voffset="-012.345em"><mspace id="N10"/></mpadded>
+    </math>
+  </p>
+  <hr/>
+</body>
+</html>