Changeset 169617 in webkit
- Timestamp:
- Jun 5, 2014 9:23:08 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r169616 r169617 1 2014-06-05 Frédéric Wang <fred.wang@free.fr> 2 3 Apply Character-level mirroring to stretchy operators in RTL mode. 4 https://bugs.webkit.org/show_bug.cgi?id=130839 5 6 Reviewed by Chris Fleizach. 7 8 Add some tests to verify that stretchy operators are correctly mirrored in RTL mode. 9 10 * mathml/presentation/stretchy-rtl-expected.html: Added. 11 * mathml/presentation/stretchy-rtl.html: Added. 12 1 13 2014-06-05 Zoltan Horvath <zoltan@webkit.org> 2 14 -
trunk/Source/WebCore/ChangeLog
r169615 r169617 1 2014-06-05 Frédéric Wang <fred.wang@free.fr> 2 3 Apply Character-level mirroring to stretchy operators in RTL mode. 4 https://bugs.webkit.org/show_bug.cgi?id=130839 5 6 Reviewed by Chris Fleizach. 7 8 We add support for character-level mirroring for stretchy MathML operators in RTL mode. 9 Glyph-level mirroring (via the rtlm OpenType feature) will be handled in bug 130840. 10 11 Test: mathml/presentation/stretchy-rtl.html 12 13 * rendering/mathml/RenderMathMLOperator.cpp: reorganize the Unicode stretchyCharacters table to make mirroring easy. 14 (WebCore::RenderMathMLOperator::computePreferredLogicalWidths): pass the right boolean to glyphDataForCharacter. 15 (WebCore::RenderMathMLOperator::getDisplayStyleLargeOperator): ditto 16 (WebCore::RenderMathMLOperator::findStretchyData): ditto and change the index for the stretchyCharacters fallback. 17 (WebCore::RenderMathMLOperator::updateStyle): pass the right boolean to glyphDataForCharacter. 18 (WebCore::RenderMathMLOperator::paint): remove the FIXME comment. 19 (WebCore::RenderMathMLOperator::paintVerticalGlyphAssembly): switch the leading/trailing space in RTL mode. 20 1 21 2014-06-05 Zalan Bujtas <zalan@apple.com> 2 22 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
r169607 r169617 56 56 UChar middleChar; 57 57 }; 58 // The first leftRightPairsCount pairs correspond to left/right fences that can easily be mirrored in RTL. 59 static const short leftRightPairsCount = 5; 58 60 static const StretchyCharacter stretchyCharacters[14] = { 59 61 { 0x28 , 0x239b, 0x239c, 0x239d, 0x0 }, // left parenthesis 60 62 { 0x29 , 0x239e, 0x239f, 0x23a0, 0x0 }, // right parenthesis 61 63 { 0x5b , 0x23a1, 0x23a2, 0x23a3, 0x0 }, // left square bracket 64 { 0x5d , 0x23a4, 0x23a5, 0x23a6, 0x0 }, // right square bracket 65 { 0x7b , 0x23a7, 0x23aa, 0x23a9, 0x23a8 }, // left curly bracket 66 { 0x7d , 0x23ab, 0x23aa, 0x23ad, 0x23ac }, // right curly bracket 62 67 { 0x2308, 0x23a1, 0x23a2, 0x23a2, 0x0 }, // left ceiling 68 { 0x2309, 0x23a4, 0x23a5, 0x23a5, 0x0 }, // right ceiling 63 69 { 0x230a, 0x23a2, 0x23a2, 0x23a3, 0x0 }, // left floor 64 { 0x5d , 0x23a4, 0x23a5, 0x23a6, 0x0 }, // right square bracket65 { 0x2309, 0x23a4, 0x23a5, 0x23a5, 0x0 }, // right ceiling66 70 { 0x230b, 0x23a5, 0x23a5, 0x23a6, 0x0 }, // right floor 67 { 0x7b , 0x23a7, 0x23aa, 0x23a9, 0x23a8 }, // left curly bracket68 71 { 0x7c , 0x7c, 0x7c, 0x7c, 0x0 }, // vertical bar 69 72 { 0x2016, 0x2016, 0x2016, 0x2016, 0x0 }, // double vertical line 70 73 { 0x2225, 0x2225, 0x2225, 0x2225, 0x0 }, // parallel to 71 { 0x7d , 0x23ab, 0x23aa, 0x23ad, 0x23ac }, // right curly bracket72 74 { 0x222b, 0x2320, 0x23ae, 0x2321, 0x0 } // integral sign 73 75 }; … … 1340 1342 } 1341 1343 1342 GlyphData data = style().font().glyphDataForCharacter(m_operator, false);1344 GlyphData data = style().font().glyphDataForCharacter(m_operator, !style().isLeftToRightDirection()); 1343 1345 float maximumGlyphWidth = advanceForGlyph(data); 1344 1346 if (!m_isVertical) { … … 1515 1517 1516 1518 const auto& primaryFontData = style().font().primaryFont(); 1517 GlyphData baseGlyph = style().font().glyphDataForCharacter(character, false);1519 GlyphData baseGlyph = style().font().glyphDataForCharacter(character, !style().isLeftToRightDirection()); 1518 1520 if (!primaryFontData || !primaryFontData->mathData() || baseGlyph.fontData != primaryFontData) 1519 1521 return data; … … 1547 1549 1548 1550 const auto& primaryFontData = style().font().primaryFont(); 1549 GlyphData baseGlyph = style().font().glyphDataForCharacter(character, false);1551 GlyphData baseGlyph = style().font().glyphDataForCharacter(character, !style().isLeftToRightDirection()); 1550 1552 1551 1553 if (primaryFontData && primaryFontData->mathData() && baseGlyph.fontData == primaryFontData) { … … 1581 1583 if (stretchyCharacters[index].character == character) { 1582 1584 stretchyCharacter = &stretchyCharacters[index]; 1585 if (!style().isLeftToRightDirection() && index < leftRightPairsCount * 2) { 1586 // If we are in right-to-left direction we select the mirrored form by adding -1 or +1 according to the parity of index. 1587 index += index % 2 ? -1 : 1; 1588 } 1583 1589 break; 1584 1590 } … … 1654 1660 else { 1655 1661 // We do not stretch if the base glyph is large enough. 1656 GlyphData baseGlyph = style().font().glyphDataForCharacter(m_operator, false);1662 GlyphData baseGlyph = style().font().glyphDataForCharacter(m_operator, !style().isLeftToRightDirection()); 1657 1663 float baseSize = m_isVertical ? heightForGlyph(baseGlyph) : advanceForGlyph(baseGlyph); 1658 1664 if (stretchSize() <= baseSize) … … 1862 1868 return; 1863 1869 1864 // FIXME: This painting should work in RTL mode too (https://bugs.webkit.org/show_bug.cgi?id=123018).1865 1866 1870 GraphicsContextStateSaver stateSaver(*info.context); 1867 1871 info.context->setFillColor(style().visitedDependentColor(CSSPropertyColor), style().colorSpace()); … … 1893 1897 // We are positioning the glyphs so that the edge of the tight glyph bounds line up exactly with the edges of our paint box. 1894 1898 LayoutPoint operatorTopLeft = paintOffset + location(); 1895 operatorTopLeft.move( m_leadingSpace, 0);1899 operatorTopLeft.move(style().isLeftToRightDirection() ? m_leadingSpace : m_trailingSpace, 0); 1896 1900 operatorTopLeft = ceiledIntPoint(operatorTopLeft); 1897 1901 FloatRect topGlyphBounds = boundsForGlyph(m_stretchyData.top());
Note: See TracChangeset
for help on using the changeset viewer.