<!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>[174678] 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/174678">174678</a></dd>
<dt>Author</dt> <dd>alex@webkit.org</dd>
<dt>Date</dt> <dd>2014-10-14 03:05:03 -0700 (Tue, 14 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Multiple refactors in RenderMathMLOperator
https://bugs.webkit.org/show_bug.cgi?id=137611

Reviewed by Darin Adler.

The changes include:
- Rename m_operator to m_textContent.
- Make most of the functions private, we needed to create some
public member functions to be able to make the some funtions private
and move trailingSpaceError to RenderMathMLOperator.
- Fix incorrect capitalization of setOperatorProperties function.
- Make all data members private and move them to the end of the
class defition.

No new tests as no change in functionality.

* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::RenderMathMLOperator):
(WebCore::RenderMathMLOperator::setOperatorProperties): Renamed,
incorrect capitalization
(WebCore::RenderMathMLOperator::stretchTo):
(WebCore::RenderMathMLOperator::computePreferredLogicalWidths):
(WebCore::RenderMathMLOperator::rebuildTokenContent):
(WebCore::RenderMathMLOperator::updateFromElement):
(WebCore::RenderMathMLOperator::updateOperatorProperties):
(WebCore::RenderMathMLOperator::shouldAllowStretching):
(WebCore::RenderMathMLOperator::updateStyle):
(WebCore::RenderMathMLOperator::trailingSpaceError):
(WebCore::RenderMathMLOperator::SetOperatorProperties): Deleted.
(WebCore::RenderMathMLOperator::advanceForGlyph): Deleted.
(WebCore::RenderMathMLOperator::updateTokenContent): Deleted.
(WebCore::RenderMathMLOperator::getGlyphAssemblyFallBack): Deleted.
* rendering/mathml/RenderMathMLOperator.h:
(WebCore::RenderMathMLOperator::setLeadingSpace): Added.
(WebCore::RenderMathMLOperator::setTrailingSpace):  Added.
(WebCore::RenderMathMLOperator::textContent): Added.
(WebCore::RenderMathMLOperator::isInvisibleOperator):
* rendering/mathml/RenderMathMLRadicalOperator.cpp:
(WebCore::RenderMathMLRadicalOperator::setOperatorProperties):
Renamed, incorrect capitalization
(WebCore::RenderMathMLRadicalOperator::SetOperatorProperties): Deleted.
(WebCore::RenderMathMLRadicalOperator::trailingSpaceError): Deleted.
* rendering/mathml/RenderMathMLRadicalOperator.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLOperatorcpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLOperatorh">trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLRadicalOperatorcpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLRadicalOperatorh">trunk/Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (174677 => 174678)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-10-14 09:53:59 UTC (rev 174677)
+++ trunk/Source/WebCore/ChangeLog        2014-10-14 10:05:03 UTC (rev 174678)
</span><span class="lines">@@ -1,5 +1,51 @@
</span><span class="cx"> 2014-10-14  Alejandro G. Castro  &lt;alex@igalia.com&gt;
</span><span class="cx"> 
</span><ins>+        Multiple refactors in RenderMathMLOperator
+        https://bugs.webkit.org/show_bug.cgi?id=137611
+
+        Reviewed by Darin Adler.
+
+        The changes include:
+        - Rename m_operator to m_textContent.
+        - Make most of the functions private, we needed to create some
+        public member functions to be able to make the some funtions private
+        and move trailingSpaceError to RenderMathMLOperator.
+        - Fix incorrect capitalization of setOperatorProperties function.
+        - Make all data members private and move them to the end of the
+        class defition.
+
+        No new tests as no change in functionality.
+
+        * rendering/mathml/RenderMathMLOperator.cpp:
+        (WebCore::RenderMathMLOperator::RenderMathMLOperator):
+        (WebCore::RenderMathMLOperator::setOperatorProperties): Renamed,
+        incorrect capitalization
+        (WebCore::RenderMathMLOperator::stretchTo):
+        (WebCore::RenderMathMLOperator::computePreferredLogicalWidths):
+        (WebCore::RenderMathMLOperator::rebuildTokenContent):
+        (WebCore::RenderMathMLOperator::updateFromElement):
+        (WebCore::RenderMathMLOperator::updateOperatorProperties):
+        (WebCore::RenderMathMLOperator::shouldAllowStretching):
+        (WebCore::RenderMathMLOperator::updateStyle):
+        (WebCore::RenderMathMLOperator::trailingSpaceError):
+        (WebCore::RenderMathMLOperator::SetOperatorProperties): Deleted.
+        (WebCore::RenderMathMLOperator::advanceForGlyph): Deleted.
+        (WebCore::RenderMathMLOperator::updateTokenContent): Deleted.
+        (WebCore::RenderMathMLOperator::getGlyphAssemblyFallBack): Deleted.
+        * rendering/mathml/RenderMathMLOperator.h:
+        (WebCore::RenderMathMLOperator::setLeadingSpace): Added.
+        (WebCore::RenderMathMLOperator::setTrailingSpace):  Added.
+        (WebCore::RenderMathMLOperator::textContent): Added.
+        (WebCore::RenderMathMLOperator::isInvisibleOperator):
+        * rendering/mathml/RenderMathMLRadicalOperator.cpp:
+        (WebCore::RenderMathMLRadicalOperator::setOperatorProperties):
+        Renamed, incorrect capitalization
+        (WebCore::RenderMathMLRadicalOperator::SetOperatorProperties): Deleted.
+        (WebCore::RenderMathMLRadicalOperator::trailingSpaceError): Deleted.
+        * rendering/mathml/RenderMathMLRadicalOperator.h:
+
+2014-10-14  Alejandro G. Castro  &lt;alex@igalia.com&gt;
+
</ins><span class="cx">         Changes in the stretchy attribute do not update rendering
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=136883
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLOperatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (174677 => 174678)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp        2014-10-14 09:53:59 UTC (rev 174677)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp        2014-10-14 10:05:03 UTC (rev 174678)
</span><span class="lines">@@ -1139,7 +1139,7 @@
</span><span class="cx">     : RenderMathMLToken(element, WTF::move(style))
</span><span class="cx">     , m_stretchHeightAboveBaseline(0)
</span><span class="cx">     , m_stretchDepthBelowBaseline(0)
</span><del>-    , m_operator(0)
</del><ins>+    , m_textContent(0)
</ins><span class="cx">     , m_isVertical(true)
</span><span class="cx"> {
</span><span class="cx">     updateTokenContent();
</span><span class="lines">@@ -1149,7 +1149,7 @@
</span><span class="cx">     : RenderMathMLToken(document, WTF::move(style))
</span><span class="cx">     , m_stretchHeightAboveBaseline(0)
</span><span class="cx">     , m_stretchDepthBelowBaseline(0)
</span><del>-    , m_operator(0)
</del><ins>+    , m_textContent(0)
</ins><span class="cx">     , m_isVertical(true)
</span><span class="cx">     , m_operatorForm(form)
</span><span class="cx">     , m_operatorFlags(flags)
</span><span class="lines">@@ -1196,10 +1196,10 @@
</span><span class="cx">     m_trailingSpace = entry-&gt;rspace * style().font().size() / 18;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderMathMLOperator::SetOperatorProperties()
</del><ins>+void RenderMathMLOperator::setOperatorProperties()
</ins><span class="cx"> {
</span><span class="cx">     // We determine the stretch direction (default is vertical).
</span><del>-    m_isVertical = !(tryBinarySearch&lt;const UChar, UChar&gt;(MathMLOperatorDictionary::horizontalOperators, WTF_ARRAY_LENGTH(MathMLOperatorDictionary::horizontalOperators), m_operator, MathMLOperatorDictionary::ExtractKeyHorizontal));
</del><ins>+    m_isVertical = !(tryBinarySearch&lt;const UChar, UChar&gt;(MathMLOperatorDictionary::horizontalOperators, WTF_ARRAY_LENGTH(MathMLOperatorDictionary::horizontalOperators), m_textContent, MathMLOperatorDictionary::ExtractKeyHorizontal));
</ins><span class="cx"> 
</span><span class="cx">     // We determine the form of the operator.
</span><span class="cx">     bool explicitForm = true;
</span><span class="lines">@@ -1235,16 +1235,16 @@
</span><span class="cx">     m_minSize = style().font().size(); // This sets minsize to &quot;1em&quot;.
</span><span class="cx">     m_maxSize = intMaxForLayoutUnit; // This sets maxsize to &quot;infinity&quot;.
</span><span class="cx"> 
</span><del>-    if (m_operator) {
</del><ins>+    if (m_textContent) {
</ins><span class="cx">         // Then we try to find the default values from the operator dictionary.
</span><del>-        if (const MathMLOperatorDictionary::Entry* entry = tryBinarySearch&lt;const MathMLOperatorDictionary::Entry, MathMLOperatorDictionary::Key&gt;(MathMLOperatorDictionary::dictionary, MATHML_OPDICT_SIZE, MathMLOperatorDictionary::Key(m_operator, m_operatorForm), MathMLOperatorDictionary::ExtractKey))
</del><ins>+        if (const MathMLOperatorDictionary::Entry* entry = tryBinarySearch&lt;const MathMLOperatorDictionary::Entry, MathMLOperatorDictionary::Key&gt;(MathMLOperatorDictionary::dictionary, MATHML_OPDICT_SIZE, MathMLOperatorDictionary::Key(m_textContent, m_operatorForm), MathMLOperatorDictionary::ExtractKey))
</ins><span class="cx">             setOperatorPropertiesFromOpDictEntry(entry);
</span><span class="cx">         else if (!explicitForm) {
</span><span class="cx">             // If we did not find the desired operator form and if it was not set explicitely, we use the first one in the following order: Infix, Prefix, Postfix.
</span><span class="cx">             // This is to handle bad MathML markup without explicit &lt;mrow&gt; delimiters like &quot;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&quot; where the inner parenthesis should not be considered infix.
</span><del>-            if (const MathMLOperatorDictionary::Entry* entry = tryBinarySearch&lt;const MathMLOperatorDictionary::Entry, UChar&gt;(MathMLOperatorDictionary::dictionary, MATHML_OPDICT_SIZE, m_operator, MathMLOperatorDictionary::ExtractChar)) {
</del><ins>+            if (const MathMLOperatorDictionary::Entry* entry = tryBinarySearch&lt;const MathMLOperatorDictionary::Entry, UChar&gt;(MathMLOperatorDictionary::dictionary, MATHML_OPDICT_SIZE, m_textContent, MathMLOperatorDictionary::ExtractChar)) {
</ins><span class="cx">                 // If the previous entry is another form for that operator, we move to that entry. Note that it only remains at most two forms so we don't need to move any further.
</span><del>-                if (entry != MathMLOperatorDictionary::dictionary &amp;&amp; (entry-1)-&gt;character == m_operator)
</del><ins>+                if (entry != MathMLOperatorDictionary::dictionary &amp;&amp; (entry-1)-&gt;character == m_textContent)
</ins><span class="cx">                     entry--;
</span><span class="cx">                 m_operatorForm = entry-&gt;form; // We override the form previously determined.
</span><span class="cx">                 setOperatorPropertiesFromOpDictEntry(entry);
</span><span class="lines">@@ -1287,7 +1287,7 @@
</span><span class="cx">     m_stretchHeightAboveBaseline = heightAboveBaseline;
</span><span class="cx">     m_stretchDepthBelowBaseline = depthBelowBaseline;
</span><span class="cx"> 
</span><del>-    SetOperatorProperties();
</del><ins>+    setOperatorProperties();
</ins><span class="cx">     if (hasOperatorFlag(MathMLOperatorDictionary::Symmetric)) {
</span><span class="cx">         // We make the operator stretch symmetrically above and below the axis.
</span><span class="cx">         // FIXME: We should read the axis from the MATH table (https://bugs.webkit.org/show_bug.cgi?id=122297). For now, we use the same value as in RenderMathMLFraction::firstLineBaseline().
</span><span class="lines">@@ -1318,7 +1318,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_stretchWidth = width;
</span><span class="cx"> 
</span><del>-    SetOperatorProperties();
</del><ins>+    setOperatorProperties();
</ins><span class="cx"> 
</span><span class="cx">     updateStyle();
</span><span class="cx"> }
</span><span class="lines">@@ -1351,12 +1351,12 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(preferredLogicalWidthsDirty());
</span><span class="cx"> 
</span><del>-    SetOperatorProperties();
</del><ins>+    setOperatorProperties();
</ins><span class="cx">     if (!shouldAllowStretching()) {
</span><span class="cx">         RenderMathMLToken::computePreferredLogicalWidths();
</span><span class="cx">         if (isInvisibleOperator()) {
</span><span class="cx">             // In some fonts, glyphs for invisible operators have nonzero width. Consequently, we subtract that width here to avoid wide gaps.
</span><del>-            GlyphData data = style().font().glyphDataForCharacter(m_operator, false);
</del><ins>+            GlyphData data = style().font().glyphDataForCharacter(m_textContent, false);
</ins><span class="cx">             float glyphWidth = advanceForGlyph(data);
</span><span class="cx">             ASSERT(glyphWidth &lt;= m_minPreferredLogicalWidth);
</span><span class="cx">             m_minPreferredLogicalWidth -= glyphWidth;
</span><span class="lines">@@ -1365,7 +1365,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    GlyphData data = style().font().glyphDataForCharacter(m_operator, !style().isLeftToRightDirection());
</del><ins>+    GlyphData data = style().font().glyphDataForCharacter(m_textContent, !style().isLeftToRightDirection());
</ins><span class="cx">     float maximumGlyphWidth = advanceForGlyph(data);
</span><span class="cx">     if (!m_isVertical) {
</span><span class="cx">         if (maximumGlyphWidth &lt; stretchSize())
</span><span class="lines">@@ -1376,12 +1376,12 @@
</span><span class="cx">     }
</span><span class="cx">     if (isLargeOperatorInDisplayStyle()) {
</span><span class="cx">         // Large operators in STIX Word have incorrect advance width, causing misplacement of superscript, so we use the glyph bound instead (http://sourceforge.net/p/stixfonts/tracking/49/).
</span><del>-        StretchyData largeOperator = getDisplayStyleLargeOperator(m_operator);
</del><ins>+        StretchyData largeOperator = getDisplayStyleLargeOperator(m_textContent);
</ins><span class="cx">         if (largeOperator.mode() == DrawSizeVariant)
</span><span class="cx">             maximumGlyphWidth = boundsForGlyph(largeOperator.variant()).width();
</span><span class="cx">     } else {
</span><span class="cx">         // FIXME: some glyphs (e.g. the one for &quot;FRACTION SLASH&quot; in the STIX Math font or large operators) have a width that depends on the height, resulting in large gaps (https://bugs.webkit.org/show_bug.cgi?id=130326).
</span><del>-        findStretchyData(m_operator, &amp;maximumGlyphWidth);
</del><ins>+        findStretchyData(m_textContent, &amp;maximumGlyphWidth);
</ins><span class="cx">     }
</span><span class="cx">     m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth = m_leadingSpace + maximumGlyphWidth + m_trailingSpace;
</span><span class="cx"> }
</span><span class="lines">@@ -1402,8 +1402,8 @@
</span><span class="cx">     // We verify whether the operator text can be represented by a single UChar.
</span><span class="cx">     // FIXME: This does not handle surrogate pairs (https://bugs.webkit.org/show_bug.cgi?id=122296).
</span><span class="cx">     // FIXME: This does not handle &lt;mo&gt; operators with multiple characters (https://bugs.webkit.org/show_bug.cgi?id=124828).
</span><del>-    m_operator = textContent.length() == 1 ? textContent[0] : 0;
-    SetOperatorProperties();
</del><ins>+    m_textContent = textContent.length() == 1 ? textContent[0] : 0;
+    setOperatorProperties();
</ins><span class="cx">     updateStyle();
</span><span class="cx">     setNeedsLayoutAndPrefWidthsRecalc();
</span><span class="cx"> }
</span><span class="lines">@@ -1422,13 +1422,13 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderMathMLOperator::updateFromElement()
</span><span class="cx"> {
</span><del>-    SetOperatorProperties();
</del><ins>+    setOperatorProperties();
</ins><span class="cx">     RenderMathMLToken::updateFromElement();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderMathMLOperator::updateOperatorProperties()
</span><span class="cx"> {
</span><del>-    SetOperatorProperties();
</del><ins>+    setOperatorProperties();
</ins><span class="cx">     if (!isEmpty())
</span><span class="cx">         updateStyle();
</span><span class="cx">     setNeedsLayoutAndPrefWidthsRecalc();
</span><span class="lines">@@ -1436,7 +1436,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool RenderMathMLOperator::shouldAllowStretching() const
</span><span class="cx"> {
</span><del>-    return m_operator &amp;&amp; (hasOperatorFlag(MathMLOperatorDictionary::Stretchy) || isLargeOperatorInDisplayStyle());
</del><ins>+    return m_textContent &amp;&amp; (hasOperatorFlag(MathMLOperatorDictionary::Stretchy) || isLargeOperatorInDisplayStyle());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RenderMathMLOperator::getGlyphAssemblyFallBack(Vector&lt;OpenTypeMathData::AssemblyPart&gt; assemblyParts, StretchyData&amp; stretchyData) const
</span><span class="lines">@@ -1680,14 +1680,14 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (m_isVertical &amp;&amp; isLargeOperatorInDisplayStyle())
</span><del>-        m_stretchyData = getDisplayStyleLargeOperator(m_operator);
</del><ins>+        m_stretchyData = getDisplayStyleLargeOperator(m_textContent);
</ins><span class="cx">     else {
</span><span class="cx">         // We do not stretch if the base glyph is large enough.
</span><del>-        GlyphData baseGlyph = style().font().glyphDataForCharacter(m_operator, !style().isLeftToRightDirection());
</del><ins>+        GlyphData baseGlyph = style().font().glyphDataForCharacter(m_textContent, !style().isLeftToRightDirection());
</ins><span class="cx">         float baseSize = m_isVertical ? heightForGlyph(baseGlyph) : advanceForGlyph(baseGlyph);
</span><span class="cx">         if (stretchSize() &lt;= baseSize)
</span><span class="cx">             return;
</span><del>-        m_stretchyData = findStretchyData(m_operator, nullptr);
</del><ins>+        m_stretchyData = findStretchyData(m_textContent, nullptr);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (m_isVertical &amp;&amp; m_stretchyData.mode() == DrawSizeVariant) {
</span><span class="lines">@@ -1980,7 +1980,33 @@
</span><span class="cx">         return;
</span><span class="cx">     RenderMathMLToken::paintChildren(paintInfo, paintOffset, paintInfoForChild, usePrintRect);
</span><span class="cx"> }
</span><del>-    
</del><ins>+
+LayoutUnit RenderMathMLOperator::trailingSpaceError()
+{
+    const auto&amp; primaryFontData = style().font().primaryFont();
+    if (!primaryFontData || !primaryFontData-&gt;mathData())
+        return 0;
+
+    // For OpenType MATH font, the layout is based on RenderMathOperator for which the preferred width is sometimes overestimated (bug https://bugs.webkit.org/show_bug.cgi?id=130326).
+    // Hence we determine the error in the logical width with respect to the actual width of the glyph(s) used to paint the operator.
+    LayoutUnit width = logicalWidth();
+
+    if (m_stretchyData.mode() == DrawNormal) {
+        GlyphData data = style().font().glyphDataForCharacter(textContent(), !style().isLeftToRightDirection());
+        return width - advanceForGlyph(data);
+    }
+
+    if (m_stretchyData.mode() == DrawSizeVariant)
+        return width - advanceForGlyph(m_stretchyData.variant());
+
+    float assemblyWidth = advanceForGlyph(m_stretchyData.top());
+    assemblyWidth = std::max(assemblyWidth, advanceForGlyph(m_stretchyData.bottom()));
+    assemblyWidth = std::max(assemblyWidth, advanceForGlyph(m_stretchyData.extension()));
+    if (m_stretchyData.middle().glyph)
+        assemblyWidth = std::max(assemblyWidth, advanceForGlyph(m_stretchyData.middle()));
+    return width - assemblyWidth;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLOperatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h (174677 => 174678)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h        2014-10-14 09:53:59 UTC (rev 174677)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h        2014-10-14 10:05:03 UTC (rev 174678)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> #include &quot;SimpleFontData.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><del>-    
</del><ins>+
</ins><span class="cx"> namespace MathMLOperatorDictionary {
</span><span class="cx"> 
</span><span class="cx"> enum Form { Infix, Prefix, Postfix };
</span><span class="lines">@@ -80,30 +80,22 @@
</span><span class="cx">     void updateTokenContent() override final;
</span><span class="cx">     void updateOperatorProperties();
</span><span class="cx">     void setOperatorFlagAndScheduleLayoutIfNeeded(MathMLOperatorDictionary::Flag, const AtomicString&amp; attributeValue);
</span><ins>+    LayoutUnit trailingSpaceError();
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    virtual const char* renderName() const override { return isAnonymous() ? &quot;RenderMathMLOperator (anonymous)&quot; : &quot;RenderMathMLOperator&quot;; }
-    virtual void paintChildren(PaintInfo&amp; forSelf, const LayoutPoint&amp;, PaintInfo&amp; forChild, bool usePrintRect) override;
-    virtual bool isRenderMathMLOperator() const override { return true; }
-    // The following operators are invisible: U+2061 FUNCTION APPLICATION, U+2062 INVISIBLE TIMES, U+2063 INVISIBLE SEPARATOR, U+2064 INVISIBLE PLUS.
-    bool isInvisibleOperator() const { return 0x2061 &lt;= m_operator &amp;&amp; m_operator &lt;= 0x2064; }
-    virtual bool isChildAllowed(const RenderObject&amp;, const RenderStyle&amp;) const override;
</del><ins>+    virtual void setOperatorProperties();
</ins><span class="cx">     virtual void computePreferredLogicalWidths() override;
</span><span class="cx">     virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&amp;) const override;
</span><del>-    virtual int firstLineBaseline() const override;
-    virtual RenderMathMLOperator* unembellishedOperator() override { return this; }
-    void rebuildTokenContent(const String&amp; operatorString);
-    void updateFromElement() override;
-
-    bool shouldAllowStretching() const;
-
-    FloatRect boundsForGlyph(const GlyphData&amp;) const;
-    float heightForGlyph(const GlyphData&amp;) const;
</del><span class="cx">     float advanceForGlyph(const GlyphData&amp;) const;
</span><ins>+    void setLeadingSpace(LayoutUnit leadingSpace) { m_leadingSpace = leadingSpace; }
+    void setTrailingSpace(LayoutUnit trailingSpace) { m_trailingSpace = trailingSpace; }
+    UChar textContent() const { return m_textContent; }
</ins><span class="cx"> 
</span><ins>+private:
</ins><span class="cx">     enum DrawMode {
</span><span class="cx">         DrawNormal, DrawSizeVariant, DrawGlyphAssembly
</span><span class="cx">     };
</span><ins>+
</ins><span class="cx">     class StretchyData {
</span><span class="cx">     public:
</span><span class="cx">         DrawMode mode() const { return m_mode; }
</span><span class="lines">@@ -148,15 +140,34 @@
</span><span class="cx">                 break;
</span><span class="cx">             }
</span><span class="cx">         }
</span><ins>+
</ins><span class="cx">     private:
</span><span class="cx">         DrawMode m_mode;
</span><span class="cx">         // FIXME: For OpenType fonts with a MATH table all the glyphs are from the same font, so we would only need to store the glyph indices here.
</span><span class="cx">         GlyphData m_data[4];
</span><span class="cx">     };
</span><ins>+
+    virtual const char* renderName() const override { return isAnonymous() ? &quot;RenderMathMLOperator (anonymous)&quot; : &quot;RenderMathMLOperator&quot;; }
+    virtual void paintChildren(PaintInfo&amp; forSelf, const LayoutPoint&amp;, PaintInfo&amp; forChild, bool usePrintRect) override;
+    virtual bool isRenderMathMLOperator() const override { return true; }
+    // The following operators are invisible: U+2061 FUNCTION APPLICATION, U+2062 INVISIBLE TIMES, U+2063 INVISIBLE SEPARATOR, U+2064 INVISIBLE PLUS.
+    bool isInvisibleOperator() const { return 0x2061 &lt;= m_textContent &amp;&amp; m_textContent &lt;= 0x2064; }
+    virtual bool isChildAllowed(const RenderObject&amp;, const RenderStyle&amp;) const override;
+
+    virtual int firstLineBaseline() const override;
+    virtual RenderMathMLOperator* unembellishedOperator() override { return this; }
+    void rebuildTokenContent(const String&amp; operatorString);
+    void updateFromElement() override;
+
+    bool shouldAllowStretching() const;
+
+    FloatRect boundsForGlyph(const GlyphData&amp;) const;
+    float heightForGlyph(const GlyphData&amp;) const;
+
</ins><span class="cx">     bool getGlyphAssemblyFallBack(Vector&lt;OpenTypeMathData::AssemblyPart&gt;, StretchyData&amp;) const;
</span><span class="cx">     StretchyData getDisplayStyleLargeOperator(UChar) const;
</span><span class="cx">     StretchyData findStretchyData(UChar, float* maximumGlyphWidth);
</span><del>-    
</del><ins>+
</ins><span class="cx">     enum GlyphPaintTrimming {
</span><span class="cx">         TrimTop,
</span><span class="cx">         TrimBottom,
</span><span class="lines">@@ -171,25 +182,23 @@
</span><span class="cx">     void fillWithHorizontalExtensionGlyph(PaintInfo&amp;, const LayoutPoint&amp; from, const LayoutPoint&amp; to);
</span><span class="cx">     void paintVerticalGlyphAssembly(PaintInfo&amp;, const LayoutPoint&amp;);
</span><span class="cx">     void paintHorizontalGlyphAssembly(PaintInfo&amp;, const LayoutPoint&amp;);
</span><ins>+    void setOperatorFlagFromAttribute(MathMLOperatorDictionary::Flag, const QualifiedName&amp;);
+    void setOperatorFlagFromAttributeValue(MathMLOperatorDictionary::Flag, const AtomicString&amp; attributeValue);
+    void setOperatorPropertiesFromOpDictEntry(const MathMLOperatorDictionary::Entry*);
</ins><span class="cx"> 
</span><span class="cx">     LayoutUnit m_stretchHeightAboveBaseline;
</span><span class="cx">     LayoutUnit m_stretchDepthBelowBaseline;
</span><span class="cx">     LayoutUnit m_stretchWidth;
</span><span class="cx"> 
</span><del>-    UChar m_operator;
</del><ins>+    UChar m_textContent;
</ins><span class="cx">     bool m_isVertical;
</span><del>-    StretchyData m_stretchyData;
</del><span class="cx">     MathMLOperatorDictionary::Form m_operatorForm;
</span><span class="cx">     unsigned short m_operatorFlags;
</span><span class="cx">     LayoutUnit m_leadingSpace;
</span><span class="cx">     LayoutUnit m_trailingSpace;
</span><span class="cx">     LayoutUnit m_minSize;
</span><span class="cx">     LayoutUnit m_maxSize;
</span><del>-
-    void setOperatorFlagFromAttribute(MathMLOperatorDictionary::Flag, const QualifiedName&amp;);
-    void setOperatorFlagFromAttributeValue(MathMLOperatorDictionary::Flag, const AtomicString&amp; attributeValue);
-    void setOperatorPropertiesFromOpDictEntry(const MathMLOperatorDictionary::Entry*);
-    virtual void SetOperatorProperties();
</del><ins>+    StretchyData m_stretchyData;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLRadicalOperatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.cpp (174677 => 174678)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.cpp        2014-10-14 09:53:59 UTC (rev 174677)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.cpp        2014-10-14 10:05:03 UTC (rev 174678)
</span><span class="lines">@@ -72,12 +72,12 @@
</span><span class="cx">     RenderMathMLOperator::stretchTo(heightAboveBaseline, depthBelowBaseline);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderMathMLRadicalOperator::SetOperatorProperties()
</del><ins>+void RenderMathMLRadicalOperator::setOperatorProperties()
</ins><span class="cx"> {
</span><del>-    RenderMathMLOperator::SetOperatorProperties();
</del><ins>+    RenderMathMLOperator::setOperatorProperties();
</ins><span class="cx">     // We remove spacing around the radical symbol.
</span><del>-    m_leadingSpace = 0;
-    m_trailingSpace = 0;
</del><ins>+    setLeadingSpace(0);
+    setTrailingSpace(0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderMathMLRadicalOperator::computePreferredLogicalWidths()
</span><span class="lines">@@ -176,32 +176,6 @@
</span><span class="cx">     info.context-&gt;strokePath(line);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutUnit RenderMathMLRadicalOperator::trailingSpaceError()
-{
-    const auto&amp; primaryFontData = style().font().primaryFont();
-    if (!primaryFontData || !primaryFontData-&gt;mathData())
-        return 0;
-
-    // For OpenType MATH font, the layout is based on RenderMathOperator for which the preferred width is sometimes overestimated (bug https://bugs.webkit.org/show_bug.cgi?id=130326).
-    // Hence we determine the error in the logical width with respect to the actual width of the glyph(s) used to paint the radical.
-    LayoutUnit width = logicalWidth();
-
-    if (m_stretchyData.mode() == DrawNormal) {
-        GlyphData data = style().font().glyphDataForCharacter(m_operator, !style().isLeftToRightDirection());
-        return width - advanceForGlyph(data);
-    }
-
-    if (m_stretchyData.mode() == DrawSizeVariant)
-        return width - advanceForGlyph(m_stretchyData.variant());
-
-    float assemblyWidth = advanceForGlyph(m_stretchyData.top());
-    assemblyWidth = std::max(assemblyWidth, advanceForGlyph(m_stretchyData.bottom()));
-    assemblyWidth = std::max(assemblyWidth, advanceForGlyph(m_stretchyData.extension()));
-    if (m_stretchyData.middle().glyph)
-        assemblyWidth = std::max(assemblyWidth, advanceForGlyph(m_stretchyData.middle()));
-    return width - assemblyWidth;
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-}
-
</del><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLRadicalOperatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.h (174677 => 174678)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.h        2014-10-14 09:53:59 UTC (rev 174677)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.h        2014-10-14 10:05:03 UTC (rev 174678)
</span><span class="lines">@@ -40,12 +40,11 @@
</span><span class="cx">     virtual void computePreferredLogicalWidths() override;
</span><span class="cx">     virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&amp;) const override;
</span><span class="cx">     virtual void paint(PaintInfo&amp;, const LayoutPoint&amp; paintOffset) override;
</span><del>-    LayoutUnit trailingSpaceError();
</del><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     virtual bool isRenderMathMLRadicalOperator() const override { return true; }
</span><span class="cx">     virtual const char* renderName() const override { return isAnonymous() ? &quot;RenderMathMLRadicalOperator (anonymous)&quot; : &quot;RenderMathMLRadicalOperator&quot;; }
</span><del>-    void SetOperatorProperties() override;
</del><ins>+    void setOperatorProperties() override;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre>
</div>
</div>

</body>
</html>