<!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>[201799] 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/201799">201799</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2016-06-08 01:00:22 -0700 (Wed, 08 Jun 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Extend CSSFontSelector's lifetime to be longer than the Document's lifetime
https://bugs.webkit.org/show_bug.cgi?id=154101

Reviewed by Darin Adler.

Rather than destroying the Document's CSSFontSelector, instead, the object should
live for the lifetime of the document, and it should instead be asked to clear its
contents.

This is important for the CSS Font Loading API, where the identity of objects the
CSSFontSelector references needs to persist throughout the lifetime of the
Document. This patch represents the first step to implementing this correctly.
The second step is for the CSSFontSelector to perform a diff instead of a
wholesale clear of its contents. Once this is done, font loading objects can
survive through a call to Document::clearStyleResolver().

This patch gives the CSSFontSelector two states: building underway and building not
underway. The state is building underway in between calls to clearStyleResolver()
and when the style resolver gets built back up. Otherwise, the state is building
not underway. Because of this new design, creation of all FontFace objects can be
postponed until a state transition from building underway to building not underway.
A subsequent patch will perform the diff at this point. An ASSERT() makes sure that
we never service a font lookup request while Building.

No new tests because there is no behavior change.

* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::clear):
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::buildStarted):
(WebCore::CSSFontSelector::buildCompleted):
(WebCore::CSSFontSelector::addFontFaceRule):
(WebCore::CSSFontSelector::fontRangesForFamily):
(WebCore::CSSFontSelector::CSSFontSelector): Deleted.
(WebCore::CSSFontSelector::clearDocument): Deleted.
* css/CSSFontSelector.h:
* css/StyleResolver.cpp:
(WebCore::StyleResolver::appendAuthorStyleSheets):
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::~Document):
(WebCore::Document::clearStyleResolver):
(WebCore::Document::fontSelector): Deleted.
* dom/Document.h:
(WebCore::Document::fontSelector):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSFontFaceSetcpp">trunk/Source/WebCore/css/CSSFontFaceSet.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSFontSelectorcpp">trunk/Source/WebCore/css/CSSFontSelector.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSFontSelectorh">trunk/Source/WebCore/css/CSSFontSelector.h</a></li>
<li><a href="#trunkSourceWebCorecssSourceSizeListcpp">trunk/Source/WebCore/css/SourceSizeList.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCore/css/StyleResolver.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCorestyleStyleTreeResolvercpp">trunk/Source/WebCore/style/StyleTreeResolver.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (201798 => 201799)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-06-08 07:37:08 UTC (rev 201798)
+++ trunk/Source/WebCore/ChangeLog        2016-06-08 08:00:22 UTC (rev 201799)
</span><span class="lines">@@ -1,3 +1,51 @@
</span><ins>+2016-06-08  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Extend CSSFontSelector's lifetime to be longer than the Document's lifetime
+        https://bugs.webkit.org/show_bug.cgi?id=154101
+
+        Reviewed by Darin Adler.
+
+        Rather than destroying the Document's CSSFontSelector, instead, the object should
+        live for the lifetime of the document, and it should instead be asked to clear its
+        contents.
+
+        This is important for the CSS Font Loading API, where the identity of objects the
+        CSSFontSelector references needs to persist throughout the lifetime of the
+        Document. This patch represents the first step to implementing this correctly.
+        The second step is for the CSSFontSelector to perform a diff instead of a
+        wholesale clear of its contents. Once this is done, font loading objects can
+        survive through a call to Document::clearStyleResolver().
+
+        This patch gives the CSSFontSelector two states: building underway and building not
+        underway. The state is building underway in between calls to clearStyleResolver()
+        and when the style resolver gets built back up. Otherwise, the state is building
+        not underway. Because of this new design, creation of all FontFace objects can be
+        postponed until a state transition from building underway to building not underway.
+        A subsequent patch will perform the diff at this point. An ASSERT() makes sure that
+        we never service a font lookup request while Building.
+
+        No new tests because there is no behavior change.
+
+        * css/CSSFontFaceSet.cpp:
+        (WebCore::CSSFontFaceSet::clear):
+        * css/CSSFontSelector.cpp:
+        (WebCore::CSSFontSelector::buildStarted):
+        (WebCore::CSSFontSelector::buildCompleted):
+        (WebCore::CSSFontSelector::addFontFaceRule):
+        (WebCore::CSSFontSelector::fontRangesForFamily):
+        (WebCore::CSSFontSelector::CSSFontSelector): Deleted.
+        (WebCore::CSSFontSelector::clearDocument): Deleted.
+        * css/CSSFontSelector.h:
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::appendAuthorStyleSheets):
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        (WebCore::Document::~Document):
+        (WebCore::Document::clearStyleResolver):
+        (WebCore::Document::fontSelector): Deleted.
+        * dom/Document.h:
+        (WebCore::Document::fontSelector):
+
</ins><span class="cx"> 2016-06-08  Adam Bergkvist  &lt;adam.bergkvist@ericsson.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WebRTC: Imlement MediaEndpointPeerConnection::setLocalDescription()
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontFaceSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontFaceSet.cpp (201798 => 201799)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontFaceSet.cpp        2016-06-08 07:37:08 UTC (rev 201798)
+++ trunk/Source/WebCore/css/CSSFontFaceSet.cpp        2016-06-08 08:00:22 UTC (rev 201799)
</span><span class="lines">@@ -244,6 +244,8 @@
</span><span class="cx">     m_facesLookupTable.clear();
</span><span class="cx">     m_locallyInstalledFacesLookupTable.clear();
</span><span class="cx">     m_cache.clear();
</span><ins>+    m_facesPartitionIndex = 0;
+    m_status = Status::Loaded;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> CSSFontFace&amp; CSSFontFaceSet::operator[](size_t i)
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontSelectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (201798 => 201799)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontSelector.cpp        2016-06-08 07:37:08 UTC (rev 201798)
+++ trunk/Source/WebCore/css/CSSFontSelector.cpp        2016-06-08 08:00:22 UTC (rev 201799)
</span><span class="lines">@@ -71,10 +71,6 @@
</span><span class="cx">     , m_uniqueId(++fontSelectorId)
</span><span class="cx">     , m_version(0)
</span><span class="cx"> {
</span><del>-    // FIXME: An old comment used to say there was no need to hold a reference to m_document
-    // because &quot;we are guaranteed to be destroyed before the document&quot;. But there does not
-    // seem to be any such guarantee.
-
</del><span class="cx">     ASSERT(m_document);
</span><span class="cx">     FontCache::singleton().addClient(*this);
</span><span class="cx">     m_cssFontFaceSet-&gt;addClient(*this);
</span><span class="lines">@@ -102,8 +98,33 @@
</span><span class="cx">     return !m_cssFontFaceSet-&gt;faceCount();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void CSSFontSelector::buildStarted()
+{
+    m_buildIsUnderway = true;
+    ++m_version;
+}
+
+void CSSFontSelector::buildCompleted()
+{
+    if (!m_buildIsUnderway)
+        return;
+
+    m_buildIsUnderway = false;
+
+    m_cssFontFaceSet-&gt;clear();
+
+    for (auto&amp; item : m_stagingArea)
+        addFontFaceRule(item.styleRuleFontFace, item.isInitiatingElementInUserAgentShadowTree);
+    m_stagingArea.clear();
+}
+
</ins><span class="cx"> void CSSFontSelector::addFontFaceRule(StyleRuleFontFace&amp; fontFaceRule, bool isInitiatingElementInUserAgentShadowTree)
</span><span class="cx"> {
</span><ins>+    if (m_buildIsUnderway) {
+        m_stagingArea.append({fontFaceRule, isInitiatingElementInUserAgentShadowTree});
+        return;
+    }
+
</ins><span class="cx">     const StyleProperties&amp; style = fontFaceRule.properties();
</span><span class="cx">     RefPtr&lt;CSSValue&gt; fontFamily = style.getPropertyCSSValue(CSSPropertyFontFamily);
</span><span class="cx">     RefPtr&lt;CSSValue&gt; fontStyle = style.getPropertyCSSValue(CSSPropertyFontStyle);
</span><span class="lines">@@ -235,6 +256,8 @@
</span><span class="cx"> 
</span><span class="cx"> FontRanges CSSFontSelector::fontRangesForFamily(const FontDescription&amp; fontDescription, const AtomicString&amp; familyName)
</span><span class="cx"> {
</span><ins>+    ASSERT(!m_buildIsUnderway); // If this ASSERT() fires, it usually means you forgot a document.updateStyleIfNeeded() somewhere.
+
</ins><span class="cx">     // FIXME: The spec (and Firefox) says user specified generic families (sans-serif etc.) should be resolved before the @font-face lookup too.
</span><span class="cx">     bool resolveGenericFamilyFirst = familyName == standardFamily;
</span><span class="cx"> 
</span><span class="lines">@@ -268,7 +291,6 @@
</span><span class="cx"> 
</span><span class="cx">     m_document = nullptr;
</span><span class="cx"> 
</span><del>-    // FIXME: This object should outlive the Document.
</del><span class="cx">     m_cssFontFaceSet-&gt;clear();
</span><span class="cx">     m_clients.clear();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontSelectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontSelector.h (201798 => 201799)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontSelector.h        2016-06-08 07:37:08 UTC (rev 201798)
+++ trunk/Source/WebCore/css/CSSFontSelector.h        2016-06-08 08:00:22 UTC (rev 201799)
</span><span class="lines">@@ -65,6 +65,8 @@
</span><span class="cx">     RefPtr&lt;Font&gt; fallbackFontAt(const FontDescription&amp;, size_t) override;
</span><span class="cx"> 
</span><span class="cx">     void clearDocument();
</span><ins>+    void buildStarted();
+    void buildCompleted();
</ins><span class="cx"> 
</span><span class="cx">     void addFontFaceRule(StyleRuleFontFace&amp;, bool isInitiatingElementInUserAgentShadowTree);
</span><span class="cx"> 
</span><span class="lines">@@ -91,6 +93,12 @@
</span><span class="cx"> 
</span><span class="cx">     void beginLoadTimerFired();
</span><span class="cx"> 
</span><ins>+    struct PendingFontFaceRule {
+        StyleRuleFontFace&amp; styleRuleFontFace;
+        bool isInitiatingElementInUserAgentShadowTree;
+    };
+    Vector&lt;PendingFontFaceRule&gt; m_stagingArea;
+
</ins><span class="cx">     Document* m_document;
</span><span class="cx">     RefPtr&lt;FontFaceSet&gt; m_fontFaceSet;
</span><span class="cx">     Ref&lt;CSSFontFaceSet&gt; m_cssFontFaceSet;
</span><span class="lines">@@ -102,6 +110,7 @@
</span><span class="cx">     unsigned m_uniqueId;
</span><span class="cx">     unsigned m_version;
</span><span class="cx">     bool m_creatingFont { false };
</span><ins>+    bool m_buildIsUnderway { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecssSourceSizeListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SourceSizeList.cpp (201798 => 201799)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SourceSizeList.cpp        2016-06-08 07:37:08 UTC (rev 201798)
+++ trunk/Source/WebCore/css/SourceSizeList.cpp        2016-06-08 08:00:22 UTC (rev 201799)
</span><span class="lines">@@ -47,6 +47,20 @@
</span><span class="cx">         CSSPrimitiveValue&amp; primitiveValue = downcast&lt;CSSPrimitiveValue&gt;(value);
</span><span class="cx">         if (!primitiveValue.isLength())
</span><span class="cx">             return defaultLength(style, renderer);
</span><ins>+
+        // Because we evaluate &quot;sizes&quot; at parse time (before style has been resolved), the font metrics used for these specific units
+        // are not available. The font selector's internal consistency isn't guaranteed just yet, so we can just temporarily clear
+        // the pointer to it for the duration of the unit evaluation. This is acceptible because the style always comes from the
+        // RenderView, which has its font information hardcoded in resolveForDocument() to be -webkit-standard, whose operations
+        // don't require a font selector.
+        if (!primitiveValue.isCalculated() &amp;&amp; (primitiveValue.primitiveType() == CSSPrimitiveValue::CSS_EXS || primitiveValue.primitiveType() == CSSPrimitiveValue::CSS_CHS)) {
+            RefPtr&lt;FontSelector&gt; fontSelector = style.fontCascade().fontSelector();
+            style.fontCascade().update(nullptr);
+            float result = primitiveValue.computeLength&lt;float&gt;(conversionData);
+            style.fontCascade().update(fontSelector.get());
+            return result;
+        }
+
</ins><span class="cx">         return primitiveValue.computeLength&lt;float&gt;(conversionData);
</span><span class="cx">     }
</span><span class="cx">     if (is&lt;CSSCalcValue&gt;(value))
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (201798 => 201799)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2016-06-08 07:37:08 UTC (rev 201798)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2016-06-08 08:00:22 UTC (rev 201799)
</span><span class="lines">@@ -296,6 +296,9 @@
</span><span class="cx"> void StyleResolver::appendAuthorStyleSheets(const Vector&lt;RefPtr&lt;CSSStyleSheet&gt;&gt;&amp; styleSheets)
</span><span class="cx"> {
</span><span class="cx">     m_ruleSets.appendAuthorStyleSheets(styleSheets, &amp;m_mediaQueryEvaluator, m_inspectorCSSOMWrappers, this);
</span><ins>+
+    document().fontSelector().buildCompleted();
+
</ins><span class="cx">     if (auto renderView = document().renderView())
</span><span class="cx">         renderView-&gt;style().fontCascade().update(&amp;document().fontSelector());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (201798 => 201799)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-06-08 07:37:08 UTC (rev 201798)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-06-08 08:00:22 UTC (rev 201799)
</span><span class="lines">@@ -529,6 +529,7 @@
</span><span class="cx">     , m_didDispatchViewportPropertiesChanged(false)
</span><span class="cx"> #endif
</span><span class="cx">     , m_templateDocumentHost(nullptr)
</span><ins>+    , m_fontSelector(CSSFontSelector::create(*this))
</ins><span class="cx"> #if ENABLE(WEB_REPLAY)
</span><span class="cx">     , m_inputCursor(EmptyInputCursor::create())
</span><span class="cx"> #endif
</span><span class="lines">@@ -563,6 +564,8 @@
</span><span class="cx">     initSecurityContext();
</span><span class="cx">     initDNSPrefetch();
</span><span class="cx"> 
</span><ins>+    m_fontSelector-&gt;registerForInvalidationCallbacks(*this);
+
</ins><span class="cx">     for (auto&amp; nodeListAndCollectionCount : m_nodeListAndCollectionCounts)
</span><span class="cx">         nodeListAndCollectionCount = 0;
</span><span class="cx"> }
</span><span class="lines">@@ -637,6 +640,8 @@
</span><span class="cx">     extensionStyleSheets().detachFromDocument();
</span><span class="cx"> 
</span><span class="cx">     clearStyleResolver(); // We need to destroy CSSFontSelector before destroying m_cachedResourceLoader.
</span><ins>+    m_fontSelector-&gt;clearDocument();
+    m_fontSelector-&gt;unregisterForInvalidationCallbacks(*this);
</ins><span class="cx"> 
</span><span class="cx">     // It's possible for multiple Documents to end up referencing the same CachedResourceLoader (e.g., SVGImages
</span><span class="cx">     // load the initial empty document and the SVGDocument with the same DocumentLoader).
</span><span class="lines">@@ -2208,26 +2213,12 @@
</span><span class="cx">     scheduleForcedStyleRecalc();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CSSFontSelector&amp; Document::fontSelector()
-{
-    if (!m_fontSelector) {
-        m_fontSelector = CSSFontSelector::create(*this);
-        m_fontSelector-&gt;registerForInvalidationCallbacks(*this);
-    }
-    return *m_fontSelector;
-}
-
</del><span class="cx"> void Document::clearStyleResolver()
</span><span class="cx"> {
</span><span class="cx">     m_styleResolver = nullptr;
</span><span class="cx">     m_userAgentShadowTreeStyleResolver = nullptr;
</span><span class="cx"> 
</span><del>-    // FIXME: It would be better if the FontSelector could survive this operation.
-    if (m_fontSelector) {
-        m_fontSelector-&gt;clearDocument();
-        m_fontSelector-&gt;unregisterForInvalidationCallbacks(*this);
-        m_fontSelector = nullptr;
-    }
</del><ins>+    m_fontSelector-&gt;buildStarted();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Document::createRenderTree()
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (201798 => 201799)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2016-06-08 07:37:08 UTC (rev 201798)
+++ trunk/Source/WebCore/dom/Document.h        2016-06-08 08:00:22 UTC (rev 201799)
</span><span class="lines">@@ -504,7 +504,7 @@
</span><span class="cx">     }
</span><span class="cx">     StyleResolver&amp; userAgentShadowTreeStyleResolver();
</span><span class="cx"> 
</span><del>-    CSSFontSelector&amp; fontSelector();
</del><ins>+    CSSFontSelector&amp; fontSelector() { return m_fontSelector; }
</ins><span class="cx"> 
</span><span class="cx">     void notifyRemovePendingSheetIfNeeded();
</span><span class="cx"> 
</span><span class="lines">@@ -1736,7 +1736,7 @@
</span><span class="cx">     std::unique_ptr&lt;CustomElementDefinitions&gt; m_customElementDefinitions;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    RefPtr&lt;CSSFontSelector&gt; m_fontSelector;
</del><ins>+    Ref&lt;CSSFontSelector&gt; m_fontSelector;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEB_REPLAY)
</span><span class="cx">     RefPtr&lt;JSC::InputCursor&gt; m_inputCursor;
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleTreeResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (201798 => 201799)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleTreeResolver.cpp        2016-06-08 07:37:08 UTC (rev 201798)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp        2016-06-08 08:00:22 UTC (rev 201799)
</span><span class="lines">@@ -492,8 +492,10 @@
</span><span class="cx">     auto&amp; renderView = *m_document.renderView();
</span><span class="cx"> 
</span><span class="cx">     Element* documentElement = m_document.documentElement();
</span><del>-    if (!documentElement)
</del><ins>+    if (!documentElement) {
+        m_document.ensureStyleResolver();
</ins><span class="cx">         return nullptr;
</span><ins>+    }
</ins><span class="cx">     if (change != Force &amp;&amp; !documentElement-&gt;childNeedsStyleRecalc() &amp;&amp; !documentElement-&gt;needsStyleRecalc())
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>