<!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>[177637] 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/177637">177637</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2014-12-22 11:14:58 -0800 (Mon, 22 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Generic font code should not know about SVG font missing glyph
https://bugs.webkit.org/show_bug.cgi?id=139864

Reviewed by Andreas Kling and Myles Maxfield.

The defined missing glyph is an SVG font concept and should be handled in SVG code.

* platform/graphics/FontGlyphs.cpp:
(WebCore::FontGlyphs::glyphDataForSystemFallback):
(WebCore::FontGlyphs::glyphDataForVariant):

    Return null glyph instead of the missing glyph (the missing glyph was already a null glyph in all non-svg-font cases).
    Use early return style.

* platform/graphics/FontGlyphs.h:
* platform/graphics/SegmentedFontData.cpp:
* platform/graphics/SimpleFontData.cpp:
(WebCore::SimpleFontData::platformGlyphInit):
* platform/graphics/SimpleFontData.h:

    Remove the missingGlyph member.

* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advanceInternal):

    Explicitly skip over null glyphs. Before they had non-null fontData and would get skipped implicitly.

* platform/graphics/mac/SimpleFontDataMac.mm:
* rendering/svg/SVGTextRunRenderingContext.cpp:
(WebCore::missingGlyphForFont):

    Get the missing glyph from the SVG font element.

(WebCore::SVGTextRunRenderingContext::glyphDataForCharacter):

    Return the missing glyph if the normal lookup didn't produce results.

