<!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>[203714] trunk</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/203714">203714</a></dd>
<dt>Author</dt> <dd>fred.wang@free.fr</dd>
<dt>Date</dt> <dd>2016-07-26 00:46:58 -0700 (Tue, 26 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>MathOperator: Add a mapping from combining to non-combining equivalents
https://bugs.webkit.org/show_bug.cgi?id=159513

Patch by Frederic Wang &lt;fwang@igalia.com&gt; on 2016-07-25
Reviewed by Darin Adler.

Source/WebCore:

Many math fonts provide stretch variants and assemblies for combining characters but not for
their non-combining equivalent. In the MathML recommendation, it is suggested to use
non-combining charaters, so we allow the operator stretching code to look for constructions
associated to these non-combining characters in order to still be able to stretch the
combining ones.

Test: mathml/presentation/bug159513.html

* rendering/mathml/MathOperator.cpp:
(WebCore::MathOperator::getGlyph): New function extending getBaseGlyph to retrieve the glyph
data for an arbitrary character.
(WebCore::MathOperator::getMathVariantsWithFallback): This helper function calls
getMathVariants for the base glyph. If no constructions are available, it calls
getMathVariants for the glyph associated to equivalent fallback characters as listed in the
small characterFallback table.
(WebCore::MathOperator::calculateStretchyData): Call getMathVariantsWithFallback instead of
getMathVariants. Note that we do not need to do that for calculateDisplayStyleLargeOperator
as we do not use fallback for large operators.
* rendering/mathml/MathOperator.h:
(WebCore::MathOperator::getBaseGlyph): Use getGlyph to implement this function.

LayoutTests:

* mathml/presentation/bug159513.html: Added.
* platform/gtk/mathml/presentation/bug159513-expected.png: Added.
* platform/gtk/mathml/presentation/bug159513-expected.txt: Added.
* platform/ios-simulator/TestExpectations: Skip this test on iOS.
* platform/mac/TestExpectations: Skip this test on Mac.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorTestExpectations">trunk/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlMathOperatorcpp">trunk/Source/WebCore/rendering/mathml/MathOperator.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlMathOperatorh">trunk/Source/WebCore/rendering/mathml/MathOperator.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmathmlpresentationbug159513html">trunk/LayoutTests/mathml/presentation/bug159513.html</a></li>
<li><a href="#trunkLayoutTestsplatformgtkmathmlpresentationbug159513expectedpng">trunk/LayoutTests/platform/gtk/mathml/presentation/bug159513-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformgtkmathmlpresentationbug159513expectedtxt">trunk/LayoutTests/platform/gtk/mathml/presentation/bug159513-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (203713 => 203714)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-07-26 05:46:53 UTC (rev 203713)
+++ trunk/LayoutTests/ChangeLog        2016-07-26 07:46:58 UTC (rev 203714)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-07-25  Frederic Wang  &lt;fwang@igalia.com&gt;
+
+        MathOperator: Add a mapping from combining to non-combining equivalents
+        https://bugs.webkit.org/show_bug.cgi?id=159513
+
+        Reviewed by Darin Adler.
+
+        * mathml/presentation/bug159513.html: Added.
+        * platform/gtk/mathml/presentation/bug159513-expected.png: Added.
+        * platform/gtk/mathml/presentation/bug159513-expected.txt: Added.
+        * platform/ios-simulator/TestExpectations: Skip this test on iOS.
+        * platform/mac/TestExpectations: Skip this test on Mac.
+
</ins><span class="cx"> 2016-07-25  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Second parameter to Range.setStart() / setEnd() should be mandatory
</span></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationbug159513html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/bug159513.html (0 => 203714)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/bug159513.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/bug159513.html        2016-07-26 07:46:58 UTC (rev 203714)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;bug 159513&lt;/title&gt;
+    &lt;meta charset=&quot;utf-8&quot;/&gt;
+    &lt;style type=&quot;text/css&quot;&gt;
+      /* This test requires the Latin Modern Math font. */
+      math {
+        font-family: Latin Modern Math;
+        font-size: 200%;
+      }
+    &lt;/style&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+    &lt;p&gt;Test passes if horizontal operators stretch.&lt;/p&gt;
+    &lt;math&gt;
+      &lt;mover&gt;
+        &lt;mspace width=&quot;60px&quot; height=&quot;30px&quot; mathbackground=&quot;green&quot;/&gt;
+        &lt;mo stretchy=&quot;true&quot;&gt;&amp;#x005E;&lt;/mo&gt;
+      &lt;/mover&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;munder&gt;
+        &lt;mspace width=&quot;60px&quot; height=&quot;30px&quot; mathbackground=&quot;green&quot;/&gt;
+        &lt;mo stretchy=&quot;true&quot;&gt;&amp;#x005F;&lt;/mo&gt;
+      &lt;/munder&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;mover&gt;
+        &lt;mspace width=&quot;60px&quot; height=&quot;30px&quot; mathbackground=&quot;green&quot;/&gt;
+        &lt;mo stretchy=&quot;true&quot;&gt;&amp;#x007E;&lt;/mo&gt;
+      &lt;/mover&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;mover&gt;
+        &lt;mspace width=&quot;60px&quot; height=&quot;30px&quot; mathbackground=&quot;green&quot;/&gt;
+        &lt;mo stretchy=&quot;true&quot;&gt;&amp;#x00AF;&lt;/mo&gt;
+      &lt;/mover&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;mover&gt;
+        &lt;mspace width=&quot;60px&quot; height=&quot;30px&quot; mathbackground=&quot;green&quot;/&gt;
+        &lt;mo stretchy=&quot;true&quot;&gt;&amp;#x02C6;&lt;/mo&gt;
+      &lt;/mover&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;mover&gt;
+        &lt;mspace width=&quot;60px&quot; height=&quot;30px&quot; mathbackground=&quot;green&quot;/&gt;
+        &lt;mo stretchy=&quot;true&quot;&gt;&amp;#x02C7;&lt;/mo&gt;
+      &lt;/mover&gt;
+    &lt;/math&gt;
+  &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/mathml/presentation/bug159513.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+LF
</ins><span class="cx">\ No newline at end of property
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+text/html
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkLayoutTestsplatformgtkmathmlpresentationbug159513expectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/platform/gtk/mathml/presentation/bug159513-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Index: trunk/LayoutTests/platform/gtk/mathml/presentation/bug159513-expected.png
</span><span class="cx">===================================================================
</span><del>--- trunk/LayoutTests/platform/gtk/mathml/presentation/bug159513-expected.png        2016-07-26 05:46:53 UTC (rev 203713)
</del><ins>+++ trunk/LayoutTests/platform/gtk/mathml/presentation/bug159513-expected.png        2016-07-26 07:46:58 UTC (rev 203714)
</ins><span class="cx">Property changes on: trunk/LayoutTests/platform/gtk/mathml/presentation/bug159513-expected.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+image/png
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkLayoutTestsplatformgtkmathmlpresentationbug159513expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/gtk/mathml/presentation/bug159513-expected.txt (0 => 203714)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/mathml/presentation/bug159513-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/gtk/mathml/presentation/bug159513-expected.txt        2016-07-26 07:46:58 UTC (rev 203714)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x114
+  RenderBlock {HTML} at (0,0) size 800x114
+    RenderBody {BODY} at (8,16) size 784x90
+      RenderBlock {P} at (0,0) size 784x17
+        RenderText {#text} at (0,0) size 262x17
+          text run at (0,0) width 262: &quot;Test passes if horizontal operators stretch.&quot;
+      RenderBlock (anonymous) at (0,33) size 784x57
+        RenderMathMLMath {math} at (0,8) size 60x41
+          RenderMathMLUnderOver {mover} at (0,0) size 60x41
+            RenderMathMLSpace {mspace} at (0,10) size 60x31 [bgcolor=#008000]
+            RenderMathMLOperator {mo} at (22,1) size 16x6
+              RenderBlock (anonymous) at (0,0) size 13x19
+                RenderText {#text} at (0,-68) size 13x160
+                  text run at (0,-68) width 13: &quot;^&quot;
+        RenderText {#text} at (60,34) size 4x17
+          text run at (60,34) width 4: &quot; &quot;
+        RenderMathMLMath {math} at (64,18) size 60x40
+          RenderMathMLUnderOver {munder} at (0,0) size 60x40
+            RenderMathMLSpace {mspace} at (0,0) size 60x30 [bgcolor=#008000]
+            RenderMathMLOperator {mo} at (24,33) size 12x5
+              RenderBlock (anonymous) at (0,0) size 8x4
+                RenderText {#text} at (0,-86) size 8x160
+                  text run at (0,-86) width 8: &quot;_&quot;
+        RenderText {#text} at (124,34) size 4x17
+          text run at (124,34) width 4: &quot; &quot;
+        RenderMathMLMath {math} at (128,10) size 60x39
+          RenderMathMLUnderOver {mover} at (0,0) size 60x39
+            RenderMathMLSpace {mspace} at (0,8) size 60x31 [bgcolor=#008000]
+            RenderMathMLOperator {mo} at (23,1) size 14x8
+              RenderBlock (anonymous) at (0,0) size 13x9
+                RenderText {#text} at (0,-78) size 13x160
+                  text run at (0,-78) width 13: &quot;~&quot;
+        RenderText {#text} at (188,34) size 4x17
+          text run at (188,34) width 4: &quot; &quot;
+        RenderMathMLMath {math} at (192,0) size 60x49
+          RenderMathMLUnderOver {mover} at (0,0) size 60x49
+            RenderMathMLSpace {mspace} at (0,18) size 60x31 [bgcolor=#008000]
+            RenderMathMLOperator {mo} at (24,1) size 12x18
+              RenderBlock (anonymous) at (0,0) size 12x16
+                RenderText {#text} at (0,-71) size 12x160
+                  text run at (0,-71) width 12: &quot;\x{AF}&quot;
+        RenderText {#text} at (252,34) size 4x17
+          text run at (252,34) width 4: &quot; &quot;
+        RenderMathMLMath {math} at (256,12) size 60x37
+          RenderMathMLUnderOver {mover} at (0,0) size 60x37
+            RenderMathMLSpace {mspace} at (0,6) size 60x31 [bgcolor=#008000]
+            RenderMathMLOperator {mo} at (24,1) size 12x6
+              RenderBlock (anonymous) at (0,0) size 12x18
+                RenderText {#text} at (0,-69) size 12x160
+                  text run at (0,-69) width 12: &quot;\x{2C6}&quot;
+        RenderText {#text} at (316,34) size 4x17
+          text run at (316,34) width 4: &quot; &quot;
+        RenderMathMLMath {math} at (320,12) size 60x37
+          RenderMathMLUnderOver {mover} at (0,0) size 60x37
+            RenderMathMLSpace {mspace} at (0,6) size 60x31 [bgcolor=#008000]
+            RenderMathMLOperator {mo} at (24,1) size 12x6
+              RenderBlock (anonymous) at (0,0) size 12x18
+                RenderText {#text} at (0,-69) size 12x160
+                  text run at (0,-69) width 12: &quot;\x{2C7}&quot;
+        RenderText {#text} at (0,0) size 0x0
</ins><span class="cx">Property changes on: trunk/LayoutTests/platform/gtk/mathml/presentation/bug159513-expected.txt
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+LF
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (203713 => 203714)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-07-26 05:46:53 UTC (rev 203713)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-07-26 07:46:58 UTC (rev 203714)
</span><span class="lines">@@ -671,6 +671,7 @@
</span><span class="cx"> mathml/opentype/fraction-line.html [ Skip ]
</span><span class="cx"> mathml/presentation/fractions-linethickness.html [ Skip ]
</span><span class="cx"> mathml/opentype/large-operators-italic-correction.html [ Skip ]
</span><ins>+mathml/presentation/bug159513.html [ Skip ]
</ins><span class="cx"> 
</span><span class="cx"> # These reftests require a font with Mathematical Alphanumeric Symbols.
</span><span class="cx"> mathml/presentation/attributes-mathvariant.html [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (203713 => 203714)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations        2016-07-26 05:46:53 UTC (rev 203713)
+++ trunk/LayoutTests/platform/mac/TestExpectations        2016-07-26 07:46:58 UTC (rev 203714)
</span><span class="lines">@@ -804,6 +804,7 @@
</span><span class="cx"> mathml/opentype/fraction-line.html [ Skip ]
</span><span class="cx"> mathml/presentation/fractions-linethickness.html [ Skip ]
</span><span class="cx"> mathml/opentype/large-operators-italic-correction.html [ Skip ]
</span><ins>+mathml/presentation/bug159513.html [ Skip ]
</ins><span class="cx"> 
</span><span class="cx"> # These tests use key navigation to test MathML links but do not seem to work on Mac.
</span><span class="cx"> webkit.org/b/159662 mathml/presentation/href-enter.html [ Skip ]
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (203713 => 203714)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-07-26 05:46:53 UTC (rev 203713)
+++ trunk/Source/WebCore/ChangeLog        2016-07-26 07:46:58 UTC (rev 203714)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2016-07-25  Frederic Wang  &lt;fwang@igalia.com&gt;
+
+        MathOperator: Add a mapping from combining to non-combining equivalents
+        https://bugs.webkit.org/show_bug.cgi?id=159513
+
+        Reviewed by Darin Adler.
+
+        Many math fonts provide stretch variants and assemblies for combining characters but not for
+        their non-combining equivalent. In the MathML recommendation, it is suggested to use
+        non-combining charaters, so we allow the operator stretching code to look for constructions
+        associated to these non-combining characters in order to still be able to stretch the
+        combining ones.
+
+        Test: mathml/presentation/bug159513.html
+
+        * rendering/mathml/MathOperator.cpp:
+        (WebCore::MathOperator::getGlyph): New function extending getBaseGlyph to retrieve the glyph
+        data for an arbitrary character.
+        (WebCore::MathOperator::getMathVariantsWithFallback): This helper function calls
+        getMathVariants for the base glyph. If no constructions are available, it calls
+        getMathVariants for the glyph associated to equivalent fallback characters as listed in the
+        small characterFallback table.
+        (WebCore::MathOperator::calculateStretchyData): Call getMathVariantsWithFallback instead of
+        getMathVariants. Note that we do not need to do that for calculateDisplayStyleLargeOperator
+        as we do not use fallback for large operators.
+        * rendering/mathml/MathOperator.h:
+        (WebCore::MathOperator::getBaseGlyph): Use getGlyph to implement this function.
+
</ins><span class="cx"> 2016-07-25  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Second parameter to Range.setStart() / setEnd() should be mandatory
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlMathOperatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/MathOperator.cpp (203713 => 203714)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/MathOperator.cpp        2016-07-26 05:46:53 UTC (rev 203713)
+++ trunk/Source/WebCore/rendering/mathml/MathOperator.cpp        2016-07-26 07:46:58 UTC (rev 203714)
</span><span class="lines">@@ -121,10 +121,10 @@
</span><span class="cx">     return m_operatorType == Type::VerticalOperator ? m_ascent + m_descent : m_width;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool MathOperator::getBaseGlyph(const RenderStyle&amp; style, GlyphData&amp; baseGlyph) const
</del><ins>+bool MathOperator::getGlyph(const RenderStyle&amp; style, UChar character, GlyphData&amp; glyph) const
</ins><span class="cx"> {
</span><del>-    baseGlyph = style.fontCascade().glyphDataForCharacter(m_baseCharacter, !style.isLeftToRightDirection());
-    return baseGlyph.font &amp;&amp; baseGlyph.font == &amp;style.fontCascade().primaryFont();
</del><ins>+    glyph = style.fontCascade().glyphDataForCharacter(character, !style.isLeftToRightDirection());
+    return glyph.font &amp;&amp; glyph.font == &amp;style.fontCascade().primaryFont();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MathOperator::setSizeVariant(const GlyphData&amp; sizeVariant)
</span><span class="lines">@@ -167,6 +167,47 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// The MathML specification recommends avoiding combining characters.
+// See https://www.w3.org/TR/MathML/chapter7.html#chars.comb-chars
+// However, many math fonts do not provide constructions for the non-combining equivalent.
+const unsigned maxFallbackPerCharacter = 3;
+static const UChar characterFallback[][maxFallbackPerCharacter] = {
+    { 0x005E, 0x0302, 0 }, // CIRCUMFLEX ACCENT
+    { 0x005F, 0x0332, 0 }, // LOW LINE
+    { 0x007E, 0x0303, 0 }, // TILDE
+    { 0x00AF, 0x0304, 0x0305 }, // MACRON
+    { 0x02C6, 0x0302, 0 }, // MODIFIER LETTER CIRCUMFLEX ACCENT
+    { 0x02C7, 0x030C, 0 } // CARON
+};
+const unsigned characterFallbackSize = WTF_ARRAY_LENGTH(characterFallback);
+
+void MathOperator::getMathVariantsWithFallback(const RenderStyle&amp; style, bool isVertical, Vector&lt;Glyph&gt;&amp; sizeVariants, Vector&lt;OpenTypeMathData::AssemblyPart&gt;&amp; assemblyParts)
+{
+    // In general, we first try and find contruction for the base glyph.
+    GlyphData baseGlyph;
+    if (!getBaseGlyph(style, baseGlyph) || !baseGlyph.font-&gt;mathData())
+        return;
+    baseGlyph.font-&gt;mathData()-&gt;getMathVariants(baseGlyph.glyph, isVertical, sizeVariants, assemblyParts);
+    if (!sizeVariants.isEmpty() || !assemblyParts.isEmpty())
+        return;
+
+    // Otherwise, we try and find fallback constructions using similar characters.
+    for (unsigned i = 0; i &lt; characterFallbackSize; i++) {
+        unsigned j = 0;
+        if (characterFallback[i][j] == m_baseCharacter) {
+            for (j++; j &lt; maxFallbackPerCharacter &amp;&amp; characterFallback[i][j]; j++) {
+                GlyphData glyphData;
+                if (!getGlyph(style, characterFallback[i][j], glyphData))
+                    continue;
+                glyphData.font-&gt;mathData()-&gt;getMathVariants(glyphData.glyph, isVertical, sizeVariants, assemblyParts);
+                if (!sizeVariants.isEmpty() || !assemblyParts.isEmpty())
+                    return;
+            }
+            break;
+        }
+    }
+}
+
</ins><span class="cx"> void MathOperator::calculateDisplayStyleLargeOperator(const RenderStyle&amp; style)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_operatorType == Type::DisplayOperator);
</span><span class="lines">@@ -316,7 +357,7 @@
</span><span class="cx">     if (baseGlyph.font-&gt;mathData()) {
</span><span class="cx">         Vector&lt;Glyph&gt; sizeVariants;
</span><span class="cx">         Vector&lt;OpenTypeMathData::AssemblyPart&gt; assemblyParts;
</span><del>-        baseGlyph.font-&gt;mathData()-&gt;getMathVariants(baseGlyph.glyph, isVertical, sizeVariants, assemblyParts);
</del><ins>+        getMathVariantsWithFallback(style, isVertical, sizeVariants, assemblyParts);
</ins><span class="cx">         // We verify the size variants.
</span><span class="cx">         for (auto&amp; sizeVariant : sizeVariants) {
</span><span class="cx">             GlyphData glyphData(sizeVariant, baseGlyph.font);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlMathOperatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/MathOperator.h (203713 => 203714)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/MathOperator.h        2016-07-26 05:46:53 UTC (rev 203713)
+++ trunk/Source/WebCore/rendering/mathml/MathOperator.h        2016-07-26 07:46:58 UTC (rev 203714)
</span><span class="lines">@@ -72,9 +72,11 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     LayoutUnit stretchSize() const;
</span><del>-    bool getBaseGlyph(const RenderStyle&amp;, GlyphData&amp;) const;
</del><ins>+    bool getGlyph(const RenderStyle&amp;, UChar character, GlyphData&amp;) const;
+    bool getBaseGlyph(const RenderStyle&amp; style, GlyphData&amp; baseGlyph) const { return getGlyph(style, m_baseCharacter, baseGlyph); }
</ins><span class="cx">     void setSizeVariant(const GlyphData&amp;);
</span><span class="cx">     void setGlyphAssembly(const GlyphAssemblyData&amp;);
</span><ins>+    void getMathVariantsWithFallback(const RenderStyle&amp;, bool isVertical, Vector&lt;Glyph&gt;&amp;, Vector&lt;OpenTypeMathData::AssemblyPart&gt;&amp;);
</ins><span class="cx">     void calculateDisplayStyleLargeOperator(const RenderStyle&amp;);
</span><span class="cx">     void calculateStretchyData(const RenderStyle&amp;, bool calculateMaxPreferredWidth, LayoutUnit targetSize = 0);
</span><span class="cx">     bool calculateGlyphAssemblyFallback(const RenderStyle&amp;, const Vector&lt;OpenTypeMathData::AssemblyPart&gt;&amp;, GlyphAssemblyData&amp;) const;
</span></span></pre>
</div>
</div>

</body>
</html>