<!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>[173209] 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/173209">173209</a></dd>
<dt>Author</dt> <dd>betravis@adobe.com</dd>
<dt>Date</dt> <dd>2014-09-03 10:26:09 -0700 (Wed, 03 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[CSS Font Loading] Enable Page Caching
https://bugs.webkit.org/show_bug.cgi?id=136044

Reviewed by Andreas Kling.

Source/WebCore:

Modifying FontLoader to track fonts loaded via the loadFont
method as well as via CSS rules. Fonts loaded via loadFont are
tracked in m_numLoadingFromJS, while fonts loaded via CSS rules
are tracked in m_numLoadingFromCSS. The page is cacheable when no
fonts are currently loading.

Added fast/css/fontloader-page-cache.html

* css/FontLoader.cpp:
(WebCore::LoadFontCallback::create): Modified to take and store
the number of fonts it will be loading.
(WebCore::LoadFontCallback::createFromParams): Ditto.
(WebCore::LoadFontCallback::familyCount): Getter for number of
fonts loaded via this callback.
(WebCore::LoadFontCallback::LoadFontCallback):
(WebCore::LoadFontCallback::notifyLoaded): Callback the FontLoader
to let it update its count when all the fonts have finished loading.
(WebCore::FontLoader::loadFontDone): Ditto.
(WebCore::FontLoader::FontLoader):
(WebCore::FontLoader::beginFontLoading): Track the number of fonts
loading.
(WebCore::FontLoader::fontLoaded): Ditto.
(WebCore::FontLoader::loadError): Ditto.
(WebCore::FontLoader::loadFont):
* css/FontLoader.h:
(WebCore::FontLoader::loading):

LayoutTests:

Adding test that loads a font then navigates away and back.
Test must also be disabled while feature is turned off.

* TestExpectations: Skip test.
* fast/css/fontloader-page-cache-expected.txt: Added.
* fast/css/fontloader-page-cache.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssFontLoadercpp">trunk/Source/WebCore/css/FontLoader.cpp</a></li>
<li><a href="#trunkSourceWebCorecssFontLoaderh">trunk/Source/WebCore/css/FontLoader.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcssfontloaderpagecacheexpectedtxt">trunk/LayoutTests/fast/css/fontloader-page-cache-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssfontloaderpagecachehtml">trunk/LayoutTests/fast/css/fontloader-page-cache.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (173208 => 173209)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-09-03 17:05:08 UTC (rev 173208)
+++ trunk/LayoutTests/ChangeLog        2014-09-03 17:26:09 UTC (rev 173209)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-09-03  Bear Travis  &lt;betravis@adobe.com&gt;
+
+        [CSS Font Loading] Enable Page Caching
+        https://bugs.webkit.org/show_bug.cgi?id=136044
+
+        Reviewed by Andreas Kling.
+
+        Adding test that loads a font then navigates away and back.
+        Test must also be disabled while feature is turned off.
+
+        * TestExpectations: Skip test.
+        * fast/css/fontloader-page-cache-expected.txt: Added.
+        * fast/css/fontloader-page-cache.html: Added.
+
</ins><span class="cx"> 2014-09-02  Brian J. Burg  &lt;burg@cs.washington.edu&gt;
</span><span class="cx"> 
</span><span class="cx">         LegacyProfiler: remove redundant ProfileNode members and other cleanup
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (173208 => 173209)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2014-09-03 17:05:08 UTC (rev 173208)
+++ trunk/LayoutTests/TestExpectations        2014-09-03 17:26:09 UTC (rev 173209)
</span><span class="lines">@@ -140,6 +140,7 @@
</span><span class="cx"> webkit.org/b/135390 fast/css/fontloader-multiple-faces-download-error.html [ Skip ]
</span><span class="cx"> webkit.org/b/135390 fast/css/fontloader-multiple-faces.html [ Skip ]
</span><span class="cx"> webkit.org/b/135390 fast/css/fontloader-multiple-families.html [ Skip ]
</span><ins>+webkit.org/b/135390 fast/css/fontloader-page-cache.html [ Skip ]
</ins><span class="cx"> webkit.org/b/135390 http/tests/webfont/fontloader-loading-attribute.html [ Skip ]
</span><span class="cx"> 
</span><span class="cx"> # Various failures from the W3C CSS Shapes test suite import
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssfontloaderpagecacheexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/fontloader-page-cache-expected.txt (0 => 173209)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/fontloader-page-cache-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/css/fontloader-page-cache-expected.txt        2014-09-03 17:26:09 UTC (rev 173209)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+This test verifies that the page cache preserves pages with fonts loaded via the document.fonts API. The test loads a font, then navigates away and back, confirming that the font remains loaded. If successful, it outputs 'PASS' below.
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssfontloaderpagecachehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/fontloader-page-cache.html (0 => 173209)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/fontloader-page-cache.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/fontloader-page-cache.html        2014-09-03 17:26:09 UTC (rev 173209)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;style&gt;
+@font-face {
+    font-family: TestFont;
+    src: url(../../resources/Ahem.ttf);
+}
+&lt;/style&gt;
+&lt;script&gt;
+var timeoutValue = 100; //ms
+
+var timestamp;
+function verify() {
+    document.getElementById(&quot;result&quot;).innerHTML =
+        document.fonts.checkFont(&quot;10px TestFont&quot;) ? 'PASS' : 'FAIL with TestFont missing';
+
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+function runTest() {
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+        testRunner.overridePreference(&quot;WebKitUsesPageCachePreferenceKey&quot;, 1);
+    }
+    document.fonts.loadFont({ font: '10px TestFont', onsuccess: onsuccess, onerror: onerror });
+}
+
+function onsuccess() {
+    window.setTimeout(verify, timeoutValue);
+    window.setTimeout(function() {
+    window.location.href = &quot;data:text/html,&lt;body onload='history.back()'&gt;&lt;/body&gt;&quot;;
+}, 0);
+}
+
+function onerror() {
+    document.getElementById(&quot;result&quot;).innerHTML = &quot;FAIL with font load error&quot;;
+    testRunner.notifyDone();
+}
+
+&lt;/script&gt;
+&lt;body onload='runTest()'&gt;
+This test verifies that the page cache preserves pages with fonts loaded via the document.fonts API. The test loads a font, then navigates away and back, confirming that the font remains loaded. If successful, it outputs 'PASS' below.
+&lt;div id=&quot;result&quot;&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (173208 => 173209)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-09-03 17:05:08 UTC (rev 173208)
+++ trunk/Source/WebCore/ChangeLog        2014-09-03 17:26:09 UTC (rev 173209)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2014-09-03  Bear Travis  &lt;betravis@adobe.com&gt;
+
+        [CSS Font Loading] Enable Page Caching
+        https://bugs.webkit.org/show_bug.cgi?id=136044
+
+        Reviewed by Andreas Kling.
+
+        Modifying FontLoader to track fonts loaded via the loadFont
+        method as well as via CSS rules. Fonts loaded via loadFont are
+        tracked in m_numLoadingFromJS, while fonts loaded via CSS rules
+        are tracked in m_numLoadingFromCSS. The page is cacheable when no
+        fonts are currently loading.
+
+        Added fast/css/fontloader-page-cache.html
+
+        * css/FontLoader.cpp:
+        (WebCore::LoadFontCallback::create): Modified to take and store
+        the number of fonts it will be loading.
+        (WebCore::LoadFontCallback::createFromParams): Ditto.
+        (WebCore::LoadFontCallback::familyCount): Getter for number of
+        fonts loaded via this callback.
+        (WebCore::LoadFontCallback::LoadFontCallback):
+        (WebCore::LoadFontCallback::notifyLoaded): Callback the FontLoader
+        to let it update its count when all the fonts have finished loading.
+        (WebCore::FontLoader::loadFontDone): Ditto.
+        (WebCore::FontLoader::FontLoader):
+        (WebCore::FontLoader::beginFontLoading): Track the number of fonts
+        loading.
+        (WebCore::FontLoader::fontLoaded): Ditto.
+        (WebCore::FontLoader::loadError): Ditto.
+        (WebCore::FontLoader::loadFont):
+        * css/FontLoader.h:
+        (WebCore::FontLoader::loading):
+
</ins><span class="cx"> 2014-08-29  Gavin Barraclough  &lt;barraclough@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Simplify DOMTimer::adjustMinimumTimerInterval -&gt; updateTimerIntervalIfNecessary
</span></span></pre></div>
<a id="trunkSourceWebCorecssFontLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/FontLoader.cpp (173208 => 173209)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/FontLoader.cpp        2014-09-03 17:05:08 UTC (rev 173208)
+++ trunk/Source/WebCore/css/FontLoader.cpp        2014-09-03 17:26:09 UTC (rev 173209)
</span><span class="lines">@@ -48,12 +48,12 @@
</span><span class="cx"> 
</span><span class="cx"> class LoadFontCallback : public CSSSegmentedFontFace::LoadFontCallback {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;LoadFontCallback&gt; create(int numLoading, PassRefPtr&lt;VoidCallback&gt; loadCallback, PassRefPtr&lt;VoidCallback&gt; errorCallback)
</del><ins>+    static PassRefPtr&lt;LoadFontCallback&gt; create(int numLoading, FontLoader&amp; fontLoader, PassRefPtr&lt;VoidCallback&gt; loadCallback, PassRefPtr&lt;VoidCallback&gt; errorCallback)
</ins><span class="cx">     {
</span><del>-        return adoptRef&lt;LoadFontCallback&gt;(new LoadFontCallback(numLoading, loadCallback, errorCallback));
</del><ins>+        return adoptRef&lt;LoadFontCallback&gt;(new LoadFontCallback(numLoading, fontLoader, loadCallback, errorCallback));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static PassRefPtr&lt;LoadFontCallback&gt; createFromParams(const Dictionary&amp; params, const Font&amp; font)
</del><ins>+    static PassRefPtr&lt;LoadFontCallback&gt; createFromParams(const Dictionary&amp; params, FontLoader&amp; fontLoader, const Font&amp; font)
</ins><span class="cx">     {
</span><span class="cx">         RefPtr&lt;VoidCallback&gt; onsuccess;
</span><span class="cx">         RefPtr&lt;VoidCallback&gt; onerror;
</span><span class="lines">@@ -62,23 +62,29 @@
</span><span class="cx">         if (!onsuccess &amp;&amp; !onerror)
</span><span class="cx">             return 0;
</span><span class="cx">         int numFamilies = font.familyCount();
</span><del>-        return LoadFontCallback::create(numFamilies, onsuccess, onerror);
</del><ins>+        return LoadFontCallback::create(numFamilies, fontLoader, onsuccess, onerror);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     virtual void notifyLoaded() override;
</span><span class="cx">     virtual void notifyError() override;
</span><span class="cx">     virtual ~LoadFontCallback() { };
</span><span class="cx"> 
</span><ins>+    int familyCount() const { return m_familyCount; }
+
</ins><span class="cx"> private:
</span><del>-    LoadFontCallback(int numLoading, PassRefPtr&lt;VoidCallback&gt; loadCallback, PassRefPtr&lt;VoidCallback&gt; errorCallback)
-        : m_numLoading(numLoading)
</del><ins>+    LoadFontCallback(int numLoading, FontLoader&amp; fontLoader, PassRefPtr&lt;VoidCallback&gt; loadCallback, PassRefPtr&lt;VoidCallback&gt; errorCallback)
+        : m_familyCount(numLoading)
+        , m_numLoading(numLoading)
</ins><span class="cx">         , m_errorOccured(false)
</span><ins>+        , m_fontLoader(fontLoader)
</ins><span class="cx">         , m_loadCallback(loadCallback)
</span><span class="cx">         , m_errorCallback(errorCallback)
</span><span class="cx">     { }
</span><span class="cx"> 
</span><ins>+    int m_familyCount;
</ins><span class="cx">     int m_numLoading;
</span><span class="cx">     bool m_errorOccured;
</span><ins>+    FontLoader&amp; m_fontLoader;
</ins><span class="cx">     RefPtr&lt;VoidCallback&gt; m_loadCallback;
</span><span class="cx">     RefPtr&lt;VoidCallback&gt; m_errorCallback;
</span><span class="cx"> };
</span><span class="lines">@@ -96,6 +102,7 @@
</span><span class="cx">         if (m_loadCallback)
</span><span class="cx">             m_loadCallback-&gt;handleEvent();
</span><span class="cx">     }
</span><ins>+    m_fontLoader.loadFontDone(*this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void LoadFontCallback::notifyError() 
</span><span class="lines">@@ -104,10 +111,16 @@
</span><span class="cx">     notifyLoaded();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void FontLoader::loadFontDone(const LoadFontCallback&amp; callback)
+{
+    m_numLoadingFromJS -= callback.familyCount();
+}
+
</ins><span class="cx"> FontLoader::FontLoader(Document* document)
</span><span class="cx">     : ActiveDOMObject(document)
</span><span class="cx">     , m_document(document)
</span><del>-    , m_loadingCount(0)
</del><ins>+    , m_numLoadingFromCSS(0)
+    , m_numLoadingFromJS(0)
</ins><span class="cx"> {
</span><span class="cx">     suspendIfNeeded();
</span><span class="cx"> }
</span><span class="lines">@@ -167,31 +180,31 @@
</span><span class="cx"> 
</span><span class="cx"> void FontLoader::beginFontLoading(CSSFontFaceRule* rule)
</span><span class="cx"> {
</span><del>-    ++m_loadingCount;
-    if (m_loadingCount == 1 &amp;&amp; !m_loadingDoneEvent)
</del><ins>+    ++m_numLoadingFromCSS;
+    if (m_numLoadingFromCSS == 1 &amp;&amp; !m_loadingDoneEvent)
</ins><span class="cx">         scheduleEvent(CSSFontFaceLoadEvent::createForFontFaceRule(eventNames().loadingEvent, rule));
</span><span class="cx">     scheduleEvent(CSSFontFaceLoadEvent::createForFontFaceRule(eventNames().loadstartEvent, rule));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FontLoader::fontLoaded(CSSFontFaceRule* rule)
</span><span class="cx"> {
</span><del>-    ASSERT(m_loadingCount &gt; 0);
</del><ins>+    ASSERT(m_numLoadingFromCSS &gt; 0);
</ins><span class="cx">     scheduleEvent(CSSFontFaceLoadEvent::createForFontFaceRule(eventNames().loadEvent, rule));
</span><span class="cx"> 
</span><del>-    --m_loadingCount;
-    if (!m_loadingCount)
</del><ins>+    --m_numLoadingFromCSS;
+    if (!m_numLoadingFromCSS)
</ins><span class="cx">         m_loadingDoneEvent = CSSFontFaceLoadEvent::createForFontFaceRule(eventNames().loadingdoneEvent, rule);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FontLoader::loadError(CSSFontFaceRule* rule, CSSFontFaceSource* source)
</span><span class="cx"> {
</span><del>-    ASSERT(m_loadingCount &gt; 0);
</del><ins>+    ASSERT(m_numLoadingFromCSS &gt; 0);
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: We should report NetworkError in case of timeout, etc.
</span><span class="cx">     String errorName = (source &amp;&amp; source-&gt;isDecodeError()) ? &quot;InvalidFontDataError&quot; : ExceptionCodeDescription(NOT_FOUND_ERR).name;
</span><span class="cx">     scheduleEvent(CSSFontFaceLoadEvent::createForError(rule, DOMError::create(errorName)));
</span><del>-    --m_loadingCount;
-    if (!m_loadingCount)
</del><ins>+    --m_numLoadingFromCSS;
+    if (!m_numLoadingFromCSS)
</ins><span class="cx">         m_loadingDoneEvent = CSSFontFaceLoadEvent::createForFontFaceRule(eventNames().loadingdoneEvent, rule);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -236,8 +249,9 @@
</span><span class="cx">     Font font;
</span><span class="cx">     if (!resolveFontStyle(fontString, font))
</span><span class="cx">         return;
</span><del>-    RefPtr&lt;LoadFontCallback&gt; callback = LoadFontCallback::createFromParams(params, font);
-    
</del><ins>+    RefPtr&lt;LoadFontCallback&gt; callback = LoadFontCallback::createFromParams(params, *this, font);
+    m_numLoadingFromJS += callback-&gt;familyCount();
+
</ins><span class="cx">     for (unsigned i = 0; i &lt; font.familyCount(); i++) {
</span><span class="cx">         CSSSegmentedFontFace* face = m_document-&gt;ensureStyleResolver().fontSelector()-&gt;getFontFace(font.fontDescription(), font.familyAt(i));
</span><span class="cx">         if (!face) {
</span></span></pre></div>
<a id="trunkSourceWebCorecssFontLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/FontLoader.h (173208 => 173209)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/FontLoader.h        2014-09-03 17:05:08 UTC (rev 173208)
+++ trunk/Source/WebCore/css/FontLoader.h        2014-09-03 17:26:09 UTC (rev 173209)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> class Document;
</span><span class="cx"> class Event;
</span><span class="cx"> class Font;
</span><ins>+class LoadFontCallback;
</ins><span class="cx"> class ScriptExecutionContext;
</span><span class="cx"> 
</span><span class="cx"> class FontLoader : public RefCounted&lt;FontLoader&gt;, public ActiveDOMObject, public EventTarget {
</span><span class="lines">@@ -63,9 +64,11 @@
</span><span class="cx"> 
</span><span class="cx">     bool checkFont(const String&amp;, const String&amp;);
</span><span class="cx">     void loadFont(const Dictionary&amp;);
</span><ins>+    void loadFontDone(const LoadFontCallback&amp;);
+
</ins><span class="cx">     void notifyWhenFontsReady(PassRefPtr&lt;VoidCallback&gt;);
</span><span class="cx"> 
</span><del>-    bool loading() const { return m_loadingCount &gt; 0; }
</del><ins>+    bool loading() const { return m_numLoadingFromCSS &gt; 0; }
</ins><span class="cx"> 
</span><span class="cx">     virtual ScriptExecutionContext* scriptExecutionContext() const;
</span><span class="cx">     virtual EventTargetInterface eventTargetInterface() const;
</span><span class="lines">@@ -81,6 +84,8 @@
</span><span class="cx">     void loadError(CSSFontFaceRule*, CSSFontFaceSource*);
</span><span class="cx">     void loadingDone();
</span><span class="cx"> 
</span><ins>+    virtual bool canSuspend() const override { return !m_numLoadingFromCSS &amp;&amp; !m_numLoadingFromJS; }
+
</ins><span class="cx"> private:
</span><span class="cx">     FontLoader(Document*);
</span><span class="cx"> 
</span><span class="lines">@@ -95,7 +100,8 @@
</span><span class="cx"> 
</span><span class="cx">     Document* m_document;
</span><span class="cx">     EventTargetData m_eventTargetData;
</span><del>-    unsigned m_loadingCount;
</del><ins>+    unsigned m_numLoadingFromCSS;
+    unsigned m_numLoadingFromJS;
</ins><span class="cx">     Vector&lt;RefPtr&lt;Event&gt;&gt; m_pendingEvents;
</span><span class="cx">     Vector&lt;RefPtr&lt;VoidCallback&gt;&gt; m_callbacks;
</span><span class="cx">     RefPtr&lt;Event&gt; m_loadingDoneEvent;
</span></span></pre>
</div>
</div>

</body>
</html>