Modified: trunk/ChangeLog (200185 => 200186)
--- trunk/ChangeLog 2016-04-28 12:09:38 UTC (rev 200185)
+++ trunk/ChangeLog 2016-04-28 12:18:23 UTC (rev 200186)
@@ -1,3 +1,18 @@
+2016-04-28 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r200185.
+ https://bugs.webkit.org/show_bug.cgi?id=157131
+
+ Bad temporary file added unintentionally (Requested by fredw
+ on #webkit).
+
+ Reverted changeset:
+
+ "RenderMathMLOperator refactoring: introduce getBaseGlyph and
+ remove parameter from getDisplayStyleLargeOperator"
+ https://bugs.webkit.org/show_bug.cgi?id=156910
+ http://trac.webkit.org/changeset/200185
+
2016-04-25 Ryosuke Niwa <[email protected]>
Remove the build flag for template elements
Modified: trunk/Source/WebCore/ChangeLog (200185 => 200186)
--- trunk/Source/WebCore/ChangeLog 2016-04-28 12:09:38 UTC (rev 200185)
+++ trunk/Source/WebCore/ChangeLog 2016-04-28 12:18:23 UTC (rev 200186)
@@ -1,3 +1,18 @@
+2016-04-28 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r200185.
+ https://bugs.webkit.org/show_bug.cgi?id=157131
+
+ Bad temporary file added unintentionally (Requested by fredw
+ on #webkit).
+
+ Reverted changeset:
+
+ "RenderMathMLOperator refactoring: introduce getBaseGlyph and
+ remove parameter from getDisplayStyleLargeOperator"
+ https://bugs.webkit.org/show_bug.cgi?id=156910
+ http://trac.webkit.org/changeset/200185
+
2016-04-28 Frederic Wang <[email protected]>
RenderMathMLOperator refactoring: introduce getBaseGlyph and remove parameter from getDisplayStyleLargeOperator
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (200185 => 200186)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2016-04-28 12:09:38 UTC (rev 200185)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2016-04-28 12:18:23 UTC (rev 200186)
@@ -207,7 +207,7 @@
if (isLargeOperatorInDisplayStyle()) {
const auto& primaryFont = style().fontCascade().primaryFont();
if (auto* mathData = primaryFont.mathData()) {
- StretchyData largeOperator = getDisplayStyleLargeOperator();
+ StretchyData largeOperator = getDisplayStyleLargeOperator(m_textContent);
return mathData->getItalicCorrection(primaryFont, largeOperator.variant().glyph);
}
}
@@ -306,8 +306,8 @@
return;
}
- GlyphData baseGlyph;
- float maximumGlyphWidth = getBaseGlyph(style(), baseGlyph) ? advanceWidthForGlyph(baseGlyph) : 0;
+ GlyphData data = "" !style().isLeftToRightDirection());
+ float maximumGlyphWidth = advanceWidthForGlyph(data);
if (!m_isVertical) {
if (maximumGlyphWidth < stretchSize())
maximumGlyphWidth = stretchSize();
@@ -317,12 +317,12 @@
}
if (isLargeOperatorInDisplayStyle()) {
// 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/).
- StretchyData largeOperator = getDisplayStyleLargeOperator();
+ StretchyData largeOperator = getDisplayStyleLargeOperator(m_textContent);
if (largeOperator.mode() == DrawSizeVariant)
maximumGlyphWidth = boundsForGlyph(largeOperator.variant()).width();
} else {
// FIXME: some glyphs (e.g. the one for "FRACTION SLASH" 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).
- findStretchyData(&maximumGlyphWidth);
+ findStretchyData(m_textContent, &maximumGlyphWidth);
}
m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth = m_leadingSpace + maximumGlyphWidth + m_trailingSpace;
}
@@ -386,12 +386,6 @@
updateOperatorProperties();
}
-bool RenderMathMLOperator::getBaseGlyph(const RenderStyle& style, GlyphData& baseGlyph) const
-{
- baseGlyph = style.fontCascade().glyphDataForCharacter(m_textContent, !style.isLeftToRightDirection());
- return baseGlyph.isValid() && baseGlyph.font == &style.fontCascade().primaryFont();
-}
-
bool RenderMathMLOperator::getGlyphAssemblyFallBack(Vector<OpenTypeMathData::AssemblyPart> assemblyParts, StretchyData& stretchyData) const
{
GlyphData top;
@@ -502,29 +496,30 @@
return true;
}
-RenderMathMLOperator::StretchyData RenderMathMLOperator::getDisplayStyleLargeOperator() const
+RenderMathMLOperator::StretchyData RenderMathMLOperator::getDisplayStyleLargeOperator(UChar character) const
{
StretchyData data;
ASSERT(m_isVertical && isLargeOperatorInDisplayStyle());
- GlyphData baseGlyph;
- if (!getBaseGlyph(style(), baseGlyph) || !baseGlyph.font->mathData())
+ const auto& primaryFont = style().fontCascade().primaryFont();
+ GlyphData baseGlyph = style().fontCascade().glyphDataForCharacter(character, !style().isLeftToRightDirection());
+ if (!primaryFont.mathData() || baseGlyph.font != &primaryFont || !baseGlyph.font || !baseGlyph.glyph)
return data;
Vector<Glyph> sizeVariants;
Vector<OpenTypeMathData::AssemblyPart> assemblyParts;
// The value of displayOperatorMinHeight is sometimes too small, so we ensure that it is at least \sqrt{2} times the size of the base glyph.
- float displayOperatorMinHeight = std::max(baseGlyph.font->boundsForGlyph(baseGlyph.glyph).height() * sqrtOfTwoFloat, baseGlyph.font->mathData()->getMathConstant(*baseGlyph.font, OpenTypeMathData::DisplayOperatorMinHeight));
+ float displayOperatorMinHeight = std::max(baseGlyph.font->boundsForGlyph(baseGlyph.glyph).height() * sqrtOfTwoFloat, primaryFont.mathData()->getMathConstant(primaryFont, OpenTypeMathData::DisplayOperatorMinHeight));
- baseGlyph.font->mathData()->getMathVariants(baseGlyph.glyph, true, sizeVariants, assemblyParts);
+ primaryFont.mathData()->getMathVariants(baseGlyph.glyph, true, sizeVariants, assemblyParts);
// We choose the first size variant that is larger than the expected displayOperatorMinHeight and otherwise fallback to the largest variant.
for (auto& variant : sizeVariants) {
GlyphData sizeVariant;
sizeVariant.glyph = variant;
- sizeVariant.font = baseGlyph.font;
+ sizeVariant.font = &primaryFont;
data.setSizeVariantMode(sizeVariant);
if (boundsForGlyph(sizeVariant).height() >= displayOperatorMinHeight)
return data;
@@ -532,26 +527,25 @@
return data;
}
-RenderMathMLOperator::StretchyData RenderMathMLOperator::findStretchyData(float* maximumGlyphWidth)
+RenderMathMLOperator::StretchyData RenderMathMLOperator::findStretchyData(UChar character, float* maximumGlyphWidth)
{
ASSERT(!maximumGlyphWidth || m_isVertical);
StretchyData data;
StretchyData assemblyData;
- GlyphData baseGlyph;
- if (!getBaseGlyph(style(), baseGlyph))
- return data;
+ const auto& primaryFont = style().fontCascade().primaryFont();
+ GlyphData baseGlyph = style().fontCascade().glyphDataForCharacter(character, !style().isLeftToRightDirection());
- if (baseGlyph.font->mathData()) {
+ if (primaryFont.mathData() && baseGlyph.font == &primaryFont) {
Vector<Glyph> sizeVariants;
Vector<OpenTypeMathData::AssemblyPart> assemblyParts;
- baseGlyph.font->mathData()->getMathVariants(baseGlyph.glyph, m_isVertical, sizeVariants, assemblyParts);
+ primaryFont.mathData()->getMathVariants(baseGlyph.glyph, m_isVertical, sizeVariants, assemblyParts);
// We verify the size variants.
for (auto& variant : sizeVariants) {
GlyphData sizeVariant;
sizeVariant.glyph = variant;
- sizeVariant.font = baseGlyph.font;
+ sizeVariant.font = &primaryFont;
if (maximumGlyphWidth)
*maximumGlyphWidth = std::max(*maximumGlyphWidth, advanceWidthForGlyph(sizeVariant));
else {
@@ -573,7 +567,7 @@
const StretchyCharacter* stretchyCharacter = nullptr;
const unsigned maxIndex = WTF_ARRAY_LENGTH(stretchyCharacters);
for (unsigned index = 0; index < maxIndex; ++index) {
- if (stretchyCharacters[index].character == m_textContent) {
+ if (stretchyCharacters[index].character == character) {
stretchyCharacter = &stretchyCharacters[index];
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.
@@ -647,14 +641,14 @@
return;
if (m_isVertical && isLargeOperatorInDisplayStyle())
- m_stretchyData = getDisplayStyleLargeOperator();
+ m_stretchyData = getDisplayStyleLargeOperator(m_textContent);
else {
// We do not stretch if the base glyph is large enough.
GlyphData baseGlyph = style().fontCascade().glyphDataForCharacter(m_textContent, !style().isLeftToRightDirection());
float baseSize = m_isVertical ? heightForGlyph(baseGlyph) : advanceWidthForGlyph(baseGlyph);
if (stretchSize() <= baseSize)
return;
- m_stretchyData = findStretchyData(nullptr);
+ m_stretchyData = findStretchyData(m_textContent, nullptr);
}
if (m_isVertical && m_stretchyData.mode() == DrawSizeVariant) {
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h (200185 => 200186)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2016-04-28 12:09:38 UTC (rev 200185)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2016-04-28 12:18:23 UTC (rev 200186)
@@ -141,10 +141,9 @@
bool shouldAllowStretching() const;
- bool getBaseGlyph(const RenderStyle&, GlyphData&) const;
bool getGlyphAssemblyFallBack(Vector<OpenTypeMathData::AssemblyPart>, StretchyData&) const;
- StretchyData getDisplayStyleLargeOperator() const;
- StretchyData findStretchyData(float* maximumGlyphWidth);
+ StretchyData getDisplayStyleLargeOperator(UChar) const;
+ StretchyData findStretchyData(UChar, float* maximumGlyphWidth);
enum GlyphPaintTrimming {
TrimTop,