<!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>[169617] 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/169617">169617</a></dd>
<dt>Author</dt> <dd>fred.wang@free.fr</dd>
<dt>Date</dt> <dd>2014-06-05 09:23:08 -0700 (Thu, 05 Jun 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Apply Character-level mirroring to stretchy operators in RTL mode.
https://bugs.webkit.org/show_bug.cgi?id=130839
Reviewed by Chris Fleizach.
Source/WebCore:
We add support for character-level mirroring for stretchy MathML operators in RTL mode.
Glyph-level mirroring (via the rtlm OpenType feature) will be handled in bug 130840.
Test: mathml/presentation/stretchy-rtl.html
* rendering/mathml/RenderMathMLOperator.cpp: reorganize the Unicode stretchyCharacters table to make mirroring easy.
(WebCore::RenderMathMLOperator::computePreferredLogicalWidths): pass the right boolean to glyphDataForCharacter.
(WebCore::RenderMathMLOperator::getDisplayStyleLargeOperator): ditto
(WebCore::RenderMathMLOperator::findStretchyData): ditto and change the index for the stretchyCharacters fallback.
(WebCore::RenderMathMLOperator::updateStyle): pass the right boolean to glyphDataForCharacter.
(WebCore::RenderMathMLOperator::paint): remove the FIXME comment.
(WebCore::RenderMathMLOperator::paintVerticalGlyphAssembly): switch the leading/trailing space in RTL mode.
LayoutTests:
Add some tests to verify that stretchy operators are correctly mirrored in RTL mode.
* mathml/presentation/stretchy-rtl-expected.html: Added.
* mathml/presentation/stretchy-rtl.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLOperatorcpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmathmlpresentationstretchyrtlexpectedhtml">trunk/LayoutTests/mathml/presentation/stretchy-rtl-expected.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationstretchyrtlhtml">trunk/LayoutTests/mathml/presentation/stretchy-rtl.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (169616 => 169617)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-06-05 16:16:16 UTC (rev 169616)
+++ trunk/LayoutTests/ChangeLog        2014-06-05 16:23:08 UTC (rev 169617)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-06-05 Frédéric Wang <fred.wang@free.fr>
+
+ Apply Character-level mirroring to stretchy operators in RTL mode.
+ https://bugs.webkit.org/show_bug.cgi?id=130839
+
+ Reviewed by Chris Fleizach.
+
+ Add some tests to verify that stretchy operators are correctly mirrored in RTL mode.
+
+ * mathml/presentation/stretchy-rtl-expected.html: Added.
+ * mathml/presentation/stretchy-rtl.html: Added.
+
</ins><span class="cx"> 2014-06-05 Zoltan Horvath <zoltan@webkit.org>
</span><span class="cx">
</span><span class="cx"> [CSS Regions][CSS Shapes] Add Shapes tests which flow through multiple regions
</span></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationstretchyrtlexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/stretchy-rtl-expected.html (0 => 169617)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/stretchy-rtl-expected.html         (rev 0)
+++ trunk/LayoutTests/mathml/presentation/stretchy-rtl-expected.html        2014-06-05 16:23:08 UTC (rev 169617)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<html>
+ <head>
+ <title>stretchy rtl</title>
+ <meta charset="utf-8">
+ </head>
+ <body>
+
+ <math dir="rtl"><mo>&#x230a;</mo><mo>&#x2308;</mo><mo>{</mo><mo>[</mo><mo rspace="3em">(</mo><mspace width="1em" height="2em" depth="2em" mathbackground="red"/><mo lspace="2em">)</mo><mo>]</mo><mo>}</mo><mo>&#x2309;</mo><mo>&#x230b;</mo></math>
+
+ </body>
+</html>
</ins><span class="cx">Property changes on: trunk/LayoutTests/mathml/presentation/stretchy-rtl-expected.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsmathmlpresentationstretchyrtlhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/stretchy-rtl.html (0 => 169617)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/stretchy-rtl.html         (rev 0)
+++ trunk/LayoutTests/mathml/presentation/stretchy-rtl.html        2014-06-05 16:23:08 UTC (rev 169617)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<html>
+ <head>
+ <title>stretchy rtl</title>
+ <meta charset="utf-8">
+ </head>
+ <body>
+
+ <!-- This tests stretchy operators in RTL mode. They should render the same as the symmetric LTR expressions. -->
+
+ <math dir="rtl"><mo>&#x230a;</mo><mo>&#x2308;</mo><mo>{</mo><mo>[</mo><mo rspace="3em">(</mo><mspace width="1em" height="2em" depth="2em" mathbackground="red"/><mo lspace="2em">)</mo><mo>]</mo><mo>}</mo><mo>&#x2309;</mo><mo>&#x230b;</mo></math>
+
+ </body>
+</html>
</ins><span class="cx">Property changes on: trunk/LayoutTests/mathml/presentation/stretchy-rtl.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (169616 => 169617)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-06-05 16:16:16 UTC (rev 169616)
+++ trunk/Source/WebCore/ChangeLog        2014-06-05 16:23:08 UTC (rev 169617)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-06-05 Frédéric Wang <fred.wang@free.fr>
+
+ Apply Character-level mirroring to stretchy operators in RTL mode.
+ https://bugs.webkit.org/show_bug.cgi?id=130839
+
+ Reviewed by Chris Fleizach.
+
+ We add support for character-level mirroring for stretchy MathML operators in RTL mode.
+ Glyph-level mirroring (via the rtlm OpenType feature) will be handled in bug 130840.
+
+ Test: mathml/presentation/stretchy-rtl.html
+
+ * rendering/mathml/RenderMathMLOperator.cpp: reorganize the Unicode stretchyCharacters table to make mirroring easy.
+ (WebCore::RenderMathMLOperator::computePreferredLogicalWidths): pass the right boolean to glyphDataForCharacter.
+ (WebCore::RenderMathMLOperator::getDisplayStyleLargeOperator): ditto
+ (WebCore::RenderMathMLOperator::findStretchyData): ditto and change the index for the stretchyCharacters fallback.
+ (WebCore::RenderMathMLOperator::updateStyle): pass the right boolean to glyphDataForCharacter.
+ (WebCore::RenderMathMLOperator::paint): remove the FIXME comment.
+ (WebCore::RenderMathMLOperator::paintVerticalGlyphAssembly): switch the leading/trailing space in RTL mode.
+
</ins><span class="cx"> 2014-06-05 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> Subpixel rendering: Buttons in default media controls shift vertically when controls fade in or out.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLOperatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (169616 => 169617)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp        2014-06-05 16:16:16 UTC (rev 169616)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp        2014-06-05 16:23:08 UTC (rev 169617)
</span><span class="lines">@@ -55,20 +55,22 @@
</span><span class="cx"> UChar bottomChar;
</span><span class="cx"> UChar middleChar;
</span><span class="cx"> };
</span><ins>+// The first leftRightPairsCount pairs correspond to left/right fences that can easily be mirrored in RTL.
+static const short leftRightPairsCount = 5;
</ins><span class="cx"> static const StretchyCharacter stretchyCharacters[14] = {
</span><span class="cx"> { 0x28 , 0x239b, 0x239c, 0x239d, 0x0 }, // left parenthesis
</span><span class="cx"> { 0x29 , 0x239e, 0x239f, 0x23a0, 0x0 }, // right parenthesis
</span><span class="cx"> { 0x5b , 0x23a1, 0x23a2, 0x23a3, 0x0 }, // left square bracket
</span><ins>+ { 0x5d , 0x23a4, 0x23a5, 0x23a6, 0x0 }, // right square bracket
+ { 0x7b , 0x23a7, 0x23aa, 0x23a9, 0x23a8 }, // left curly bracket
+ { 0x7d , 0x23ab, 0x23aa, 0x23ad, 0x23ac }, // right curly bracket
</ins><span class="cx"> { 0x2308, 0x23a1, 0x23a2, 0x23a2, 0x0 }, // left ceiling
</span><ins>+ { 0x2309, 0x23a4, 0x23a5, 0x23a5, 0x0 }, // right ceiling
</ins><span class="cx"> { 0x230a, 0x23a2, 0x23a2, 0x23a3, 0x0 }, // left floor
</span><del>- { 0x5d , 0x23a4, 0x23a5, 0x23a6, 0x0 }, // right square bracket
- { 0x2309, 0x23a4, 0x23a5, 0x23a5, 0x0 }, // right ceiling
</del><span class="cx"> { 0x230b, 0x23a5, 0x23a5, 0x23a6, 0x0 }, // right floor
</span><del>- { 0x7b , 0x23a7, 0x23aa, 0x23a9, 0x23a8 }, // left curly bracket
</del><span class="cx"> { 0x7c , 0x7c, 0x7c, 0x7c, 0x0 }, // vertical bar
</span><span class="cx"> { 0x2016, 0x2016, 0x2016, 0x2016, 0x0 }, // double vertical line
</span><span class="cx"> { 0x2225, 0x2225, 0x2225, 0x2225, 0x0 }, // parallel to
</span><del>- { 0x7d , 0x23ab, 0x23aa, 0x23ad, 0x23ac }, // right curly bracket
</del><span class="cx"> { 0x222b, 0x2320, 0x23ae, 0x2321, 0x0 } // integral sign
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -1339,7 +1341,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- GlyphData data = style().font().glyphDataForCharacter(m_operator, false);
</del><ins>+ GlyphData data = style().font().glyphDataForCharacter(m_operator, !style().isLeftToRightDirection());
</ins><span class="cx"> float maximumGlyphWidth = advanceForGlyph(data);
</span><span class="cx"> if (!m_isVertical) {
</span><span class="cx"> if (maximumGlyphWidth < stretchSize())
</span><span class="lines">@@ -1514,7 +1516,7 @@
</span><span class="cx"> ASSERT(m_isVertical && isLargeOperatorInDisplayStyle());
</span><span class="cx">
</span><span class="cx"> const auto& primaryFontData = style().font().primaryFont();
</span><del>- GlyphData baseGlyph = style().font().glyphDataForCharacter(character, false);
</del><ins>+ GlyphData baseGlyph = style().font().glyphDataForCharacter(character, !style().isLeftToRightDirection());
</ins><span class="cx"> if (!primaryFontData || !primaryFontData->mathData() || baseGlyph.fontData != primaryFontData)
</span><span class="cx"> return data;
</span><span class="cx">
</span><span class="lines">@@ -1546,7 +1548,7 @@
</span><span class="cx"> StretchyData assemblyData;
</span><span class="cx">
</span><span class="cx"> const auto& primaryFontData = style().font().primaryFont();
</span><del>- GlyphData baseGlyph = style().font().glyphDataForCharacter(character, false);
</del><ins>+ GlyphData baseGlyph = style().font().glyphDataForCharacter(character, !style().isLeftToRightDirection());
</ins><span class="cx">
</span><span class="cx"> if (primaryFontData && primaryFontData->mathData() && baseGlyph.fontData == primaryFontData) {
</span><span class="cx"> Vector<Glyph> sizeVariants;
</span><span class="lines">@@ -1580,6 +1582,10 @@
</span><span class="cx"> for (unsigned index = 0; index < maxIndex; ++index) {
</span><span class="cx"> if (stretchyCharacters[index].character == character) {
</span><span class="cx"> stretchyCharacter = &stretchyCharacters[index];
</span><ins>+ if (!style().isLeftToRightDirection() && index < leftRightPairsCount * 2) {
+ // If we are in right-to-left direction we select the mirrored form by adding -1 or +1 according to the parity of index.
+ index += index % 2 ? -1 : 1;
+ }
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1653,7 +1659,7 @@
</span><span class="cx"> m_stretchyData = getDisplayStyleLargeOperator(m_operator);
</span><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, false);
</del><ins>+ GlyphData baseGlyph = style().font().glyphDataForCharacter(m_operator, !style().isLeftToRightDirection());
</ins><span class="cx"> float baseSize = m_isVertical ? heightForGlyph(baseGlyph) : advanceForGlyph(baseGlyph);
</span><span class="cx"> if (stretchSize() <= baseSize)
</span><span class="cx"> return;
</span><span class="lines">@@ -1861,8 +1867,6 @@
</span><span class="cx"> if (info.context->paintingDisabled() || info.phase != PaintPhaseForeground || style().visibility() != VISIBLE || m_stretchyData.mode() == DrawNormal)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- // FIXME: This painting should work in RTL mode too (https://bugs.webkit.org/show_bug.cgi?id=123018).
-
</del><span class="cx"> GraphicsContextStateSaver stateSaver(*info.context);
</span><span class="cx"> info.context->setFillColor(style().visitedDependentColor(CSSPropertyColor), style().colorSpace());
</span><span class="cx">
</span><span class="lines">@@ -1892,7 +1896,7 @@
</span><span class="cx">
</span><span class="cx"> // We are positioning the glyphs so that the edge of the tight glyph bounds line up exactly with the edges of our paint box.
</span><span class="cx"> LayoutPoint operatorTopLeft = paintOffset + location();
</span><del>- operatorTopLeft.move(m_leadingSpace, 0);
</del><ins>+ operatorTopLeft.move(style().isLeftToRightDirection() ? m_leadingSpace : m_trailingSpace, 0);
</ins><span class="cx"> operatorTopLeft = ceiledIntPoint(operatorTopLeft);
</span><span class="cx"> FloatRect topGlyphBounds = boundsForGlyph(m_stretchyData.top());
</span><span class="cx"> LayoutPoint topGlyphOrigin(operatorTopLeft.x(), operatorTopLeft.y() - topGlyphBounds.y());
</span></span></pre>
</div>
</div>
</body>
</html>