* svg/SVGFontData.cpp:
(WebCore::SVGFontData::initializeFontData):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontGlyphscpp">trunk/Source/WebCore/platform/graphics/FontGlyphs.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontGlyphsh">trunk/Source/WebCore/platform/graphics/FontGlyphs.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsSegmentedFontDatacpp">trunk/Source/WebCore/platform/graphics/SegmentedFontData.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsSimpleFontDatacpp">trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsSimpleFontDatah">trunk/Source/WebCore/platform/graphics/SimpleFontData.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsWidthIteratorcpp">trunk/Source/WebCore/platform/graphics/WidthIterator.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacSimpleFontDataMacmm">trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm</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 (177636 => 177637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-22 19:04:45 UTC (rev 177636)
+++ trunk/Source/WebCore/ChangeLog        2014-12-22 19:14:58 UTC (rev 177637)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2014-12-22  Antti Koivisto  &lt;antti@apple.com&gt;
+
+        Generic font code should not know about SVG font missing glyph
+        https://bugs.webkit.org/show_bug.cgi?id=139864
+
+        Reviewed by Andreas Kling and Myles Maxfield.
+
+        The defined missing glyph is an SVG font concept and should be handled in SVG code.
+
+        * platform/graphics/FontGlyphs.cpp:
+        (WebCore::FontGlyphs::glyphDataForSystemFallback):
+        (WebCore::FontGlyphs::glyphDataForVariant):
+
+            Return null glyph instead of the missing glyph (the missing glyph was already a null glyph in all non-svg-font cases).
+            Use early return style.
+
+        * platform/graphics/FontGlyphs.h:
+        * platform/graphics/SegmentedFontData.cpp:
+        * platform/graphics/SimpleFontData.cpp:
+        (WebCore::SimpleFontData::platformGlyphInit):
+        * platform/graphics/SimpleFontData.h:
+
+            Remove the missingGlyph member.
+
+        * platform/graphics/WidthIterator.cpp:
+        (WebCore::WidthIterator::advanceInternal):
+
+            Explicitly skip over null glyphs. Before they had non-null fontData and would get skipped implicitly.
+
+        * platform/graphics/mac/SimpleFontDataMac.mm:
+        * rendering/svg/SVGTextRunRenderingContext.cpp:
+        (WebCore::missingGlyphForFont):
+
+            Get the missing glyph from the SVG font element.
+
+        (WebCore::SVGTextRunRenderingContext::glyphDataForCharacter):
+
+            Return the missing glyph if the normal lookup didn't produce results.
+
+        * svg/SVGFontData.cpp:
+        (WebCore::SVGFontData::initializeFontData):
+
</ins><span class="cx"> 2014-12-22  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Move &quot;Auto&quot; CSS properties to the new StyleBuilder
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontGlyphscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontGlyphs.cpp (177636 => 177637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontGlyphs.cpp        2014-12-22 19:04:45 UTC (rev 177636)
+++ trunk/Source/WebCore/platform/graphics/FontGlyphs.cpp        2014-12-22 19:14:58 UTC (rev 177637)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Font.h&quot;
</span><span class="cx"> #include &quot;FontCache.h&quot;
</span><ins>+#include &quot;GlyphPageTreeNode.h&quot;
</ins><span class="cx"> #include &quot;SegmentedFontData.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -277,32 +278,26 @@
</span><span class="cx">     }
</span><span class="cx">     const SimpleFontData* originalFontData = primaryFontData(description)-&gt;fontDataForCharacter(c);
</span><span class="cx">     RefPtr&lt;SimpleFontData&gt; characterFontData = fontCache().systemFallbackForCharacters(description, originalFontData, m_isForPlatformFont, codeUnits, codeUnitsLength);
</span><del>-    if (characterFontData) {
-        if (characterFontData-&gt;platformData().orientation() == Vertical &amp;&amp; !characterFontData-&gt;hasVerticalGlyphs() &amp;&amp; Font::isCJKIdeographOrSymbol(c))
-            variant = BrokenIdeographVariant;
-        if (variant != NormalVariant)
-            characterFontData = characterFontData-&gt;variantFontData(description, variant);
</del><ins>+    if (!characterFontData)
+        return GlyphData();
+
+    if (characterFontData-&gt;platformData().orientation() == Vertical &amp;&amp; !characterFontData-&gt;hasVerticalGlyphs() &amp;&amp; Font::isCJKIdeographOrSymbol(c))
+        variant = BrokenIdeographVariant;
+    if (variant != NormalVariant) {
+        characterFontData = characterFontData-&gt;variantFontData(description, variant);
+        ASSERT(characterFontData);
</ins><span class="cx">     }
</span><del>-    if (characterFontData) {
-        // Got the fallback glyph and font.
-        GlyphPage* fallbackPage = GlyphPageTreeNode::getRootChild(characterFontData.get(), pageNumber)-&gt;page();
-        GlyphData data = fallbackPage &amp;&amp; fallbackPage-&gt;fontDataForCharacter(c) ? fallbackPage-&gt;glyphDataForCharacter(c) : characterFontData-&gt;missingGlyphData();
-        // Cache it so we don't have to do system fallback again next time.
-        if (variant == NormalVariant) {
-            node.page()-&gt;setGlyphDataForCharacter(c, data.glyph, data.fontData);
-            data.fontData-&gt;setMaxGlyphPageTreeLevel(std::max(data.fontData-&gt;maxGlyphPageTreeLevel(), node.level()));
-            if (!Font::isCJKIdeographOrSymbol(c) &amp;&amp; data.fontData-&gt;platformData().orientation() != Horizontal &amp;&amp; !data.fontData-&gt;isTextOrientationFallback())
-                return glyphDataForNonCJKCharacterWithGlyphOrientation(c, description.nonCJKGlyphOrientation(), data, pageNumber);
-        }
-        return data;
-    }
</del><span class="cx"> 
</span><del>-    // Even system fallback can fail; use the missing glyph in that case.
-    // FIXME: It would be nicer to use the missing glyph from the last resort font instead.
-    GlyphData data = primarySimpleFontData(description)-&gt;missingGlyphData();
-    if (variant == NormalVariant) {
</del><ins>+    GlyphData data;
+    if (GlyphPage* fallbackPage = GlyphPageTreeNode::getRootChild(characterFontData.get(), pageNumber)-&gt;page())
+        data = fallbackPage-&gt;glyphDataForCharacter(c);
+
+    // Cache it so we don't have to do system fallback again next time.
+    if (variant == NormalVariant &amp;&amp; data.glyph) {
</ins><span class="cx">         node.page()-&gt;setGlyphDataForCharacter(c, data.glyph, data.fontData);
</span><span class="cx">         data.fontData-&gt;setMaxGlyphPageTreeLevel(std::max(data.fontData-&gt;maxGlyphPageTreeLevel(), node.level()));
</span><ins>+        if (!Font::isCJKIdeographOrSymbol(c) &amp;&amp; data.fontData-&gt;platformData().orientation() != Horizontal &amp;&amp; !data.fontData-&gt;isTextOrientationFallback())
+            return glyphDataForNonCJKCharacterWithGlyphOrientation(c, description.nonCJKGlyphOrientation(), data, pageNumber);
</ins><span class="cx">     }
</span><span class="cx">     return data;
</span><span class="cx"> }
</span><span class="lines">@@ -321,15 +316,12 @@
</span><span class="cx"> 
</span><span class="cx">                 GlyphPageTreeNode* variantNode = GlyphPageTreeNode::getRootChild(variantFontData.get(), pageNumber);
</span><span class="cx">                 GlyphPage* variantPage = variantNode-&gt;page();
</span><del>-                if (variantPage) {
-                    GlyphData data = variantPage-&gt;glyphDataForCharacter(c);
-                    if (data.fontData)
-                        return data;
-                }
</del><ins>+                if (variantPage)
+                    return variantPage-&gt;glyphDataForCharacter(c);
</ins><span class="cx"> 
</span><span class="cx">                 // Do not attempt system fallback off the variantFontData. This is the very unlikely case that
</span><span class="cx">                 // a font has the lowercase character but the small caps font does not have its uppercase version.
</span><del>-                return variantFontData-&gt;missingGlyphData();
</del><ins>+                return GlyphData();
</ins><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             if (node-&gt;isSystemFallback())
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontGlyphsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontGlyphs.h (177636 => 177637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontGlyphs.h        2014-12-22 19:04:45 UTC (rev 177636)
+++ trunk/Source/WebCore/platform/graphics/FontGlyphs.h        2014-12-22 19:14:58 UTC (rev 177637)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> #define FontGlyphs_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;FontSelector.h&quot;
</span><ins>+#include &quot;GlyphPage.h&quot;
</ins><span class="cx"> #include &quot;SimpleFontData.h&quot;
</span><span class="cx"> #include &quot;WidthCache.h&quot;
</span><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsSegmentedFontDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/SegmentedFontData.cpp (177636 => 177637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/SegmentedFontData.cpp        2014-12-22 19:04:45 UTC (rev 177636)
+++ trunk/Source/WebCore/platform/graphics/SegmentedFontData.cpp        2014-12-22 19:14:58 UTC (rev 177637)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;SegmentedFontData.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;GlyphPageTreeNode.h&quot;
</ins><span class="cx"> #include &quot;SimpleFontData.h&quot;
</span><span class="cx"> #include &lt;wtf/Assertions.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsSimpleFontDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp (177636 => 177637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp        2014-12-22 19:04:45 UTC (rev 177636)
+++ trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp        2014-12-22 19:14:58 UTC (rev 177637)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> #include &quot;Font.h&quot;
</span><span class="cx"> #include &quot;FontCache.h&quot;
</span><ins>+#include &quot;GlyphPageTreeNode.h&quot;
</ins><span class="cx"> #include &quot;OpenTypeMathData.h&quot;
</span><span class="cx"> #include &lt;wtf/MathExtras.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -124,8 +125,6 @@
</span><span class="cx">         m_adjustedSpaceWidth = 0;
</span><span class="cx">         determinePitch();
</span><span class="cx">         m_zeroWidthSpaceGlyph = 0;
</span><del>-        m_missingGlyphData.fontData = this;
-        m_missingGlyphData.glyph = 0;
</del><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -149,9 +148,6 @@
</span><span class="cx">     // See &lt;http://bugs.webkit.org/show_bug.cgi?id=13178&gt; and SimpleFontData::isZeroWidthSpaceGlyph()
</span><span class="cx">     if (m_zeroWidthSpaceGlyph == m_spaceGlyph)
</span><span class="cx">         m_zeroWidthSpaceGlyph = 0;
</span><del>-
-    m_missingGlyphData.fontData = this;
-    m_missingGlyphData.glyph = 0;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> SimpleFontData::~SimpleFontData()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsSimpleFontDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/SimpleFontData.h (177636 => 177637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/SimpleFontData.h        2014-12-22 19:04:45 UTC (rev 177636)
+++ trunk/Source/WebCore/platform/graphics/SimpleFontData.h        2014-12-22 19:14:58 UTC (rev 177637)
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> #include &quot;FloatRect.h&quot;
</span><span class="cx"> #include &quot;GlyphBuffer.h&quot;
</span><span class="cx"> #include &quot;GlyphMetricsMap.h&quot;
</span><del>-#include &quot;GlyphPageTreeNode.h&quot;
</del><span class="cx"> #include &quot;OpenTypeMathData.h&quot;
</span><span class="cx"> #if ENABLE(OPENTYPE_VERTICAL)
</span><span class="cx"> #include &quot;OpenTypeVerticalData.h&quot;
</span><span class="lines">@@ -60,8 +59,10 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class GlyphPage;
</ins><span class="cx"> class FontDescription;
</span><span class="cx"> class SharedBuffer;
</span><ins>+struct GlyphData;
</ins><span class="cx"> struct WidthIterator;
</span><span class="cx"> 
</span><span class="cx"> enum FontDataVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMarkVariant, BrokenIdeographVariant };
</span><span class="lines">@@ -180,9 +181,6 @@
</span><span class="cx">     virtual bool isLoading() const override { return m_isLoading; }
</span><span class="cx">     virtual bool isSegmented() const override;
</span><span class="cx"> 
</span><del>-    const GlyphData&amp; missingGlyphData() const { return m_missingGlyphData; }
-    void setMissingGlyphData(const GlyphData&amp; glyphData) { m_missingGlyphData = glyphData; }
-
</del><span class="cx"> #ifndef NDEBUG
</span><span class="cx">     virtual String description() const override;
</span><span class="cx"> #endif
</span><span class="lines">@@ -272,8 +270,6 @@
</span><span class="cx"> 
</span><span class="cx">     Glyph m_zeroWidthSpaceGlyph;
</span><span class="cx"> 
</span><del>-    GlyphData m_missingGlyphData;
-
</del><span class="cx">     struct DerivedFontData {
</span><span class="cx">         explicit DerivedFontData(bool custom)
</span><span class="cx">             : forCustomFont(custom)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsWidthIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.cpp (177636 => 177637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/WidthIterator.cpp        2014-12-22 19:04:45 UTC (rev 177636)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.cpp        2014-12-22 19:14:58 UTC (rev 177637)
</span><span class="lines">@@ -179,8 +179,11 @@
</span><span class="cx">         int currentCharacter = textIterator.currentCharacter();
</span><span class="cx">         const GlyphData&amp; glyphData = glyphDataForCharacter(character, rtl, currentCharacter, advanceLength, normalizedSpacesStringCache);
</span><span class="cx">         Glyph glyph = glyphData.glyph;
</span><ins>+        if (!glyph) {
+            textIterator.advance(advanceLength);
+            continue;
+        }
</ins><span class="cx">         const SimpleFontData* fontData = glyphData.fontData;
</span><del>-
</del><span class="cx">         ASSERT(fontData);
</span><span class="cx"> 
</span><span class="cx">         // Now that we have a glyph and font data, get its width.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacSimpleFontDataMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm (177636 => 177637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm        2014-12-22 19:04:45 UTC (rev 177636)
+++ trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm        2014-12-22 19:14:58 UTC (rev 177637)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #import &quot;Font.h&quot;
</span><span class="cx"> #import &quot;FontCache.h&quot;
</span><span class="cx"> #import &quot;FontDescription.h&quot;
</span><ins>+#import &quot;GlyphPageTreeNode.h&quot;
</ins><span class="cx"> #import &quot;SharedBuffer.h&quot;
</span><span class="cx"> #import &quot;WebCoreSystemInterface.h&quot;
</span><span class="cx"> #if USE(APPKIT)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGTextRunRenderingContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp (177636 => 177637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp        2014-12-22 19:04:45 UTC (rev 177636)
+++ trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp        2014-12-22 19:14:58 UTC (rev 177637)
</span><span class="lines">@@ -290,36 +290,40 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static GlyphData missingGlyphForFont(const Font&amp; font)
+{
+    const SimpleFontData* primaryFontData = font.primaryFont();
+    if (!primaryFontData-&gt;isSVGFont())
+        return GlyphData();
+    SVGFontElement* fontElement;
+    SVGFontFaceElement* fontFaceElement;
+    svgFontAndFontFaceElementForFontData(primaryFontData, fontFaceElement, fontElement);
+    return GlyphData(fontElement-&gt;missingGlyph(), primaryFontData);
+}
+
</ins><span class="cx"> GlyphData SVGTextRunRenderingContext::glyphDataForCharacter(const Font&amp; font, WidthIterator&amp; iterator, UChar32 character, bool mirror, int currentCharacter, unsigned&amp; advanceLength, String&amp; normalizedSpacesStringCache)
</span><span class="cx"> {
</span><del>-    const SimpleFontData* primaryFont = font.primaryFont();
-    ASSERT(primaryFont);
-
</del><span class="cx">     GlyphData glyphData = font.glyphDataForCharacter(character, mirror, AutoVariant);
</span><ins>+    if (!glyphData.glyph)
+        return missingGlyphForFont(font);
</ins><span class="cx"> 
</span><del>-    // Check if we have the missing glyph data, in which case we can just return.
-    GlyphData missingGlyphData = primaryFont-&gt;missingGlyphData();
-    if (glyphData.glyph == missingGlyphData.glyph &amp;&amp; glyphData.fontData == missingGlyphData.fontData) {
-        ASSERT(glyphData.fontData);
-        return glyphData;
-    }
</del><ins>+    ASSERT(glyphData.fontData);
</ins><span class="cx"> 
</span><span class="cx">     // Characters enclosed by an &lt;altGlyph&gt; element, may not be registered in the GlyphPage.
</span><del>-    if (glyphData.fontData &amp;&amp; !glyphData.fontData-&gt;isSVGFont()) {
</del><ins>+    if (!glyphData.fontData-&gt;isSVGFont()) {
</ins><span class="cx">         auto&amp; elementRenderer = is&lt;RenderElement&gt;(renderer()) ? downcast&lt;RenderElement&gt;(renderer()) : *renderer().parent();
</span><span class="cx">         if (Element* parentRendererElement = elementRenderer.element()) {
</span><span class="cx">             if (is&lt;SVGAltGlyphElement&gt;(*parentRendererElement))
</span><del>-                glyphData.fontData = primaryFont;
</del><ins>+                glyphData.fontData = font.primaryFont();
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    const SimpleFontData* fontData = glyphData.fontData;
-    if (!fontData || !fontData-&gt;isSVGFont())
</del><ins>+    if (!glyphData.fontData-&gt;isSVGFont())
</ins><span class="cx">         return glyphData;
</span><span class="cx"> 
</span><span class="cx">     SVGFontElement* fontElement = nullptr;
</span><span class="cx">     SVGFontFaceElement* fontFaceElement = nullptr;
</span><del>-    const SVGFontData* svgFontData = svgFontAndFontFaceElementForFontData(fontData, fontFaceElement, fontElement);
</del><ins>+    const SVGFontData* svgFontData = svgFontAndFontFaceElementForFontData(glyphData.fontData, fontFaceElement, fontElement);
</ins><span class="cx">     if (!svgFontData)
</span><span class="cx">         return glyphData;
</span><span class="cx"> 
</span><span class="lines">@@ -329,6 +333,8 @@
</span><span class="cx">     // arabic-form/orientation/... may not match, we have to apply SVG Glyph selection to discover that.
</span><span class="cx">     if (svgFontData-&gt;applySVGGlyphSelection(iterator, glyphData, mirror, currentCharacter, advanceLength, normalizedSpacesStringCache))
</span><span class="cx">         return glyphData;
</span><ins>+
+    GlyphData missingGlyphData = missingGlyphForFont(font);
</ins><span class="cx">     if (missingGlyphData.glyph)
</span><span class="cx">         return missingGlyphData;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGFontDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGFontData.cpp (177636 => 177637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGFontData.cpp        2014-12-22 19:04:45 UTC (rev 177636)
+++ trunk/Source/WebCore/svg/SVGFontData.cpp        2014-12-22 19:14:58 UTC (rev 177637)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> #if ENABLE(SVG_FONTS)
</span><span class="cx"> #include &quot;SVGFontData.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;GlyphPageTreeNode.h&quot;
</ins><span class="cx"> #include &quot;RenderElement.h&quot;
</span><span class="cx"> #include &quot;SVGAltGlyphElement.h&quot;
</span><span class="cx"> #include &quot;SVGFontElement.h&quot;
</span><span class="lines">@@ -63,13 +64,6 @@
</span><span class="cx">     SVGFontFaceElement* svgFontFaceElement = this-&gt;svgFontFaceElement();
</span><span class="cx">     ASSERT(svgFontFaceElement);
</span><span class="cx"> 
</span><del>-    SVGFontElement* svgFontElement = svgFontFaceElement-&gt;associatedFontElement();
-    ASSERT(svgFontElement);
-    GlyphData missingGlyphData;
-    missingGlyphData.fontData = fontData;
-    missingGlyphData.glyph = svgFontElement-&gt;missingGlyph();
-    fontData-&gt;setMissingGlyphData(missingGlyphData);
-
</del><span class="cx">     fontData-&gt;setZeroWidthSpaceGlyph(0);
</span><span class="cx">     fontData-&gt;determinePitch();
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>