<!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>[180779] 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/180779">180779</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-02-27 13:42:31 -0800 (Fri, 27 Feb 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/180752">r180752</a>.
https://bugs.webkit.org/show_bug.cgi?id=142098
Causes 10 SVG test failures on Windows. (Requested by
bfulgham_ on #webkit).
Reverted changeset:
"Cache glyph widths to GlyphPages"
https://bugs.webkit.org/show_bug.cgi?id=142028
http://trac.webkit.org/changeset/180752</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontcpp">trunk/Source/WebCore/platform/graphics/Font.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFonth">trunk/Source/WebCore/platform/graphics/Font.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontCascadecpp">trunk/Source/WebCore/platform/graphics/FontCascade.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontCascadeFontscpp">trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGlyphPageh">trunk/Source/WebCore/platform/graphics/GlyphPage.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsWidthIteratorcpp">trunk/Source/WebCore/platform/graphics/WidthIterator.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacComplexTextControllercpp">trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacComplexTextControllerCoreTextmm">trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLOperatorcpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGTextRunRenderingContextcpp">trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGFontDatacpp">trunk/Source/WebCore/svg/SVGFontData.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (180778 => 180779)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-27 21:40:05 UTC (rev 180778)
+++ trunk/Source/WebCore/ChangeLog        2015-02-27 21:42:31 UTC (rev 180779)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-02-27 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed, rolling out r180752.
+ https://bugs.webkit.org/show_bug.cgi?id=142098
+
+ Causes 10 SVG test failures on Windows. (Requested by
+ bfulgham_ on #webkit).
+
+ Reverted changeset:
+
+ "Cache glyph widths to GlyphPages"
+ https://bugs.webkit.org/show_bug.cgi?id=142028
+ http://trac.webkit.org/changeset/180752
+
</ins><span class="cx"> 2015-02-27 David Kilzer <ddkilzer@apple.com>
</span><span class="cx">
</span><span class="cx"> [iOS] Fix build by defining EAGL_IOSURFACE macro before including <OpenGLES/EAGLPrivate.h>
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (180778 => 180779)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/Font.cpp        2015-02-27 21:40:05 UTC (rev 180778)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp        2015-02-27 21:42:31 UTC (rev 180779)
</span><span class="lines">@@ -54,9 +54,16 @@
</span><span class="cx"> : m_maxCharWidth(-1)
</span><span class="cx"> , m_avgCharWidth(-1)
</span><span class="cx"> , m_platformData(platformData)
</span><ins>+ , m_treatAsFixedPitch(false)
</ins><span class="cx"> , m_isCustomFont(isCustomFont)
</span><span class="cx"> , m_isLoading(isLoading)
</span><span class="cx"> , m_isTextOrientationFallback(isTextOrientationFallback)
</span><ins>+ , m_isBrokenIdeographFallback(false)
+ , m_mathData(nullptr)
+#if ENABLE(OPENTYPE_VERTICAL)
+ , m_verticalData(0)
+#endif
+ , m_hasVerticalGlyphs(false)
</ins><span class="cx"> {
</span><span class="cx"> platformInit();
</span><span class="cx"> platformGlyphInit();
</span><span class="lines">@@ -72,7 +79,19 @@
</span><span class="cx"> Font::Font(std::unique_ptr<SVGData> svgData, float fontSize, bool syntheticBold, bool syntheticItalic)
</span><span class="cx"> : m_platformData(FontPlatformData(fontSize, syntheticBold, syntheticItalic))
</span><span class="cx"> , m_svgData(WTF::move(svgData))
</span><ins>+ , m_treatAsFixedPitch(false)
</ins><span class="cx"> , m_isCustomFont(true)
</span><ins>+ , m_isLoading(false)
+ , m_isTextOrientationFallback(false)
+ , m_isBrokenIdeographFallback(false)
+ , m_mathData(nullptr)
+#if ENABLE(OPENTYPE_VERTICAL)
+ , m_verticalData(0)
+#endif
+ , m_hasVerticalGlyphs(false)
+#if PLATFORM(IOS)
+ , m_shouldNotBeUsedForArabic(false)
+#endif
</ins><span class="cx"> {
</span><span class="cx"> m_svgData->initializeFont(this, fontSize);
</span><span class="cx"> }
</span><span class="lines">@@ -87,7 +106,7 @@
</span><span class="cx"> static const UChar32 digitZeroChar = '0';
</span><span class="cx"> Glyph digitZeroGlyph = glyphPageZero->glyphDataForCharacter(digitZeroChar).glyph;
</span><span class="cx"> if (digitZeroGlyph)
</span><del>- m_avgCharWidth = computeWidthForGlyph(digitZeroGlyph);
</del><ins>+ m_avgCharWidth = widthForGlyph(digitZeroGlyph);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // If we can't retrieve the width of a '0', fall back to the x height.
</span><span class="lines">@@ -102,37 +121,35 @@
</span><span class="cx"> {
</span><span class="cx"> auto* glyphPageZero = glyphPage(0);
</span><span class="cx"> if (!glyphPageZero) {
</span><ins>+ m_spaceGlyph = 0;
+ m_spaceWidth = 0;
+ m_zeroGlyph = 0;
+ m_adjustedSpaceWidth = 0;
</ins><span class="cx"> determinePitch();
</span><ins>+ m_zeroWidthSpaceGlyph = 0;
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> // Ask for the glyph for 0 to avoid paging in ZERO WIDTH SPACE. Control characters, including 0,
</span><span class="cx"> // are mapped to the ZERO WIDTH SPACE glyph.
</span><span class="cx"> m_zeroWidthSpaceGlyph = glyphPageZero->glyphDataForCharacter(0).glyph;
</span><ins>+
</ins><span class="cx"> // Nasty hack to determine if we should round or ceil space widths.
</span><span class="cx"> // If the font is monospace or fake monospace we ceil to ensure that
</span><span class="cx"> // every character and the space are the same width. Otherwise we round.
</span><del>- auto spaceGlyphData = glyphPageZero->glyphDataForCharacter(' ');
- m_spaceGlyph = spaceGlyphData.glyph;
- m_spaceWidth = spaceGlyphData.width;
- m_fontMetrics.setZeroWidth(glyphPageZero->glyphDataForCharacter('0').width);
</del><ins>+ m_spaceGlyph = glyphPageZero->glyphDataForCharacter(' ').glyph;
+ float width = widthForGlyph(m_spaceGlyph);
+ m_spaceWidth = width;
+ m_zeroGlyph = glyphPageZero->glyphDataForCharacter('0').glyph;
+ m_fontMetrics.setZeroWidth(widthForGlyph(m_zeroGlyph));
</ins><span class="cx"> determinePitch();
</span><del>- m_adjustedSpaceWidth = m_treatAsFixedPitch ? ceilf(m_spaceWidth) : roundf(m_spaceWidth);
- m_glyphZeroWidth = computeWidthForGlyph(0);
</del><ins>+ m_adjustedSpaceWidth = m_treatAsFixedPitch ? ceilf(width) : roundf(width);
</ins><span class="cx">
</span><span class="cx"> // Force the glyph for ZERO WIDTH SPACE to have zero width, unless it is shared with SPACE.
</span><span class="cx"> // Helvetica is an example of a non-zero width ZERO WIDTH SPACE glyph.
</span><span class="cx"> // See <http://bugs.webkit.org/show_bug.cgi?id=13178> and Font::isZeroWidthSpaceGlyph()
</span><span class="cx"> if (m_zeroWidthSpaceGlyph == m_spaceGlyph)
</span><span class="cx"> m_zeroWidthSpaceGlyph = 0;
</span><del>- else {
- // Fixup the page zero now that we know the zero width glyph.
- for (unsigned i = 0; i < GlyphPage::size; ++i) {
- auto glyphData = m_glyphPageZero->glyphDataForIndex(i);
- if (glyphData.glyph == m_zeroWidthSpaceGlyph)
- m_glyphPageZero->setGlyphDataForIndex(i, { glyphData.glyph, 0, glyphData.font });
- }
- }
- m_glyphPageZero->setImmutable();
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Font::~Font()
</span><span class="lines">@@ -154,7 +171,7 @@
</span><span class="cx"> return hasGlyphs;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<GlyphPage> createAndFillGlyphPage(unsigned pageNumber, const Font* font)
</del><ins>+static RefPtr<GlyphPage> createAndFillGlyphPage(unsigned pageNumber, const Font* font)
</ins><span class="cx"> {
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> // FIXME: Times New Roman contains Arabic glyphs, but Core Text doesn't know how to shape them. See <rdar://problem/9823975>.
</span><span class="lines">@@ -227,45 +244,22 @@
</span><span class="cx"> if (!haveGlyphs)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><ins>+ glyphPage->setImmutable();
</ins><span class="cx"> return glyphPage;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-float Font::computeWidthForGlyph(Glyph glyph) const
-{
- if (isZeroWidthSpaceGlyph(glyph))
- return 0;
- float width;
- if (isSVGFont())
- width = m_svgData->widthForSVGGlyph(glyph, m_platformData.size());
-#if ENABLE(OPENTYPE_VERTICAL)
- else if (m_verticalData)
-#if USE(CG) || USE(CAIRO)
- width = m_verticalData->advanceHeight(this, glyph) + m_syntheticBoldOffset;
-#else
- width = m_verticalData->advanceHeight(this, glyph);
-#endif
-#endif
- else
- width = platformWidthForGlyph(glyph);
- return width;
-}
-
</del><span class="cx"> const GlyphPage* Font::glyphPage(unsigned pageNumber) const
</span><span class="cx"> {
</span><span class="cx"> if (!pageNumber) {
</span><span class="cx"> if (!m_glyphPageZero)
</span><span class="cx"> m_glyphPageZero = createAndFillGlyphPage(0, this);
</span><del>- // Zero page is marked immutable in platformGlyphInit.
</del><span class="cx"> return m_glyphPageZero.get();
</span><span class="cx"> }
</span><span class="cx"> auto addResult = m_glyphPages.add(pageNumber, nullptr);
</span><del>- auto& page = addResult.iterator->value;
- if (addResult.isNewEntry) {
- page = createAndFillGlyphPage(pageNumber, this);
- if (page)
- page->setImmutable();
- }
- return page.get();
</del><ins>+ if (addResult.isNewEntry)
+ addResult.iterator->value = createAndFillGlyphPage(pageNumber, this);
+
+ return addResult.iterator->value.get();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Glyph Font::glyphForCharacter(UChar32 character) const
</span><span class="lines">@@ -464,10 +458,4 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void GlyphPage::setGlyphDataForIndex(unsigned index, Glyph glyph, const Font* font)
-{
- setGlyphDataForIndex(index, { glyph, font ? font->computeWidthForGlyph(glyph) : 0, font });
-}
-
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFonth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/Font.h (180778 => 180779)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/Font.h        2015-02-27 21:40:05 UTC (rev 180778)
+++ trunk/Source/WebCore/platform/graphics/Font.h        2015-02-27 21:42:31 UTC (rev 180779)
</span><span class="lines">@@ -140,9 +140,10 @@
</span><span class="cx"> void setAvgCharWidth(float avgCharWidth) { m_avgCharWidth = avgCharWidth; }
</span><span class="cx">
</span><span class="cx"> FloatRect boundsForGlyph(Glyph) const;
</span><ins>+ float widthForGlyph(Glyph) const;
+ FloatRect platformBoundsForGlyph(Glyph) const;
+ float platformWidthForGlyph(Glyph) const;
</ins><span class="cx">
</span><del>- float computeWidthForGlyph(Glyph) const;
-
</del><span class="cx"> float spaceWidth() const { return m_spaceWidth; }
</span><span class="cx"> float adjustedSpaceWidth() const { return m_adjustedSpaceWidth; }
</span><span class="cx"> void setSpaceWidths(float spaceWidth)
</span><span class="lines">@@ -150,7 +151,6 @@
</span><span class="cx"> m_spaceWidth = spaceWidth;
</span><span class="cx"> m_adjustedSpaceWidth = spaceWidth;
</span><span class="cx"> }
</span><del>- float glyphZeroWidth() const { return m_glyphZeroWidth; }
</del><span class="cx">
</span><span class="cx"> #if USE(CG) || USE(CAIRO)
</span><span class="cx"> float syntheticBoldOffset() const { return m_syntheticBoldOffset; }
</span><span class="lines">@@ -161,6 +161,8 @@
</span><span class="cx"> Glyph zeroWidthSpaceGlyph() const { return m_zeroWidthSpaceGlyph; }
</span><span class="cx"> void setZeroWidthSpaceGlyph(Glyph spaceGlyph) { m_zeroWidthSpaceGlyph = spaceGlyph; }
</span><span class="cx"> bool isZeroWidthSpaceGlyph(Glyph glyph) const { return glyph == m_zeroWidthSpaceGlyph && glyph; }
</span><ins>+ Glyph zeroGlyph() const { return m_zeroGlyph; }
+ void setZeroGlyph(Glyph zeroGlyph) { m_zeroGlyph = zeroGlyph; }
</ins><span class="cx">
</span><span class="cx"> GlyphData glyphDataForCharacter(UChar32) const;
</span><span class="cx"> Glyph glyphForCharacter(UChar32) const;
</span><span class="lines">@@ -225,13 +227,8 @@
</span><span class="cx"> PassRefPtr<Font> createScaledFont(const FontDescription&, float scaleFactor) const;
</span><span class="cx"> PassRefPtr<Font> platformCreateScaledFont(const FontDescription&, float scaleFactor) const;
</span><span class="cx">
</span><del>- float platformWidthForGlyph(Glyph) const;
- FloatRect platformBoundsForGlyph(Glyph) const;
-
</del><span class="cx"> void removeFromSystemFallbackCache();
</span><span class="cx">
</span><del>- friend RefPtr<GlyphPage> createAndFillGlyphPage(unsigned pageNumber, const Font*);
-
</del><span class="cx"> #if PLATFORM(WIN)
</span><span class="cx"> void initGDIFont();
</span><span class="cx"> void platformCommonDestroy();
</span><span class="lines">@@ -249,13 +246,14 @@
</span><span class="cx"> mutable RefPtr<GlyphPage> m_glyphPageZero;
</span><span class="cx"> mutable HashMap<unsigned, RefPtr<GlyphPage>> m_glyphPages;
</span><span class="cx"> mutable std::unique_ptr<GlyphMetricsMap<FloatRect>> m_glyphToBoundsMap;
</span><ins>+ mutable GlyphMetricsMap<float> m_glyphToWidthMap;
</ins><span class="cx">
</span><del>- bool m_treatAsFixedPitch { false };
- bool m_isCustomFont { false }; // Whether or not we are custom font loaded via @font-face
- bool m_isLoading { false }; // Whether or not this custom font is still in the act of loading.
</del><ins>+ bool m_treatAsFixedPitch;
+ bool m_isCustomFont; // Whether or not we are custom font loaded via @font-face
+ bool m_isLoading; // Whether or not this custom font is still in the act of loading.
</ins><span class="cx">
</span><del>- bool m_isTextOrientationFallback { false };
- bool m_isBrokenIdeographFallback { false };
</del><ins>+ bool m_isTextOrientationFallback;
+ bool m_isBrokenIdeographFallback;
</ins><span class="cx">
</span><span class="cx"> bool m_isUsedInSystemFallbackCache { false };
</span><span class="cx">
</span><span class="lines">@@ -263,16 +261,15 @@
</span><span class="cx"> #if ENABLE(OPENTYPE_VERTICAL)
</span><span class="cx"> RefPtr<OpenTypeVerticalData> m_verticalData;
</span><span class="cx"> #endif
</span><del>- bool m_hasVerticalGlyphs { false };
</del><ins>+ bool m_hasVerticalGlyphs;
</ins><span class="cx">
</span><del>- Glyph m_spaceGlyph { 0 };
- float m_spaceWidth { 0 };
- float m_adjustedSpaceWidth { 0 };
</del><ins>+ Glyph m_spaceGlyph;
+ float m_spaceWidth;
+ Glyph m_zeroGlyph;
+ float m_adjustedSpaceWidth;
</ins><span class="cx">
</span><del>- Glyph m_zeroWidthSpaceGlyph { 0 };
</del><ins>+ Glyph m_zeroWidthSpaceGlyph;
</ins><span class="cx">
</span><del>- float m_glyphZeroWidth { 0 };
-
</del><span class="cx"> struct DerivedFontData {
</span><span class="cx"> explicit DerivedFontData(bool custom)
</span><span class="cx"> : forCustomFont(custom)
</span><span class="lines">@@ -312,7 +309,7 @@
</span><span class="cx"> mutable SCRIPT_FONTPROPERTIES* m_scriptFontProperties;
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>- bool m_shouldNotBeUsedForArabic { false };
</del><ins>+ bool m_shouldNotBeUsedForArabic;
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -335,6 +332,32 @@
</span><span class="cx"> return bounds;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ALWAYS_INLINE float Font::widthForGlyph(Glyph glyph) const
+{
+ if (isZeroWidthSpaceGlyph(glyph))
+ return 0;
+
+ float width = m_glyphToWidthMap.metricsForGlyph(glyph);
+ if (width != cGlyphSizeUnknown)
+ return width;
+
+ if (isSVGFont())
+ width = m_svgData->widthForSVGGlyph(glyph, m_platformData.size());
+#if ENABLE(OPENTYPE_VERTICAL)
+ else if (m_verticalData)
+#if USE(CG) || USE(CAIRO)
+ width = m_verticalData->advanceHeight(this, glyph) + m_syntheticBoldOffset;
+#else
+ width = m_verticalData->advanceHeight(this, glyph);
+#endif
+#endif
+ else
+ width = platformWidthForGlyph(glyph);
+
+ m_glyphToWidthMap.setMetricsForGlyph(glyph, width);
+ return width;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // Font_h
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontCascadecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (180778 => 180779)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp        2015-02-27 21:40:05 UTC (rev 180778)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp        2015-02-27 21:42:31 UTC (rev 180779)
</span><span class="lines">@@ -1334,7 +1334,7 @@
</span><span class="cx"> return bounds.x() + bounds.width() / 2;
</span><span class="cx"> }
</span><span class="cx"> // FIXME: Use glyph bounds once they make sense for vertical fonts.
</span><del>- return fontData->computeWidthForGlyph(glyph) / 2;
</del><ins>+ return fontData->widthForGlyph(glyph) / 2;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline static float offsetToMiddleOfGlyphAtIndex(const GlyphBuffer& glyphBuffer, size_t i)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontCascadeFontscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp (180778 => 180779)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp        2015-02-27 21:40:05 UTC (rev 180778)
+++ trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp        2015-02-27 21:42:31 UTC (rev 180779)
</span><span class="lines">@@ -387,7 +387,7 @@
</span><span class="cx"> cachedPage = GlyphPage::createCopyForMixedFonts(*cachedPage);
</span><span class="cx">
</span><span class="cx"> glyphData = glyphDataForNormalVariant(c, description);
</span><del>- cachedPage->setGlyphDataForCharacter(c, glyphData);
</del><ins>+ cachedPage->setGlyphDataForCharacter(c, glyphData.glyph, glyphData.font);
</ins><span class="cx"> }
</span><span class="cx"> return glyphData;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGlyphPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GlyphPage.h (180778 => 180779)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GlyphPage.h        2015-02-27 21:40:05 UTC (rev 180778)
+++ trunk/Source/WebCore/platform/graphics/GlyphPage.h        2015-02-27 21:42:31 UTC (rev 180779)
</span><span class="lines">@@ -44,16 +44,13 @@
</span><span class="cx"> // Holds the glyph index and the corresponding Font information for a given
</span><span class="cx"> // character.
</span><span class="cx"> struct GlyphData {
</span><del>- GlyphData() { }
- GlyphData(Glyph glyph, float width, const Font* font)
- : glyph(glyph)
- , width(width)
- , font(font)
- { }
-
- Glyph glyph { 0 };
- float width { 0 };
- const Font* font { nullptr };
</del><ins>+ GlyphData(Glyph g = 0, const Font* f = 0)
+ : glyph(g)
+ , font(f)
+ {
+ }
+ Glyph glyph;
+ const Font* font;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #if COMPILER(MSVC)
</span><span class="lines">@@ -112,10 +109,9 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT_WITH_SECURITY_IMPLICATION(index < size);
</span><span class="cx"> Glyph glyph = m_glyphs[index];
</span><del>- float width = m_widths[index];
</del><span class="cx"> if (hasPerGlyphFontData())
</span><del>- return { glyph, width, m_perGlyphFontData[index] };
- return { glyph, width, glyph ? m_fontForAllGlyphs : nullptr };
</del><ins>+ return GlyphData(glyph, m_perGlyphFontData[index]);
+ return GlyphData(glyph, glyph ? m_fontForAllGlyphs : 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ALWAYS_INLINE Glyph glyphAt(unsigned index) const
</span><span class="lines">@@ -132,31 +128,33 @@
</span><span class="cx"> return m_glyphs[index] ? m_fontForAllGlyphs : 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- void setGlyphDataForCharacter(UChar32 c, const GlyphData& glyphData)
</del><ins>+ void setGlyphDataForCharacter(UChar32 c, Glyph g, const Font* f)
</ins><span class="cx"> {
</span><del>- setGlyphDataForIndex(indexForCharacter(c), glyphData);
</del><ins>+ setGlyphDataForIndex(indexForCharacter(c), g, f);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- void setGlyphDataForIndex(unsigned index, Glyph, const Font*);
-
- void setGlyphDataForIndex(unsigned index, const GlyphData& glyphData)
</del><ins>+ void setGlyphDataForIndex(unsigned index, Glyph glyph, const Font* font)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT_WITH_SECURITY_IMPLICATION(index < size);
</span><span class="cx"> ASSERT(!m_isImmutable);
</span><ins>+
+ m_glyphs[index] = glyph;
</ins><span class="cx">
</span><del>- m_glyphs[index] = glyphData.glyph;
- m_widths[index] = glyphData.width;
-
</del><span class="cx"> // GlyphPage getters will always return a null Font* for glyph #0 if there's no per-glyph font array.
</span><span class="cx"> if (hasPerGlyphFontData()) {
</span><del>- m_perGlyphFontData[index] = glyphData.glyph ? glyphData.font : 0;
</del><ins>+ m_perGlyphFontData[index] = glyph ? font : 0;
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // A single-font GlyphPage already assigned m_fontForAllGlyphs in the constructor.
</span><del>- ASSERT(!glyphData.glyph || glyphData.font == m_fontForAllGlyphs);
</del><ins>+ ASSERT(!glyph || font == m_fontForAllGlyphs);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ void setGlyphDataForIndex(unsigned index, const GlyphData& glyphData)
+ {
+ setGlyphDataForIndex(index, glyphData.glyph, glyphData.font);
+ }
+
</ins><span class="cx"> // Implemented by the platform.
</span><span class="cx"> bool fill(unsigned offset, unsigned length, UChar* characterBuffer, unsigned bufferLength, const Font*);
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="lines">@@ -170,7 +168,6 @@
</span><span class="cx"> : m_fontForAllGlyphs(fontForAllGlyphs)
</span><span class="cx"> {
</span><span class="cx"> memset(m_glyphs, 0, sizeof(m_glyphs));
</span><del>- memset(m_widths, 0, sizeof(m_widths));
</del><span class="cx"> if (hasPerGlyphFontData())
</span><span class="cx"> memset(m_perGlyphFontData, 0, sizeof(Font*) * GlyphPage::size);
</span><span class="cx"> ++s_count;
</span><span class="lines">@@ -178,9 +175,8 @@
</span><span class="cx">
</span><span class="cx"> bool hasPerGlyphFontData() const { return !m_fontForAllGlyphs; }
</span><span class="cx">
</span><del>- const Font* m_fontForAllGlyphs { nullptr };
</del><ins>+ const Font* m_fontForAllGlyphs;
</ins><span class="cx"> Glyph m_glyphs[size];
</span><del>- float m_widths[size];
</del><span class="cx">
</span><span class="cx"> bool m_isImmutable { false };
</span><span class="cx"> // NOTE: This array has (GlyphPage::size) elements if m_fontForAllGlyphs is null.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsWidthIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.cpp (180778 => 180779)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/WidthIterator.cpp        2015-02-27 21:40:05 UTC (rev 180778)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.cpp        2015-02-27 21:42:31 UTC (rev 180779)
</span><span class="lines">@@ -191,7 +191,7 @@
</span><span class="cx"> if (character == '\t' && m_run.allowTabs())
</span><span class="cx"> width = m_font->tabWidth(*font, m_run.tabSize(), m_run.xPos() + m_runWidthSoFar + widthSinceLastRounding);
</span><span class="cx"> else {
</span><del>- width = glyphData.width;
</del><ins>+ width = font->widthForGlyph(glyph);
</ins><span class="cx">
</span><span class="cx"> // SVG uses horizontalGlyphStretch(), when textLength is used to stretch/squeeze text.
</span><span class="cx"> width *= m_run.horizontalGlyphStretch();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacComplexTextControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp (180778 => 180779)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp        2015-02-27 21:40:05 UTC (rev 180778)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp        2015-02-27 21:42:31 UTC (rev 180779)
</span><span class="lines">@@ -638,7 +638,7 @@
</span><span class="cx"> CGSize advance = treatAsSpace ? CGSizeMake(spaceWidth, advances[i].height) : advances[i];
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> if (isEmoji && advance.width)
</span><del>- advance.width = font.computeWidthForGlyph(glyph);
</del><ins>+ advance.width = font.widthForGlyph(glyph);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> if (ch == '\t' && m_run.allowTabs())
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacComplexTextControllerCoreTextmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm (180778 => 180779)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm        2015-02-27 21:40:05 UTC (rev 180778)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm        2015-02-27 21:42:31 UTC (rev 180779)
</span><span class="lines">@@ -163,7 +163,7 @@
</span><span class="cx"> // Synthesize a run of missing glyphs.
</span><span class="cx"> m_glyphsVector.fill(0, m_glyphCount);
</span><span class="cx"> m_glyphs = m_glyphsVector.data();
</span><del>- m_advancesVector.fill(CGSizeMake(m_font.glyphZeroWidth(), 0), m_glyphCount);
</del><ins>+ m_advancesVector.fill(CGSizeMake(m_font.widthForGlyph(0), 0), m_glyphCount);
</ins><span class="cx"> m_advances = m_advancesVector.data();
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLOperatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (180778 => 180779)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp        2015-02-27 21:40:05 UTC (rev 180778)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp        2015-02-27 21:42:31 UTC (rev 180779)
</span><span class="lines">@@ -1343,8 +1343,7 @@
</span><span class="cx">
</span><span class="cx"> float RenderMathMLOperator::advanceForGlyph(const GlyphData& data) const
</span><span class="cx"> {
</span><del>- // FIXME: MathML code synthesizes bad GlyphDatas.
- return data.width ? data.width : data.font->computeWidthForGlyph(data.glyph);
</del><ins>+ return data.font->widthForGlyph(data.glyph);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderMathMLOperator::computePreferredLogicalWidths()
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGTextRunRenderingContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp (180778 => 180779)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp        2015-02-27 21:40:05 UTC (rev 180778)
+++ trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp        2015-02-27 21:42:31 UTC (rev 180779)
</span><span class="lines">@@ -298,8 +298,7 @@
</span><span class="cx"> SVGFontElement* fontElement;
</span><span class="cx"> SVGFontFaceElement* fontFaceElement;
</span><span class="cx"> svgFontAndFontFaceElementForFontData(&primaryFont, fontFaceElement, fontElement);
</span><del>- auto missingGlyph = fontElement->missingGlyph();
- return { missingGlyph, primaryFont.computeWidthForGlyph(missingGlyph), &primaryFont };
</del><ins>+ return GlyphData(fontElement->missingGlyph(), &primaryFont);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GlyphData SVGTextRunRenderingContext::glyphDataForCharacter(const FontCascade& font, WidthIterator& iterator, UChar32 character, bool mirror, int currentCharacter, unsigned& advanceLength, String& normalizedSpacesStringCache)
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGFontDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGFontData.cpp (180778 => 180779)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGFontData.cpp        2015-02-27 21:40:05 UTC (rev 180778)
+++ trunk/Source/WebCore/svg/SVGFontData.cpp        2015-02-27 21:42:31 UTC (rev 180779)
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx"> if (!xHeight && glyphPageZero) {
</span><span class="cx"> // Fallback if x_heightAttr is not specified for the font element.
</span><span class="cx"> Glyph letterXGlyph = glyphPageZero->glyphDataForCharacter('x').glyph;
</span><del>- xHeight = letterXGlyph ? font->computeWidthForGlyph(letterXGlyph) : 2 * ascent / 3;
</del><ins>+ xHeight = letterXGlyph ? font->widthForGlyph(letterXGlyph) : 2 * ascent / 3;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> FontMetrics& fontMetrics = font->fontMetrics();
</span><span class="lines">@@ -99,17 +99,17 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Calculate space width.
</span><del>- auto spaceGlyphData = glyphPageZero->glyphDataForCharacter(' ');
- font->setSpaceGlyph(spaceGlyphData.glyph);
- font->setSpaceWidths(spaceGlyphData.width);
</del><ins>+ Glyph spaceGlyph = glyphPageZero->glyphDataForCharacter(' ').glyph;
+ font->setSpaceGlyph(spaceGlyph);
+ font->setSpaceWidths(font->widthForGlyph(spaceGlyph));
</ins><span class="cx">
</span><span class="cx"> // Estimate average character width.
</span><del>- auto numeralZeroGlyphData = glyphPageZero->glyphDataForCharacter('0');
- font->setAvgCharWidth(numeralZeroGlyphData.glyph ? numeralZeroGlyphData.width : font->spaceWidth());
</del><ins>+ Glyph numeralZeroGlyph = glyphPageZero->glyphDataForCharacter('0').glyph;
+ font->setAvgCharWidth(numeralZeroGlyph ? font->widthForGlyph(numeralZeroGlyph) : font->spaceWidth());
</ins><span class="cx">
</span><span class="cx"> // Estimate maximum character width.
</span><del>- auto letterWGlyphData = glyphPageZero->glyphDataForCharacter('W');
- font->setMaxCharWidth(letterWGlyphData.glyph ? letterWGlyphData.width : ascent);
</del><ins>+ Glyph letterWGlyph = glyphPageZero->glyphDataForCharacter('W').glyph;
+ font->setMaxCharWidth(letterWGlyph ? font->widthForGlyph(letterWGlyph) : ascent);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> float SVGFontData::widthForSVGGlyph(Glyph glyph, float fontSize) const
</span></span></pre>
</div>
</div>
</body>
</html>