<!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>[205105] 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/205105">205105</a></dd>
<dt>Author</dt> <dd>fred.wang@free.fr</dd>
<dt>Date</dt> <dd>2016-08-28 10:36:05 -0700 (Sun, 28 Aug 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>MathML renderers should use struct to pass long list of LayoutUnits
https://bugs.webkit.org/show_bug.cgi?id=161084
Patch by Frederic Wang <fwang@igalia.com> on 2016-08-23
Reviewed by Darin Adler.
RenderMathMLFraction, RenderMathMLMenclose, RenderMathMLScripts and RenderMathMLUnderOver
have helper functions to retrieve a list of LayoutUnit parameters. We gather them in a single
struct instead of using a long list of LayoutUnit& parameters.
No new tests, behavior is unchanged.
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::getFractionParameters):
(WebCore::RenderMathMLFraction::getStackParameters):
(WebCore::RenderMathMLFraction::layoutBlock):
* rendering/mathml/RenderMathMLFraction.h:
* rendering/mathml/RenderMathMLMenclose.cpp:
(WebCore::RenderMathMLMenclose::getSpaceAroundContent):
(WebCore::RenderMathMLMenclose::computePreferredLogicalWidths):
(WebCore::RenderMathMLMenclose::layoutBlock):
* rendering/mathml/RenderMathMLMenclose.h:
* rendering/mathml/RenderMathMLScripts.cpp:
(WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded):
(WebCore::RenderMathMLScripts::layoutBlock):
* rendering/mathml/RenderMathMLScripts.h:
* rendering/mathml/RenderMathMLUnderOver.cpp:
(WebCore::RenderMathMLUnderOver::getVerticalParameters):
(WebCore::RenderMathMLUnderOver::layoutBlock):
* rendering/mathml/RenderMathMLUnderOver.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLFractioncpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLFractionh">trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLMenclosecpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLMencloseh">trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLScriptscpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLScriptsh">trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.h</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLUnderOvercpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLUnderOverh">trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (205104 => 205105)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-28 16:54:43 UTC (rev 205104)
+++ trunk/Source/WebCore/ChangeLog        2016-08-28 17:36:05 UTC (rev 205105)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2016-08-23 Frederic Wang <fwang@igalia.com>
+
+ MathML renderers should use struct to pass long list of LayoutUnits
+ https://bugs.webkit.org/show_bug.cgi?id=161084
+
+ Reviewed by Darin Adler.
+
+ RenderMathMLFraction, RenderMathMLMenclose, RenderMathMLScripts and RenderMathMLUnderOver
+ have helper functions to retrieve a list of LayoutUnit parameters. We gather them in a single
+ struct instead of using a long list of LayoutUnit& parameters.
+
+ No new tests, behavior is unchanged.
+
+ * rendering/mathml/RenderMathMLFraction.cpp:
+ (WebCore::RenderMathMLFraction::getFractionParameters):
+ (WebCore::RenderMathMLFraction::getStackParameters):
+ (WebCore::RenderMathMLFraction::layoutBlock):
+ * rendering/mathml/RenderMathMLFraction.h:
+ * rendering/mathml/RenderMathMLMenclose.cpp:
+ (WebCore::RenderMathMLMenclose::getSpaceAroundContent):
+ (WebCore::RenderMathMLMenclose::computePreferredLogicalWidths):
+ (WebCore::RenderMathMLMenclose::layoutBlock):
+ * rendering/mathml/RenderMathMLMenclose.h:
+ * rendering/mathml/RenderMathMLScripts.cpp:
+ (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded):
+ (WebCore::RenderMathMLScripts::layoutBlock):
+ * rendering/mathml/RenderMathMLScripts.h:
+ * rendering/mathml/RenderMathMLUnderOver.cpp:
+ (WebCore::RenderMathMLUnderOver::getVerticalParameters):
+ (WebCore::RenderMathMLUnderOver::layoutBlock):
+ * rendering/mathml/RenderMathMLUnderOver.h:
+
</ins><span class="cx"> 2016-08-28 Andreas Kling <akling@apple.com>
</span><span class="cx">
</span><span class="cx"> Clean up some .text attribute setters that don't throw.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLFractioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp (205104 => 205105)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp        2016-08-28 16:54:43 UTC (rev 205104)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp        2016-08-28 17:36:05 UTC (rev 205105)
</span><span class="lines">@@ -81,9 +81,10 @@
</span><span class="cx"> m_lineThickness = 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderMathMLFraction::getFractionParameters(LayoutUnit& numeratorGapMin, LayoutUnit& denominatorGapMin, LayoutUnit& numeratorMinShiftUp, LayoutUnit& denominatorMinShiftDown)
</del><ins>+RenderMathMLFraction::FractionParameters RenderMathMLFraction::fractionParameters()
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(!isStack());
</span><ins>+ FractionParameters parameters;
</ins><span class="cx">
</span><span class="cx"> // We try and read constants to draw the fraction from the OpenType MATH and use fallback values otherwise.
</span><span class="cx"> const auto& primaryFont = style().fontCascade().primaryFont();
</span><span class="lines">@@ -90,41 +91,46 @@
</span><span class="cx"> const auto* mathData = style().fontCascade().primaryFont().mathData();
</span><span class="cx"> bool display = mathMLStyle()->displayStyle();
</span><span class="cx"> if (mathData) {
</span><del>- numeratorGapMin = mathData->getMathConstant(primaryFont, display ? OpenTypeMathData::FractionNumDisplayStyleGapMin : OpenTypeMathData::FractionNumeratorGapMin);
- denominatorGapMin = mathData->getMathConstant(primaryFont, display ? OpenTypeMathData::FractionDenomDisplayStyleGapMin : OpenTypeMathData::FractionDenominatorGapMin);
- numeratorMinShiftUp = mathData->getMathConstant(primaryFont, display ? OpenTypeMathData::FractionNumeratorDisplayStyleShiftUp : OpenTypeMathData::FractionNumeratorShiftUp);
- denominatorMinShiftDown = mathData->getMathConstant(primaryFont, display ? OpenTypeMathData::FractionDenominatorDisplayStyleShiftDown : OpenTypeMathData::FractionDenominatorShiftDown);
</del><ins>+ parameters.numeratorGapMin = mathData->getMathConstant(primaryFont, display ? OpenTypeMathData::FractionNumDisplayStyleGapMin : OpenTypeMathData::FractionNumeratorGapMin);
+ parameters.denominatorGapMin = mathData->getMathConstant(primaryFont, display ? OpenTypeMathData::FractionDenomDisplayStyleGapMin : OpenTypeMathData::FractionDenominatorGapMin);
+ parameters.numeratorMinShiftUp = mathData->getMathConstant(primaryFont, display ? OpenTypeMathData::FractionNumeratorDisplayStyleShiftUp : OpenTypeMathData::FractionNumeratorShiftUp);
+ parameters.denominatorMinShiftDown = mathData->getMathConstant(primaryFont, display ? OpenTypeMathData::FractionDenominatorDisplayStyleShiftDown : OpenTypeMathData::FractionDenominatorShiftDown);
</ins><span class="cx"> } else {
</span><span class="cx"> // The MATH table specification suggests default rule thickness or (in displaystyle) 3 times default rule thickness for the gaps.
</span><del>- numeratorGapMin = display ? 3 * ruleThicknessFallback() : ruleThicknessFallback();
- denominatorGapMin = numeratorGapMin;
</del><ins>+ parameters.numeratorGapMin = display ? 3 * ruleThicknessFallback() : ruleThicknessFallback();
+ parameters.denominatorGapMin = parameters.numeratorGapMin;
</ins><span class="cx">
</span><span class="cx"> // The MATH table specification does not suggest any values for shifts, so we leave them at zero.
</span><del>- numeratorMinShiftUp = 0;
- denominatorMinShiftDown = 0;
</del><ins>+ parameters.numeratorMinShiftUp = 0;
+ parameters.denominatorMinShiftDown = 0;
</ins><span class="cx"> }
</span><ins>+
+ return parameters;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderMathMLFraction::getStackParameters(LayoutUnit& gapMin, LayoutUnit& topShiftUp, LayoutUnit& bottomShiftDown)
</del><ins>+RenderMathMLFraction::StackParameters RenderMathMLFraction::stackParameters()
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isStack());
</span><del>-
</del><ins>+ StackParameters parameters;
+
</ins><span class="cx"> // We try and read constants to draw the stack from the OpenType MATH and use fallback values otherwise.
</span><span class="cx"> const auto& primaryFont = style().fontCascade().primaryFont();
</span><span class="cx"> const auto* mathData = style().fontCascade().primaryFont().mathData();
</span><span class="cx"> bool display = mathMLStyle()->displayStyle();
</span><span class="cx"> if (mathData) {
</span><del>- gapMin = mathData->getMathConstant(primaryFont, display ? OpenTypeMathData::StackDisplayStyleGapMin : OpenTypeMathData::StackGapMin);
- topShiftUp = mathData->getMathConstant(primaryFont, display ? OpenTypeMathData::StackTopDisplayStyleShiftUp : OpenTypeMathData::StackTopShiftUp);
- bottomShiftDown = mathData->getMathConstant(primaryFont, display ? OpenTypeMathData::StackBottomDisplayStyleShiftDown : OpenTypeMathData::StackBottomShiftDown);
</del><ins>+ parameters.gapMin = mathData->getMathConstant(primaryFont, display ? OpenTypeMathData::StackDisplayStyleGapMin : OpenTypeMathData::StackGapMin);
+ parameters.topShiftUp = mathData->getMathConstant(primaryFont, display ? OpenTypeMathData::StackTopDisplayStyleShiftUp : OpenTypeMathData::StackTopShiftUp);
+ parameters.bottomShiftDown = mathData->getMathConstant(primaryFont, display ? OpenTypeMathData::StackBottomDisplayStyleShiftDown : OpenTypeMathData::StackBottomShiftDown);
</ins><span class="cx"> } else {
</span><span class="cx"> // We use the values suggested in the MATH table specification.
</span><del>- gapMin = display ? 7 * ruleThicknessFallback() : 3 * ruleThicknessFallback();
</del><ins>+ parameters.gapMin = display ? 7 * ruleThicknessFallback() : 3 * ruleThicknessFallback();
</ins><span class="cx">
</span><span class="cx"> // The MATH table specification does not suggest any values for shifts, so we leave them at zero.
</span><del>- topShiftUp = 0;
- bottomShiftDown = 0;
</del><ins>+ parameters.topShiftUp = 0;
+ parameters.bottomShiftDown = 0;
</ins><span class="cx"> }
</span><ins>+
+ return parameters;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RenderMathMLOperator* RenderMathMLFraction::unembellishedOperator()
</span><span class="lines">@@ -195,24 +201,22 @@
</span><span class="cx"> LayoutUnit denominatorAscent = ascentForChild(denominator());
</span><span class="cx"> LayoutUnit denominatorDescent = denominator().logicalHeight() - denominatorAscent;
</span><span class="cx"> if (isStack()) {
</span><del>- LayoutUnit gapMin, topShiftUp, bottomShiftDown;
- getStackParameters(gapMin, topShiftUp, bottomShiftDown);
- LayoutUnit gap = topShiftUp - numeratorDescent + bottomShiftDown - denominatorAscent;
- if (gap < gapMin) {
</del><ins>+ StackParameters parameters = stackParameters();
+ LayoutUnit gap = parameters.topShiftUp - numeratorDescent + parameters.bottomShiftDown - denominatorAscent;
+ if (gap < parameters.gapMin) {
</ins><span class="cx"> // If the gap is not large enough, we increase the shifts by the same value.
</span><del>- LayoutUnit delta = (gapMin - gap) / 2;
- topShiftUp += delta;
- bottomShiftDown += delta;
</del><ins>+ LayoutUnit delta = (parameters.gapMin - gap) / 2;
+ parameters.topShiftUp += delta;
+ parameters.bottomShiftDown += delta;
</ins><span class="cx"> }
</span><del>- verticalOffset += numeratorAscent + topShiftUp; // This is the middle of the stack gap.
</del><ins>+ verticalOffset += numeratorAscent + parameters.topShiftUp; // This is the middle of the stack gap.
</ins><span class="cx"> m_ascent = verticalOffset + mathAxisHeight();
</span><del>- verticalOffset += bottomShiftDown - denominatorAscent;
</del><ins>+ verticalOffset += parameters.bottomShiftDown - denominatorAscent;
</ins><span class="cx"> } else {
</span><del>- LayoutUnit numeratorGapMin, denominatorGapMin, numeratorMinShiftUp, denominatorMinShiftDown;
- getFractionParameters(numeratorGapMin, denominatorGapMin, numeratorMinShiftUp, denominatorMinShiftDown);
- verticalOffset += std::max(numerator().logicalHeight() + numeratorGapMin + m_lineThickness / 2, numeratorAscent + numeratorMinShiftUp); // This is the middle of the fraction bar.
</del><ins>+ FractionParameters parameters = fractionParameters();
+ verticalOffset += std::max(numerator().logicalHeight() + parameters.numeratorGapMin + m_lineThickness / 2, numeratorAscent + parameters.numeratorMinShiftUp); // This is the middle of the fraction bar.
</ins><span class="cx"> m_ascent = verticalOffset + mathAxisHeight();
</span><del>- verticalOffset += std::max(m_lineThickness / 2 + denominatorGapMin, denominatorMinShiftDown - denominatorAscent);
</del><ins>+ verticalOffset += std::max(m_lineThickness / 2 + parameters.denominatorGapMin, parameters.denominatorMinShiftDown - denominatorAscent);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> LayoutPoint denominatorLocation(horizontalOffset(denominator(), element().denominatorAlignment()), verticalOffset);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLFractionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h (205104 => 205105)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h        2016-08-28 16:54:43 UTC (rev 205104)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h        2016-08-28 17:36:05 UTC (rev 205105)
</span><span class="lines">@@ -60,8 +60,19 @@
</span><span class="cx"> RenderBox& denominator() const;
</span><span class="cx"> LayoutUnit horizontalOffset(RenderBox&, MathMLFractionElement::FractionAlignment);
</span><span class="cx"> void updateLineThickness();
</span><del>- void getFractionParameters(LayoutUnit& numeratorGapMin, LayoutUnit& denominatorGapMin, LayoutUnit& numeratorMinShiftUp, LayoutUnit& denominatorMinShiftDown);
- void getStackParameters(LayoutUnit& gapMin, LayoutUnit& topShiftUp, LayoutUnit& bottomShiftDown);
</del><ins>+ struct FractionParameters {
+ LayoutUnit numeratorGapMin;
+ LayoutUnit denominatorGapMin;
+ LayoutUnit numeratorMinShiftUp;
+ LayoutUnit denominatorMinShiftDown;
+ };
+ FractionParameters fractionParameters();
+ struct StackParameters {
+ LayoutUnit gapMin;
+ LayoutUnit topShiftUp;
+ LayoutUnit bottomShiftDown;
+ };
+ StackParameters stackParameters();
</ins><span class="cx">
</span><span class="cx"> LayoutUnit m_ascent;
</span><span class="cx"> LayoutUnit m_defaultLineThickness { 1 };
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLMenclosecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp (205104 => 205105)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp        2016-08-28 16:54:43 UTC (rev 205104)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp        2016-08-28 17:36:05 UTC (rev 205105)
</span><span class="lines">@@ -59,12 +59,15 @@
</span><span class="cx"> return 0.05f * style().fontCascade().size();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderMathMLMenclose::getSpaceAroundContent(LayoutUnit contentWidth, LayoutUnit contentHeight, LayoutUnit& leftSpace, LayoutUnit& rightSpace, LayoutUnit& topSpace, LayoutUnit& bottomSpace) const
</del><ins>+RenderMathMLMenclose::SpaceAroundContent RenderMathMLMenclose::spaceAroundContent(LayoutUnit contentWidth, LayoutUnit contentHeight) const
</ins><span class="cx"> {
</span><del>- leftSpace = rightSpace = topSpace = bottomSpace = 0;
</del><ins>+ SpaceAroundContent space;
+ space.right = 0;
+ space.top = 0;
+ space.bottom = 0;
+ space.left = 0;
</ins><span class="cx">
</span><span class="cx"> LayoutUnit thickness = ruleThickness();
</span><del>-
</del><span class="cx"> // In the MathML in HTML5 implementation note, the "left" notation is described as follows:
</span><span class="cx"> // - left side is 3\xi_8 padding + \xi_8 border + \xi_8 margin = 5\xi_8
</span><span class="cx"> // - top space is Overbar Vertical Gap + Overbar Rule Thickness = 3\xi_8 + \xi_8 = 4\xi_8
</span><span class="lines">@@ -71,13 +74,13 @@
</span><span class="cx"> // - bottom space is Underbar Vertical Gap + Underbar Rule Thickness = 3\xi_8 + \xi_8 = 4\xi_8
</span><span class="cx"> // The "right" notation is symmetric.
</span><span class="cx"> if (hasNotation(MathMLMencloseElement::Left))
</span><del>- leftSpace = std::max(leftSpace, 5 * thickness);
</del><ins>+ space.left = std::max(space.left, 5 * thickness);
</ins><span class="cx"> if (hasNotation(MathMLMencloseElement::Right))
</span><del>- rightSpace = std::max(rightSpace, 5 * thickness);
</del><ins>+ space.right = std::max(space.right, 5 * thickness);
</ins><span class="cx"> if (hasNotation(MathMLMencloseElement::Left) || hasNotation(MathMLMencloseElement::Right)) {
</span><span class="cx"> LayoutUnit extraSpace = 4 * thickness;
</span><del>- topSpace = std::max(topSpace, extraSpace);
- bottomSpace = std::max(bottomSpace, extraSpace);
</del><ins>+ space.top = std::max(space.top, extraSpace);
+ space.bottom = std::max(space.bottom, extraSpace);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // In the MathML in HTML5 implementation note, the "top" notation is described as follows:
</span><span class="lines">@@ -85,13 +88,13 @@
</span><span class="cx"> // - top side is Vertical Gap + Rule Thickness + Extra Ascender = 3\xi_8 + \xi_8 + \xi_8 = 5\xi_8
</span><span class="cx"> // The "bottom" notation is symmetric.
</span><span class="cx"> if (hasNotation(MathMLMencloseElement::Top))
</span><del>- topSpace = std::max(topSpace, 5 * thickness);
</del><ins>+ space.top = std::max(space.top, 5 * thickness);
</ins><span class="cx"> if (hasNotation(MathMLMencloseElement::Bottom))
</span><del>- bottomSpace = std::max(bottomSpace, 5 * thickness);
</del><ins>+ space.bottom = std::max(space.bottom, 5 * thickness);
</ins><span class="cx"> if (hasNotation(MathMLMencloseElement::Top) || hasNotation(MathMLMencloseElement::Bottom)) {
</span><span class="cx"> LayoutUnit extraSpace = 4 * thickness;
</span><del>- leftSpace = std::max(leftSpace, extraSpace);
- rightSpace = std::max(rightSpace, extraSpace);
</del><ins>+ space.left = std::max(space.left, extraSpace);
+ space.right = std::max(space.right, extraSpace);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // For longdiv, we use our own rules for now:
</span><span class="lines">@@ -100,10 +103,10 @@
</span><span class="cx"> // - right space is like "right" notation
</span><span class="cx"> // - left space is longDivLeftSpace * \xi_8
</span><span class="cx"> if (hasNotation(MathMLMencloseElement::LongDiv)) {
</span><del>- topSpace = std::max(topSpace, 5 * thickness);
- bottomSpace = std::max(bottomSpace, 5 * thickness);
- leftSpace = std::max(leftSpace, longDivLeftSpace * thickness);
- rightSpace = std::max(rightSpace, 4 * thickness);
</del><ins>+ space.top = std::max(space.top, 5 * thickness);
+ space.bottom = std::max(space.bottom, 5 * thickness);
+ space.left = std::max(space.left, longDivLeftSpace * thickness);
+ space.right = std::max(space.right, 4 * thickness);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // In the MathML in HTML5 implementation note, the "rounded" notation is described as follows:
</span><span class="lines">@@ -110,10 +113,10 @@
</span><span class="cx"> // - top/bottom/left/right side have 3\xi_8 padding + \xi_8 border + \xi_8 margin = 5\xi_8
</span><span class="cx"> if (hasNotation(MathMLMencloseElement::RoundedBox)) {
</span><span class="cx"> LayoutUnit extraSpace = 5 * thickness;
</span><del>- leftSpace = std::max(leftSpace, extraSpace);
- rightSpace = std::max(rightSpace, extraSpace);
- topSpace = std::max(topSpace, extraSpace);
- bottomSpace = std::max(bottomSpace, extraSpace);
</del><ins>+ space.left = std::max(space.left, extraSpace);
+ space.right = std::max(space.right, extraSpace);
+ space.top = std::max(space.top, extraSpace);
+ space.bottom = std::max(space.bottom, extraSpace);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // In the MathML in HTML5 implementation note, the "rounded" notation is described as follows:
</span><span class="lines">@@ -120,10 +123,10 @@
</span><span class="cx"> // - top/bottom/left/right spaces are \xi_8/2
</span><span class="cx"> if (hasNotation(MathMLMencloseElement::UpDiagonalStrike) || hasNotation(MathMLMencloseElement::DownDiagonalStrike)) {
</span><span class="cx"> LayoutUnit extraSpace = thickness / 2;
</span><del>- leftSpace = std::max(leftSpace, extraSpace);
- rightSpace = std::max(rightSpace, extraSpace);
- topSpace = std::max(topSpace, extraSpace);
- bottomSpace = std::max(bottomSpace, extraSpace);
</del><ins>+ space.left = std::max(space.left, extraSpace);
+ space.right = std::max(space.right, extraSpace);
+ space.top = std::max(space.top, extraSpace);
+ space.bottom = std::max(space.bottom, extraSpace);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // In the MathML in HTML5 implementation note, the "circle" notation is described as follows:
</span><span class="lines">@@ -134,14 +137,16 @@
</span><span class="cx"> // Then for example the top space is \sqrt{2}contentHeight/2 - contentHeight/2 + \xi_8/2 + \xi_8.
</span><span class="cx"> if (hasNotation(MathMLMencloseElement::Circle)) {
</span><span class="cx"> LayoutUnit extraSpace = (contentWidth * (sqrtOfTwoFloat - 1) + 3 * thickness) / 2;
</span><del>- leftSpace = std::max(leftSpace, extraSpace);
- rightSpace = std::max(rightSpace, extraSpace);
</del><ins>+ space.left = std::max(space.left, extraSpace);
+ space.right = std::max(space.right, extraSpace);
</ins><span class="cx"> extraSpace = (contentHeight * (sqrtOfTwoFloat - 1) + 3 * thickness) / 2;
</span><del>- topSpace = std::max(topSpace, extraSpace);
- bottomSpace = std::max(bottomSpace, extraSpace);
</del><ins>+ space.top = std::max(space.top, extraSpace);
+ space.bottom = std::max(space.bottom, extraSpace);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // In the MathML in HTML5 implementation note, the "vertical" and "horizontal" notations do not add space around the content.
</span><ins>+
+ return space;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderMathMLMenclose::computePreferredLogicalWidths()
</span><span class="lines">@@ -151,9 +156,9 @@
</span><span class="cx"> RenderMathMLRow::computePreferredLogicalWidths();
</span><span class="cx">
</span><span class="cx"> LayoutUnit preferredWidth = m_maxPreferredLogicalWidth;
</span><del>- LayoutUnit leftSpace, rightSpace, dummy;
- getSpaceAroundContent(preferredWidth, 0, leftSpace, rightSpace, dummy, dummy);
- m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = leftSpace + preferredWidth + rightSpace;
</del><ins>+ SpaceAroundContent space = spaceAroundContent(preferredWidth, 0);
+ m_maxPreferredLogicalWidth = space.left + preferredWidth + space.right;
+ m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth;
</ins><span class="cx">
</span><span class="cx"> setPreferredLogicalWidthsDirty(false);
</span><span class="cx"> }
</span><span class="lines">@@ -171,16 +176,15 @@
</span><span class="cx"> RenderMathMLRow::layoutRowItems(contentAscent, contentDescent);
</span><span class="cx"> LayoutUnit contentWidth = logicalWidth();
</span><span class="cx">
</span><del>- LayoutUnit leftSpace, rightSpace, topSpace, bottomSpace;
- getSpaceAroundContent(contentWidth, contentAscent + contentDescent, leftSpace, rightSpace, topSpace, bottomSpace);
- setLogicalWidth(leftSpace + contentWidth + rightSpace);
- setLogicalHeight(topSpace + contentAscent + contentDescent + bottomSpace);
</del><ins>+ SpaceAroundContent space = spaceAroundContent(contentWidth, contentAscent + contentDescent);
+ setLogicalWidth(space.left + contentWidth + space.right);
+ setLogicalHeight(space.top + contentAscent + contentDescent + space.bottom);
</ins><span class="cx">
</span><del>- LayoutPoint contentLocation(leftSpace, topSpace);
</del><ins>+ LayoutPoint contentLocation(space.left, space.top);
</ins><span class="cx"> for (auto* child = firstChildBox(); child; child = child->nextSiblingBox())
</span><span class="cx"> child->setLocation(child->location() + contentLocation);
</span><span class="cx">
</span><del>- m_contentRect = LayoutRect(leftSpace, topSpace, contentWidth, contentAscent + contentDescent);
</del><ins>+ m_contentRect = LayoutRect(space.left, space.top, contentWidth, contentAscent + contentDescent);
</ins><span class="cx">
</span><span class="cx"> clearNeedsLayout();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLMencloseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h (205104 => 205105)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h        2016-08-28 16:54:43 UTC (rev 205104)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h        2016-08-28 17:36:05 UTC (rev 205105)
</span><span class="lines">@@ -46,7 +46,13 @@
</span><span class="cx"> LayoutUnit ruleThickness() const;
</span><span class="cx"> bool hasNotation(MathMLMencloseElement::MencloseNotationFlag notationFlag) const { return downcast<MathMLMencloseElement>(element()).hasNotation(notationFlag); }
</span><span class="cx">
</span><del>- void getSpaceAroundContent(LayoutUnit contentWidth, LayoutUnit contentHeight, LayoutUnit& leftSpace, LayoutUnit& rightSpace, LayoutUnit& topSpace, LayoutUnit& bottomSpace) const;
</del><ins>+ struct SpaceAroundContent {
+ LayoutUnit left;
+ LayoutUnit right;
+ LayoutUnit top;
+ LayoutUnit bottom;
+ };
+ SpaceAroundContent spaceAroundContent(LayoutUnit contentWidth, LayoutUnit contentHeight) const;
</ins><span class="cx">
</span><span class="cx"> LayoutRect m_contentRect;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLScriptscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp (205104 => 205105)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp        2016-08-28 16:54:43 UTC (rev 205104)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp        2016-08-28 17:36:05 UTC (rev 205105)
</span><span class="lines">@@ -216,7 +216,7 @@
</span><span class="cx"> m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded(RenderBox* base, RenderBox* script, LayoutUnit& minSubScriptShift, LayoutUnit& minSupScriptShift, LayoutUnit& maxScriptDescent, LayoutUnit& maxScriptAscent)
</del><ins>+void RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded(RenderBox* base, RenderBox* script, ScriptMetrics& metrics)
</ins><span class="cx"> {
</span><span class="cx"> LayoutUnit baseAscent = ascentForChild(*base);
</span><span class="cx"> LayoutUnit baseDescent = base->logicalHeight() - baseAscent;
</span><span class="lines">@@ -252,21 +252,21 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (m_scriptType == Sub || m_scriptType == SubSup || m_scriptType == Multiscripts || m_scriptType == Under || m_scriptType == UnderOver) {
</span><del>- minSubScriptShift = std::max(subscriptShiftDown, baseDescent + subscriptBaselineDropMin);
</del><ins>+ metrics.subShift = std::max(subscriptShiftDown, baseDescent + subscriptBaselineDropMin);
</ins><span class="cx"> if (!isRenderMathMLUnderOver()) {
</span><span class="cx"> // It is not clear how to interpret the default shift and it is not available yet anyway.
</span><span class="cx"> // Hence we just pass 0 as the default value used by toUserUnits.
</span><span class="cx"> LayoutUnit specifiedMinSubShift = toUserUnits(element().subscriptShift(), style(), 0);
</span><del>- minSubScriptShift = std::max(minSubScriptShift, specifiedMinSubShift);
</del><ins>+ metrics.subShift = std::max(metrics.subShift, specifiedMinSubShift);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> if (m_scriptType == Super || m_scriptType == SubSup || m_scriptType == Multiscripts || m_scriptType == Over || m_scriptType == UnderOver) {
</span><del>- minSupScriptShift = std::max(superscriptShiftUp, baseAscent - superScriptBaselineDropMax);
</del><ins>+ metrics.supShift = std::max(superscriptShiftUp, baseAscent - superScriptBaselineDropMax);
</ins><span class="cx"> if (!isRenderMathMLUnderOver()) {
</span><span class="cx"> // It is not clear how to interpret the default shift and it is not available yet anyway.
</span><span class="cx"> // Hence we just pass 0 as the default value used by toUserUnits.
</span><span class="cx"> LayoutUnit specifiedMinSupShift = toUserUnits(element().superscriptShift(), style(), 0);
</span><del>- minSupScriptShift = std::max(minSupScriptShift, specifiedMinSupShift);
</del><ins>+ metrics.supShift = std::max(metrics.supShift, specifiedMinSupShift);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -276,8 +276,8 @@
</span><span class="cx"> script->layoutIfNeeded();
</span><span class="cx"> LayoutUnit subAscent = ascentForChild(*script);
</span><span class="cx"> LayoutUnit subDescent = script->logicalHeight() - subAscent;
</span><del>- maxScriptDescent = subDescent;
- minSubScriptShift = std::max(minSubScriptShift, subAscent - subscriptTopMax);
</del><ins>+ metrics.descent = subDescent;
+ metrics.subShift = std::max(metrics.subShift, subAscent - subscriptTopMax);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case Super:
</span><span class="lines">@@ -285,8 +285,8 @@
</span><span class="cx"> script->layoutIfNeeded();
</span><span class="cx"> LayoutUnit supAscent = ascentForChild(*script);
</span><span class="cx"> LayoutUnit supDescent = script->logicalHeight() - supAscent;
</span><del>- maxScriptAscent = supAscent;
- minSupScriptShift = std::max(minSupScriptShift, superscriptBottomMin + supDescent);
</del><ins>+ metrics.ascent = supAscent;
+ metrics.supShift = std::max(metrics.supShift, superscriptBottomMin + supDescent);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case SubSup:
</span><span class="lines">@@ -302,8 +302,8 @@
</span><span class="cx"> LayoutUnit subDescent = subScript->logicalHeight() - subAscent;
</span><span class="cx"> LayoutUnit supAscent = ascentForChild(*supScript);
</span><span class="cx"> LayoutUnit supDescent = supScript->logicalHeight() - supAscent;
</span><del>- maxScriptAscent = std::max(maxScriptAscent, supAscent);
- maxScriptDescent = std::max(maxScriptDescent, subDescent);
</del><ins>+ metrics.ascent = std::max(metrics.ascent, supAscent);
+ metrics.descent = std::max(metrics.descent, subDescent);
</ins><span class="cx"> LayoutUnit subScriptShift = std::max(subscriptShiftDown, baseDescent + subscriptBaselineDropMin);
</span><span class="cx"> subScriptShift = std::max(subScriptShift, subAscent - subscriptTopMax);
</span><span class="cx"> LayoutUnit supScriptShift = std::max(superscriptShiftUp, baseAscent - superScriptBaselineDropMax);
</span><span class="lines">@@ -323,8 +323,8 @@
</span><span class="cx"> subScriptShift += subSuperscriptGapMin - subSuperscriptGap;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- minSubScriptShift = std::max(minSubScriptShift, subScriptShift);
- minSupScriptShift = std::max(minSupScriptShift, supScriptShift);
</del><ins>+ metrics.subShift = std::max(metrics.subShift, subScriptShift);
+ metrics.supShift = std::max(metrics.supShift, supScriptShift);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -349,15 +349,17 @@
</span><span class="cx"> recomputeLogicalWidth();
</span><span class="cx"> base->layoutIfNeeded();
</span><span class="cx">
</span><del>- LayoutUnit supScriptShift = 0;
- LayoutUnit subScriptShift = 0;
- LayoutUnit scriptDescent = 0;
- LayoutUnit scriptAscent = 0;
</del><span class="cx"> LayoutUnit space = spaceAfterScript();
</span><span class="cx">
</span><ins>+ // We determine the minimal shift/size of each script and take the maximum of the values.
+ ScriptMetrics metrics;
+ metrics.subShift = 0;
+ metrics.supShift = 0;
+ metrics.descent = 0;
+ metrics.ascent = 0;
</ins><span class="cx"> if (m_scriptType == Multiscripts)
</span><del>- getScriptMetricsAndLayoutIfNeeded(base, firstPreScript, subScriptShift, supScriptShift, scriptDescent, scriptAscent);
- getScriptMetricsAndLayoutIfNeeded(base, firstPostScript, subScriptShift, supScriptShift, scriptDescent, scriptAscent);
</del><ins>+ getScriptMetricsAndLayoutIfNeeded(base, firstPreScript, metrics);
+ getScriptMetricsAndLayoutIfNeeded(base, firstPostScript, metrics);
</ins><span class="cx">
</span><span class="cx"> LayoutUnit baseAscent = ascentForChild(*base);
</span><span class="cx"> LayoutUnit baseDescent = base->logicalHeight() - baseAscent;
</span><span class="lines">@@ -364,8 +366,8 @@
</span><span class="cx"> LayoutUnit baseItalicCorrection = std::min(base->logicalWidth(), italicCorrection(base));
</span><span class="cx"> LayoutUnit horizontalOffset = 0;
</span><span class="cx">
</span><del>- LayoutUnit ascent = std::max(baseAscent, scriptAscent + supScriptShift);
- LayoutUnit descent = std::max(baseDescent, scriptDescent + subScriptShift);
</del><ins>+ LayoutUnit ascent = std::max(baseAscent, metrics.ascent + metrics.supShift);
+ LayoutUnit descent = std::max(baseDescent, metrics.descent + metrics.subShift);
</ins><span class="cx"> setLogicalHeight(ascent + descent);
</span><span class="cx">
</span><span class="cx"> switch (m_scriptType) {
</span><span class="lines">@@ -376,7 +378,7 @@
</span><span class="cx"> base->setLocation(baseLocation);
</span><span class="cx"> horizontalOffset += base->logicalWidth();
</span><span class="cx"> LayoutUnit scriptAscent = ascentForChild(*firstPostScript);
</span><del>- LayoutPoint scriptLocation(mirrorIfNeeded(horizontalOffset - baseItalicCorrection, *firstPostScript), ascent + subScriptShift - scriptAscent);
</del><ins>+ LayoutPoint scriptLocation(mirrorIfNeeded(horizontalOffset - baseItalicCorrection, *firstPostScript), ascent + metrics.subShift - scriptAscent);
</ins><span class="cx"> firstPostScript->setLocation(scriptLocation);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="lines">@@ -387,7 +389,7 @@
</span><span class="cx"> base->setLocation(baseLocation);
</span><span class="cx"> horizontalOffset += base->logicalWidth();
</span><span class="cx"> LayoutUnit scriptAscent = ascentForChild(*firstPostScript);
</span><del>- LayoutPoint scriptLocation(mirrorIfNeeded(horizontalOffset, *firstPostScript), ascent - supScriptShift - scriptAscent);
</del><ins>+ LayoutPoint scriptLocation(mirrorIfNeeded(horizontalOffset, *firstPostScript), ascent - metrics.supShift - scriptAscent);
</ins><span class="cx"> firstPostScript->setLocation(scriptLocation);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="lines">@@ -419,10 +421,10 @@
</span><span class="cx"> LayoutUnit subSupPairWidth = std::max(subScript->logicalWidth(), supScript->logicalWidth());
</span><span class="cx"> horizontalOffset += space + subSupPairWidth;
</span><span class="cx"> LayoutUnit subAscent = ascentForChild(*subScript);
</span><del>- LayoutPoint subScriptLocation(mirrorIfNeeded(horizontalOffset - subScript->logicalWidth(), *subScript), ascent + subScriptShift - subAscent);
</del><ins>+ LayoutPoint subScriptLocation(mirrorIfNeeded(horizontalOffset - subScript->logicalWidth(), *subScript), ascent + metrics.subShift - subAscent);
</ins><span class="cx"> subScript->setLocation(subScriptLocation);
</span><span class="cx"> LayoutUnit supAscent = ascentForChild(*supScript);
</span><del>- LayoutPoint supScriptLocation(mirrorIfNeeded(horizontalOffset - supScript->logicalWidth(), *supScript), ascent - supScriptShift - supAscent);
</del><ins>+ LayoutPoint supScriptLocation(mirrorIfNeeded(horizontalOffset - supScript->logicalWidth(), *supScript), ascent - metrics.supShift - supAscent);
</ins><span class="cx"> supScript->setLocation(supScriptLocation);
</span><span class="cx"> }
</span><span class="cx"> LayoutPoint baseLocation(mirrorIfNeeded(horizontalOffset, *base), ascent - baseAscent);
</span><span class="lines">@@ -432,10 +434,10 @@
</span><span class="cx"> supScript = subScript->nextSiblingBox();
</span><span class="cx"> ASSERT(supScript);
</span><span class="cx"> LayoutUnit subAscent = ascentForChild(*subScript);
</span><del>- LayoutPoint subScriptLocation(mirrorIfNeeded(horizontalOffset - baseItalicCorrection, *subScript), ascent + subScriptShift - subAscent);
</del><ins>+ LayoutPoint subScriptLocation(mirrorIfNeeded(horizontalOffset - baseItalicCorrection, *subScript), ascent + metrics.subShift - subAscent);
</ins><span class="cx"> subScript->setLocation(subScriptLocation);
</span><span class="cx"> LayoutUnit supAscent = ascentForChild(*supScript);
</span><del>- LayoutPoint supScriptLocation(mirrorIfNeeded(horizontalOffset, *supScript), ascent - supScriptShift - supAscent);
</del><ins>+ LayoutPoint supScriptLocation(mirrorIfNeeded(horizontalOffset, *supScript), ascent - metrics.supShift - supAscent);
</ins><span class="cx"> supScript->setLocation(supScriptLocation);
</span><span class="cx">
</span><span class="cx"> LayoutUnit subSupPairWidth = std::max(subScript->logicalWidth(), supScript->logicalWidth());
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLScriptsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.h (205104 => 205105)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.h        2016-08-28 16:54:43 UTC (rev 205104)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.h        2016-08-28 17:36:05 UTC (rev 205105)
</span><span class="lines">@@ -56,7 +56,13 @@
</span><span class="cx"> bool getBaseAndScripts(RenderBox*& base, RenderBox*& firstPostScript, RenderBox*& firstPreScript);
</span><span class="cx"> LayoutUnit spaceAfterScript();
</span><span class="cx"> LayoutUnit italicCorrection(RenderBox* base);
</span><del>- void getScriptMetricsAndLayoutIfNeeded(RenderBox* base, RenderBox* script, LayoutUnit& minSubScriptShift, LayoutUnit& minSupScriptShift, LayoutUnit& maxScriptDescent, LayoutUnit& maxScriptAscent);
</del><ins>+ struct ScriptMetrics {
+ LayoutUnit subShift;
+ LayoutUnit supShift;
+ LayoutUnit ascent;
+ LayoutUnit descent;
+ };
+ void getScriptMetricsAndLayoutIfNeeded(RenderBox* base, RenderBox* script, ScriptMetrics&);
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLUnderOvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp (205104 => 205105)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp        2016-08-28 16:54:43 UTC (rev 205104)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp        2016-08-28 17:36:05 UTC (rev 205105)
</span><span class="lines">@@ -179,10 +179,18 @@
</span><span class="cx"> return scriptOperator && scriptOperator->hasOperatorFlag(MathMLOperatorDictionary::Accent);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool RenderMathMLUnderOver::getVerticalParameters(LayoutUnit& underGapMin, LayoutUnit& overGapMin, LayoutUnit& underShiftMin, LayoutUnit& overShiftMin, LayoutUnit& underExtraDescender, LayoutUnit& overExtraAscender, LayoutUnit& accentBaseHeight) const
</del><ins>+RenderMathMLUnderOver::VerticalParameters RenderMathMLUnderOver::verticalParameters() const
</ins><span class="cx"> {
</span><ins>+ VerticalParameters parameters;
+
</ins><span class="cx"> // By default, we set all values to zero.
</span><del>- underGapMin = overGapMin = underShiftMin = overShiftMin = underExtraDescender = overExtraAscender = accentBaseHeight = 0;
</del><ins>+ parameters.underGapMin = 0;
+ parameters.overGapMin = 0;
+ parameters.underShiftMin = 0;
+ parameters.overShiftMin = 0;
+ parameters.underExtraDescender = 0;
+ parameters.overExtraAscender = 0;
+ parameters.accentBaseHeight = 0;
</ins><span class="cx">
</span><span class="cx"> const auto& primaryFont = style().fontCascade().primaryFont();
</span><span class="cx"> auto* mathData = primaryFont.mathData();
</span><span class="lines">@@ -189,10 +197,13 @@
</span><span class="cx"> if (!mathData) {
</span><span class="cx"> // The MATH table specification does not really provide any suggestions, except for some underbar/overbar values and AccentBaseHeight.
</span><span class="cx"> LayoutUnit defaultLineThickness = ruleThicknessFallback();
</span><del>- underGapMin = overGapMin = 3 * defaultLineThickness;
- underExtraDescender = overExtraAscender = defaultLineThickness;
- accentBaseHeight = style().fontMetrics().xHeight();
- return true;
</del><ins>+ parameters.underGapMin = 3 * defaultLineThickness;
+ parameters.overGapMin = 3 * defaultLineThickness;
+ parameters.underExtraDescender = defaultLineThickness;
+ parameters.overExtraAscender = defaultLineThickness;
+ parameters.accentBaseHeight = style().fontMetrics().xHeight();
+ parameters.useUnderOverBarFallBack = true;
+ return parameters;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (is<RenderMathMLBlock>(base())) {
</span><span class="lines">@@ -199,30 +210,33 @@
</span><span class="cx"> if (auto* baseOperator = downcast<RenderMathMLBlock>(base()).unembellishedOperator()) {
</span><span class="cx"> if (baseOperator->hasOperatorFlag(MathMLOperatorDictionary::LargeOp)) {
</span><span class="cx"> // The base is a large operator so we read UpperLimit/LowerLimit constants from the MATH table.
</span><del>- underGapMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::LowerLimitGapMin);
- overGapMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::UpperLimitGapMin);
- underShiftMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::LowerLimitBaselineDropMin);
- overShiftMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::UpperLimitBaselineRiseMin);
- return false;
</del><ins>+ parameters.underGapMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::LowerLimitGapMin);
+ parameters.overGapMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::UpperLimitGapMin);
+ parameters.underShiftMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::LowerLimitBaselineDropMin);
+ parameters.overShiftMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::UpperLimitBaselineRiseMin);
+ parameters.useUnderOverBarFallBack = false;
+ return parameters;
</ins><span class="cx"> }
</span><span class="cx"> if (baseOperator->hasOperatorFlag(MathMLOperatorDictionary::Stretchy) && !baseOperator->isVertical()) {
</span><span class="cx"> // The base is a horizontal stretchy operator, so we read StretchStack constants from the MATH table.
</span><del>- underGapMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::StretchStackGapBelowMin);
- overGapMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::StretchStackGapAboveMin);
- underShiftMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::StretchStackBottomShiftDown);
- overShiftMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::StretchStackTopShiftUp);
- return false;
</del><ins>+ parameters.underGapMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::StretchStackGapBelowMin);
+ parameters.overGapMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::StretchStackGapAboveMin);
+ parameters.underShiftMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::StretchStackBottomShiftDown);
+ parameters.overShiftMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::StretchStackTopShiftUp);
+ parameters.useUnderOverBarFallBack = false;
+ return parameters;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // By default, we just use the underbar/overbar constants.
</span><del>- underGapMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::UnderbarVerticalGap);
- overGapMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::OverbarVerticalGap);
- underExtraDescender = mathData->getMathConstant(primaryFont, OpenTypeMathData::UnderbarExtraDescender);
- overExtraAscender = mathData->getMathConstant(primaryFont, OpenTypeMathData::OverbarExtraAscender);
- accentBaseHeight = mathData->getMathConstant(primaryFont, OpenTypeMathData::AccentBaseHeight);
- return true;
</del><ins>+ parameters.underGapMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::UnderbarVerticalGap);
+ parameters.overGapMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::OverbarVerticalGap);
+ parameters.underExtraDescender = mathData->getMathConstant(primaryFont, OpenTypeMathData::UnderbarExtraDescender);
+ parameters.overExtraAscender = mathData->getMathConstant(primaryFont, OpenTypeMathData::OverbarExtraAscender);
+ parameters.accentBaseHeight = mathData->getMathConstant(primaryFont, OpenTypeMathData::AccentBaseHeight);
+ parameters.useUnderOverBarFallBack = true;
+ return parameters;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderMathMLUnderOver::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight)
</span><span class="lines">@@ -261,38 +275,37 @@
</span><span class="cx"> logicalWidth = std::max(logicalWidth, over().logicalWidth());
</span><span class="cx"> setLogicalWidth(logicalWidth);
</span><span class="cx">
</span><del>- LayoutUnit underGapMin, overGapMin, underShiftMin, overShiftMin, underExtraDescender, overExtraAscender, accentBaseHeight;
- bool underOverBarFall = getVerticalParameters(underGapMin, overGapMin, underShiftMin, overShiftMin, underExtraDescender, overExtraAscender, accentBaseHeight);
</del><ins>+ VerticalParameters parameters = verticalParameters();
</ins><span class="cx"> LayoutUnit verticalOffset = 0;
</span><span class="cx"> if (m_scriptType == Over || m_scriptType == UnderOver) {
</span><del>- verticalOffset += overExtraAscender;
</del><ins>+ verticalOffset += parameters.overExtraAscender;
</ins><span class="cx"> over().setLocation(LayoutPoint(horizontalOffset(over()), verticalOffset));
</span><del>- if (underOverBarFall) {
</del><ins>+ if (parameters.useUnderOverBarFallBack) {
</ins><span class="cx"> verticalOffset += over().logicalHeight();
</span><span class="cx"> if (hasAccent()) {
</span><span class="cx"> LayoutUnit baseAscent = ascentForChild(base());
</span><del>- if (baseAscent < accentBaseHeight)
- verticalOffset += accentBaseHeight - baseAscent;
</del><ins>+ if (baseAscent < parameters.accentBaseHeight)
+ verticalOffset += parameters.accentBaseHeight - baseAscent;
</ins><span class="cx"> } else
</span><del>- verticalOffset += overGapMin;
</del><ins>+ verticalOffset += parameters.overGapMin;
</ins><span class="cx"> } else {
</span><span class="cx"> LayoutUnit overAscent = ascentForChild(over());
</span><del>- verticalOffset += std::max(over().logicalHeight() + overGapMin, overAscent + overShiftMin);
</del><ins>+ verticalOffset += std::max(over().logicalHeight() + parameters.overGapMin, overAscent + parameters.overShiftMin);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> base().setLocation(LayoutPoint(horizontalOffset(base()), verticalOffset));
</span><span class="cx"> verticalOffset += base().logicalHeight();
</span><span class="cx"> if (m_scriptType == Under || m_scriptType == UnderOver) {
</span><del>- if (underOverBarFall) {
</del><ins>+ if (parameters.useUnderOverBarFallBack) {
</ins><span class="cx"> if (!hasAccentUnder())
</span><del>- verticalOffset += underGapMin;
</del><ins>+ verticalOffset += parameters.underGapMin;
</ins><span class="cx"> } else {
</span><span class="cx"> LayoutUnit underAscent = ascentForChild(under());
</span><del>- verticalOffset += std::max(underGapMin, underShiftMin - underAscent);
</del><ins>+ verticalOffset += std::max(parameters.underGapMin, parameters.underShiftMin - underAscent);
</ins><span class="cx"> }
</span><span class="cx"> under().setLocation(LayoutPoint(horizontalOffset(under()), verticalOffset));
</span><span class="cx"> verticalOffset += under().logicalHeight();
</span><del>- verticalOffset += underExtraDescender;
</del><ins>+ verticalOffset += parameters.underExtraDescender;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> setLogicalHeight(verticalOffset);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLUnderOverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h (205104 => 205105)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h        2016-08-28 16:54:43 UTC (rev 205104)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h        2016-08-28 17:36:05 UTC (rev 205105)
</span><span class="lines">@@ -56,7 +56,17 @@
</span><span class="cx"> LayoutUnit horizontalOffset(const RenderBox&) const;
</span><span class="cx"> bool hasAccent(bool accentUnder = false) const;
</span><span class="cx"> bool hasAccentUnder() const { return hasAccent(true); };
</span><del>- bool getVerticalParameters(LayoutUnit& underGapMin, LayoutUnit& overGapMin, LayoutUnit& underShiftMin, LayoutUnit& overShiftMin, LayoutUnit& underExtraDescender, LayoutUnit& overExtraAscender, LayoutUnit& accentBaseHeight) const;
</del><ins>+ struct VerticalParameters {
+ bool useUnderOverBarFallBack;
+ LayoutUnit underGapMin;
+ LayoutUnit overGapMin;
+ LayoutUnit underShiftMin;
+ LayoutUnit overShiftMin;
+ LayoutUnit underExtraDescender;
+ LayoutUnit overExtraAscender;
+ LayoutUnit accentBaseHeight;
+ };
+ VerticalParameters verticalParameters() const;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>