<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[203106] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/203106">203106</a></dd>
<dt>Author</dt> <dd>fred.wang@free.fr</dd>
<dt>Date</dt> <dd>2016-07-11 21:47:02 -0700 (Mon, 11 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Create a MathMLLength struct to handle the parsing of MathML length.
https://bugs.webkit.org/show_bug.cgi?id=156792

Patch by Frederic Wang &lt;fwang@igalia.org&gt; on 2016-07-11
Reviewed by Brent Fulgham.

We introduce a structure for MathML lengths that will be used in the future to store the
parsed values in the MathElement class. We also rewrite the parsing function for MathML
lengths in order to improve efficiency and code reuse. This function is moved into the
MathElement class and only the conversion to LayoutUnit remains in the renderer classes.

No new tests, already covered by existing tests.

* mathml/MathMLElement.cpp:
(WebCore::parseNamedSpace): Helper function to parse a named space.
(WebCore::MathMLElement::parseMathMLLength): Parsing function for MathML lengths.
* mathml/MathMLElement.h: Declare new function and structure to handle MathML lengths.
* rendering/mathml/RenderMathMLBlock.cpp:
(WebCore::toUserUnits): Helper function to resolve a MathML length.
(WebCore::parseMathMLLength): Remove the old parsing code and just use MathMLElement::parseMathMLLength and toUserUnits instead.
(WebCore::parseMathMLNamedSpace): Deleted.
* rendering/mathml/RenderMathMLBlock.h: Remove unused function.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLElementcpp">trunk/Source/WebCore/mathml/MathMLElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLElementh">trunk/Source/WebCore/mathml/MathMLElement.h</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLBlockcpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLBlockh">trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (203105 => 203106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-07-12 04:34:25 UTC (rev 203105)
+++ trunk/Source/WebCore/ChangeLog        2016-07-12 04:47:02 UTC (rev 203106)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2016-07-11  Frederic Wang  &lt;fwang@igalia.org&gt;
+
+        Create a MathMLLength struct to handle the parsing of MathML length.
+        https://bugs.webkit.org/show_bug.cgi?id=156792
+
+        Reviewed by Brent Fulgham.
+
+        We introduce a structure for MathML lengths that will be used in the future to store the
+        parsed values in the MathElement class. We also rewrite the parsing function for MathML
+        lengths in order to improve efficiency and code reuse. This function is moved into the
+        MathElement class and only the conversion to LayoutUnit remains in the renderer classes.
+
+        No new tests, already covered by existing tests.
+
+        * mathml/MathMLElement.cpp:
+        (WebCore::parseNamedSpace): Helper function to parse a named space.
+        (WebCore::MathMLElement::parseMathMLLength): Parsing function for MathML lengths.
+        * mathml/MathMLElement.h: Declare new function and structure to handle MathML lengths.
+        * rendering/mathml/RenderMathMLBlock.cpp:
+        (WebCore::toUserUnits): Helper function to resolve a MathML length.
+        (WebCore::parseMathMLLength): Remove the old parsing code and just use MathMLElement::parseMathMLLength and toUserUnits instead.
+        (WebCore::parseMathMLNamedSpace): Deleted.
+        * rendering/mathml/RenderMathMLBlock.h: Remove unused function.
+
</ins><span class="cx"> 2016-07-11  Frederic Wang  &lt;fwang@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add support for @href attribute in MathML
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLElement.cpp (203105 => 203106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLElement.cpp        2016-07-12 04:34:25 UTC (rev 203105)
+++ trunk/Source/WebCore/mathml/MathMLElement.cpp        2016-07-12 04:47:02 UTC (rev 203106)
</span><span class="lines">@@ -397,6 +397,125 @@
</span><span class="cx">     return Element::tabIndex();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline StringView skipLeadingAndTrailingWhitespace(const String&amp; string)
+{
+    unsigned start = 0, stringLength = string.length();
+    while (stringLength &gt; 0 &amp;&amp; isHTMLSpace(string[start])) {
+        start++;
+        stringLength--;
+    }
+    while (stringLength &gt; 0 &amp;&amp; isHTMLSpace(string[start + stringLength - 1]))
+        stringLength--;
+    return string.substring(start, stringLength);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+MathMLElement::Length MathMLElement::parseNumberAndUnit(const StringView&amp; string)
+{
+    LengthType lengthType = LengthType::UnitLess;
+    unsigned stringLength = string.length();
+    UChar lastChar = string[stringLength - 1];
+    if (lastChar == '%') {
+        lengthType = LengthType::Percentage;
+        stringLength--;
+    } else if (stringLength &gt;= 2) {
+        UChar penultimateChar = string[stringLength - 2];
+        if (penultimateChar == 'c' &amp;&amp; lastChar == 'm')
+            lengthType = LengthType::Cm;
+        if (penultimateChar == 'e' &amp;&amp; lastChar == 'm')
+            lengthType = LengthType::Em;
+        else if (penultimateChar == 'e' &amp;&amp; lastChar == 'x')
+            lengthType = LengthType::Ex;
+        else if (penultimateChar == 'i' &amp;&amp; lastChar == 'n')
+            lengthType = LengthType::In;
+        else if (penultimateChar == 'm' &amp;&amp; lastChar == 'm')
+            lengthType = LengthType::Mm;
+        else if (penultimateChar == 'p' &amp;&amp; lastChar == 'c')
+            lengthType = LengthType::Pc;
+        else if (penultimateChar == 'p' &amp;&amp; lastChar == 't')
+            lengthType = LengthType::Pt;
+        else if (penultimateChar == 'p' &amp;&amp; lastChar == 'x')
+            lengthType = LengthType::Px;
+
+        if (lengthType != LengthType::UnitLess)
+            stringLength -= 2;
+    }
+
+    bool ok;
+    float lengthValue = string.substring(0, stringLength).toFloat(ok);
+    if (!ok)
+        return Length();
+
+    Length length;
+    length.type = lengthType;
+    length.value = lengthValue;
+    return length;
+}
+
+MathMLElement::Length MathMLElement::parseNamedSpace(const StringView&amp; string)
+{
+    // Named space values are case-sensitive.
+    int namedSpaceValue;
+    if (string == &quot;veryverythinmathspace&quot;)
+        namedSpaceValue = 1;
+    else if (string == &quot;verythinmathspace&quot;)
+        namedSpaceValue = 2;
+    else if (string == &quot;thinmathspace&quot;)
+        namedSpaceValue = 3;
+    else if (string == &quot;mediummathspace&quot;)
+        namedSpaceValue = 4;
+    else if (string == &quot;thickmathspace&quot;)
+        namedSpaceValue = 5;
+    else if (string == &quot;verythickmathspace&quot;)
+        namedSpaceValue = 6;
+    else if (string == &quot;veryverythickmathspace&quot;)
+        namedSpaceValue = 7;
+    else if (string == &quot;negativeveryverythinmathspace&quot;)
+        namedSpaceValue = -1;
+    else if (string == &quot;negativeverythinmathspace&quot;)
+        namedSpaceValue = -2;
+    else if (string == &quot;negativethinmathspace&quot;)
+        namedSpaceValue = -3;
+    else if (string == &quot;negativemediummathspace&quot;)
+        namedSpaceValue = -4;
+    else if (string == &quot;negativethickmathspace&quot;)
+        namedSpaceValue = -5;
+    else if (string == &quot;negativeverythickmathspace&quot;)
+        namedSpaceValue = -6;
+    else if (string == &quot;negativeveryverythickmathspace&quot;)
+        namedSpaceValue = -7;
+    else
+        return Length();
+
+    Length length;
+    length.type = LengthType::MathUnit;
+    length.value = namedSpaceValue;
+    return length;
+}
+
+MathMLElement::Length MathMLElement::parseMathMLLength(const String&amp; string)
+{
+    // The regular expression from the MathML Relax NG schema is as follows:
+    //
+    //   pattern = '\s*((-?[0-9]*([0-9]\.?|\.[0-9])[0-9]*(e[mx]|in|cm|mm|p[xtc]|%)?)|(negative)?((very){0,2}thi(n|ck)|medium)mathspace)\s*'
+    //
+    // We do not perform a strict verification of the syntax of whitespaces and number.
+    // Instead, we just use isHTMLSpace and toFloat to parse these parts.
+
+    // We first skip whitespace from both ends of the string.
+    StringView stringView = skipLeadingAndTrailingWhitespace(string);
+
+    if (stringView.isEmpty())
+        return Length();
+
+    // We consider the most typical case: a number followed by an optional unit.
+    UChar firstChar = stringView[0];
+    if (isASCIIDigit(firstChar) || firstChar == '-' || firstChar == '.')
+        return parseNumberAndUnit(stringView);
+
+    // Otherwise, we try and parse a named space.
+    return parseNamedSpace(stringView);
+}
+
+}
+
</ins><span class="cx"> #endif // ENABLE(MATHML)
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLElement.h (203105 => 203106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLElement.h        2016-07-12 04:34:25 UTC (rev 203105)
+++ trunk/Source/WebCore/mathml/MathMLElement.h        2016-07-12 04:47:02 UTC (rev 203106)
</span><span class="lines">@@ -56,6 +56,16 @@
</span><span class="cx"> 
</span><span class="cx">     bool hasTagName(const MathMLQualifiedName&amp; name) const { return hasLocalName(name.localName()); }
</span><span class="cx"> 
</span><ins>+    // MathML lengths (https://www.w3.org/TR/MathML3/chapter2.html#fund.units)
+    // TeX's Math Unit is used internally for named spaces (1 mu = 1/18 em).
+    // Unitless values are interpreted as a multiple of a reference value.
+    enum class LengthType { Cm, Em, Ex, In, MathUnit, Mm, ParsingFailed, Pc, Percentage, Pt, Px, UnitLess };
+    struct Length {
+        LengthType type { LengthType::ParsingFailed };
+        float value { 0 };
+    };
+    static Length parseMathMLLength(const String&amp;);
+
</ins><span class="cx"> protected:
</span><span class="cx">     MathMLElement(const QualifiedName&amp; tagName, Document&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -74,6 +84,8 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     virtual void updateSelectedChild() { }
</span><ins>+    static Length parseNumberAndUnit(const StringView&amp;);
+    static Length parseNamedSpace(const StringView&amp;);
</ins><span class="cx"> 
</span><span class="cx">     bool canStartSelection() const final;
</span><span class="cx">     bool isFocusable() const final;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp (203105 => 203106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp        2016-07-12 04:34:25 UTC (rev 203105)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp        2016-07-12 04:47:02 UTC (rev 203106)
</span><span class="lines">@@ -30,11 +30,12 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;RenderMathMLBlock.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;CSSHelper.h&quot;
</ins><span class="cx"> #include &quot;GraphicsContext.h&quot;
</span><span class="cx"> #include &quot;LayoutRepainter.h&quot;
</span><ins>+#include &quot;MathMLElement.h&quot;
</ins><span class="cx"> #include &quot;MathMLNames.h&quot;
</span><span class="cx"> #include &quot;RenderView.h&quot;
</span><del>-#include &lt;wtf/text/StringBuilder.h&gt;
</del><span class="cx"> 
</span><span class="cx"> #if ENABLE(DEBUG_MATH_LAYOUT)
</span><span class="cx"> #include &quot;PaintInfo.h&quot;
</span><span class="lines">@@ -137,179 +138,54 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // ENABLE(DEBUG_MATH_LAYOUT)
</span><span class="cx"> 
</span><del>-//
-// The MathML specification says:
-// (http://www.w3.org/TR/MathML/chapter2.html#fund.units)
-//
-// &quot;Most presentation elements have attributes that accept values representing
-// lengths to be used for size, spacing or similar properties. The syntax of a
-// length is specified as
-//
-// number | number unit | namedspace
-//
-// There should be no space between the number and the unit of a length.&quot;
-//
-// &quot;A trailing '%' represents a percent of the default value. The default
-// value, or how it is obtained, is listed in the table of attributes for each
-// element. [...] A number without a unit is intepreted as a multiple of the
-// default value.&quot;
-//
-// &quot;The possible units in MathML are:
-//
-// Unit Description
-// em   an em (font-relative unit traditionally used for horizontal lengths)
-// ex   an ex (font-relative unit traditionally used for vertical lengths)
-// px   pixels, or size of a pixel in the current display
-// in   inches (1 inch = 2.54 centimeters)
-// cm   centimeters
-// mm   millimeters
-// pt   points (1 point = 1/72 inch)
-// pc   picas (1 pica = 12 points)
-// %    percentage of default value&quot;
-//
-// The numbers are defined that way:
-// - unsigned-number: &quot;a string of decimal digits with up to one decimal point
-//   (U+002E), representing a non-negative terminating decimal number (a type of
-//   rational number)&quot;
-// - number: &quot;an optional prefix of '-' (U+002D), followed by an unsigned
-//   number, representing a terminating decimal number (a type of rational
-//   number)&quot;
-//
</del><ins>+LayoutUnit toUserUnits(const MathMLElement::Length&amp; length, const RenderStyle&amp; style, const LayoutUnit&amp; referenceValue)
+{
+    switch (length.type) {
+    case MathMLElement::LengthType::Cm:
+        return length.value * cssPixelsPerInch / 2.54f;
+    case MathMLElement::LengthType::Em:
+        return length.value * style.fontCascade().size();
+    case MathMLElement::LengthType::Ex:
+        return length.value * style.fontMetrics().xHeight();
+    case MathMLElement::LengthType::In:
+        return length.value * cssPixelsPerInch;
+    case MathMLElement::LengthType::MathUnit:
+        return length.value * style.fontCascade().size() / 18;
+    case MathMLElement::LengthType::Mm:
+        return length.value * cssPixelsPerInch / 25.4f;
+    case MathMLElement::LengthType::Pc:
+        return length.value * cssPixelsPerInch / 6;
+    case MathMLElement::LengthType::Percentage:
+        return referenceValue * length.value / 100;
+    case MathMLElement::LengthType::Pt:
+        return length.value * cssPixelsPerInch / 72;
+    case MathMLElement::LengthType::Px:
+        return length.value;
+    case MathMLElement::LengthType::UnitLess:
+        return referenceValue * length.value;
+    case MathMLElement::LengthType::ParsingFailed:
+        return referenceValue;
+    default:
+        ASSERT_NOT_REACHED();
+        return referenceValue;
+    }
+}
+
</ins><span class="cx"> bool parseMathMLLength(const String&amp; string, LayoutUnit&amp; lengthValue, const RenderStyle* style, bool allowNegative)
</span><span class="cx"> {
</span><del>-    String s = string.simplifyWhiteSpace();
-
-    int stringLength = s.length();
-    if (!stringLength)
</del><ins>+    MathMLElement::Length length = MathMLElement::parseMathMLLength(string);
+    if (length.type == MathMLElement::LengthType::ParsingFailed)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    if (parseMathMLNamedSpace(s, lengthValue, style, allowNegative))
-        return true;
</del><ins>+    LayoutUnit value = toUserUnits(length, *style, lengthValue);
</ins><span class="cx"> 
</span><del>-    StringBuilder number;
-    String unit;
-
-    // This verifies whether the negative sign is there.
-    int i = 0;
-    UChar c = s[0];
-    if (c == '-') {
-        number.append(c);
-        i++;
-    }
-
-    // This gathers up characters that make up the number.
-    bool gotDot = false;
-    for ( ; i &lt; stringLength; i++) {
-        c = s[i];
-        // The string is invalid if it contains two dots.
-        if (gotDot &amp;&amp; c == '.')
-            return false;
-        if (c == '.')
-            gotDot = true;
-        else if (!isASCIIDigit(c)) {
-            unit = s.substring(i, stringLength - i);
-            // Some authors leave blanks before the unit, but that shouldn't
-            // be allowed, so don't simplifyWhitespace on 'unit'.
-            break;
-        }
-        number.append(c);
-    }
-
-    // Convert number to floating point
-    bool ok;
-    float floatValue = number.toString().toFloat(&amp;ok);
-    if (!ok)
</del><ins>+    if (!allowNegative &amp;&amp; value &lt; 0)
</ins><span class="cx">         return false;
</span><del>-    if (floatValue &lt; 0 &amp;&amp; !allowNegative)
-        return false;
</del><span class="cx"> 
</span><del>-    if (unit.isEmpty()) {
-        // no explicit unit, this is a number that will act as a multiplier
-        lengthValue *= floatValue;
-        return true;
-    }
-    if (unit == &quot;%&quot;) {
-        lengthValue *= floatValue / 100;
-        return true;
-    }
-    if (unit == &quot;em&quot;) {
-        lengthValue = floatValue * style-&gt;fontCascade().size();
-        return true;
-    }
-    if (unit == &quot;ex&quot;) {
-        lengthValue = floatValue * style-&gt;fontMetrics().xHeight();
-        return true;
-    }
-    if (unit == &quot;px&quot;) {
-        lengthValue = floatValue;
-        return true;
-    }
-    if (unit == &quot;pt&quot;) {
-        lengthValue = 4 * (floatValue / 3);
-        return true;
-    }
-    if (unit == &quot;pc&quot;) {
-        lengthValue = 16 * floatValue;
-        return true;
-    }
-    if (unit == &quot;in&quot;) {
-        lengthValue = 96 * floatValue;
-        return true;
-    }
-    if (unit == &quot;cm&quot;) {
-        lengthValue = 96 * (floatValue / 2.54);
-        return true;
-    }
-    if (unit == &quot;mm&quot;) {
-        lengthValue = 96 * (floatValue / 25.4);
-        return true;
-    }
-
-    // unexpected unit
-    return false;
</del><ins>+    lengthValue = value;
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool parseMathMLNamedSpace(const String&amp; string, LayoutUnit&amp; lengthValue, const RenderStyle* style, bool allowNegative)
-{
-    float length = 0;
-    // See if it is one of the namedspaces (ranging -7/18em, -6/18, ... 7/18em)
-    if (string == &quot;veryverythinmathspace&quot;)
-        length = 1;
-    else if (string == &quot;verythinmathspace&quot;)
-        length = 2;
-    else if (string == &quot;thinmathspace&quot;)
-        length = 3;
-    else if (string == &quot;mediummathspace&quot;)
-        length = 4;
-    else if (string == &quot;thickmathspace&quot;)
-        length = 5;
-    else if (string == &quot;verythickmathspace&quot;)
-        length = 6;
-    else if (string == &quot;veryverythickmathspace&quot;)
-        length = 7;
-    else if (allowNegative) {
-        if (string == &quot;negativeveryverythinmathspace&quot;)
-            length = -1;
-        else if (string == &quot;negativeverythinmathspace&quot;)
-            length = -2;
-        else if (string == &quot;negativethinmathspace&quot;)
-            length = -3;
-        else if (string == &quot;negativemediummathspace&quot;)
-            length = -4;
-        else if (string == &quot;negativethickmathspace&quot;)
-            length = -5;
-        else if (string == &quot;negativeverythickmathspace&quot;)
-            length = -6;
-        else if (string == &quot;negativeveryverythickmathspace&quot;)
-            length = -7;
-    }
-    if (length) {
-        lengthValue = length * style-&gt;fontCascade().size() / 18;
-        return true;
-    }
-    return false;
-}
-
</del><span class="cx"> Optional&lt;int&gt; RenderMathMLTable::firstLineBaseline() const
</span><span class="cx"> {
</span><span class="cx">     // By default the vertical center of &lt;mtable&gt; is aligned on the math axis.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h (203105 => 203106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h        2016-07-12 04:34:25 UTC (rev 203105)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h        2016-07-12 04:47:02 UTC (rev 203106)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MATHML)
</span><span class="cx"> 
</span><ins>+#include &quot;MathMLElement.h&quot;
</ins><span class="cx"> #include &quot;MathMLStyle.h&quot;
</span><span class="cx"> #include &quot;RenderBlock.h&quot;
</span><span class="cx"> #include &quot;RenderTable.h&quot;
</span><span class="lines">@@ -116,7 +117,7 @@
</span><span class="cx"> 
</span><span class="cx"> // Parsing functions for MathML Length values
</span><span class="cx"> bool parseMathMLLength(const String&amp;, LayoutUnit&amp;, const RenderStyle*, bool allowNegative = true);
</span><del>-bool parseMathMLNamedSpace(const String&amp;, LayoutUnit&amp;, const RenderStyle*, bool allowNegative = true);
</del><ins>+LayoutUnit toUserUnits(const MathMLElement::Length&amp;, const RenderStyle&amp;, const LayoutUnit&amp; referenceValue);
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>