<!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>[197456] 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/197456">197456</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-03-02 10:54:03 -0800 (Wed, 02 Mar 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/197434">r197434</a> and <a href="http://trac.webkit.org/projects/webkit/changeset/197436">r197436</a>.
https://bugs.webkit.org/show_bug.cgi?id=154921
This change caused a LayoutTest assertion in debug (Requested
by ryanhaddad on #webkit).
Reverted changesets:
"Extend CSSFontSelector's lifetime to be longer than the
Document's lifetime"
https://bugs.webkit.org/show_bug.cgi?id=154101
http://trac.webkit.org/changeset/197434
"Unreviewed build fix after <a href="http://trac.webkit.org/projects/webkit/changeset/197434">r197434</a>."
http://trac.webkit.org/changeset/197436</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="#trunkSourceWebCorecssCSSStyleSheetcpp">trunk/Source/WebCore/css/CSSStyleSheet.cpp</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 (197455 => 197456)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-02 18:31:22 UTC (rev 197455)
+++ trunk/Source/WebCore/ChangeLog        2016-03-02 18:54:03 UTC (rev 197456)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2016-03-02 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed, rolling out r197434 and r197436.
+ https://bugs.webkit.org/show_bug.cgi?id=154921
+
+ This change caused a LayoutTest assertion in debug (Requested
+ by ryanhaddad on #webkit).
+
+ Reverted changesets:
+
+ "Extend CSSFontSelector's lifetime to be longer than the
+ Document's lifetime"
+ https://bugs.webkit.org/show_bug.cgi?id=154101
+ http://trac.webkit.org/changeset/197434
+
+ "Unreviewed build fix after r197434."
+ http://trac.webkit.org/changeset/197436
+
</ins><span class="cx"> 2016-03-02 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> Subpixel layout: Enable vertical/horizontal subpixel spacing for tables.
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontFaceSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontFaceSet.cpp (197455 => 197456)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontFaceSet.cpp        2016-03-02 18:31:22 UTC (rev 197455)
+++ trunk/Source/WebCore/css/CSSFontFaceSet.cpp        2016-03-02 18:54:03 UTC (rev 197456)
</span><span class="lines">@@ -242,8 +242,6 @@
</span><span class="cx"> m_facesLookupTable.clear();
</span><span class="cx"> m_locallyInstalledFacesLookupTable.clear();
</span><span class="cx"> m_cache.clear();
</span><del>- m_facesPartitionIndex = 0;
- m_status = Status::Loaded;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> CSSFontFace& CSSFontFaceSet::operator[](size_t i)
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontSelectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (197455 => 197456)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontSelector.cpp        2016-03-02 18:31:22 UTC (rev 197455)
+++ trunk/Source/WebCore/css/CSSFontSelector.cpp        2016-03-02 18:54:03 UTC (rev 197456)
</span><span class="lines">@@ -70,6 +70,10 @@
</span><span class="cx"> , m_uniqueId(++fontSelectorId)
</span><span class="cx"> , m_version(0)
</span><span class="cx"> {
</span><ins>+ // FIXME: An old comment used to say there was no need to hold a reference to m_document
+ // because "we are guaranteed to be destroyed before the document". But there does not
+ // seem to be any such guarantee.
+
</ins><span class="cx"> ASSERT(m_document);
</span><span class="cx"> FontCache::singleton().addClient(*this);
</span><span class="cx"> m_cssFontFaceSet->addClient(*this);
</span><span class="lines">@@ -97,33 +101,8 @@
</span><span class="cx"> return !m_cssFontFaceSet->faceCount();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void CSSFontSelector::buildStarted()
-{
- m_buildIsUnderway = true;
- ++m_version;
-}
-
-void CSSFontSelector::buildCompleted()
-{
- if (!m_buildIsUnderway)
- return;
-
- m_buildIsUnderway = false;
-
- m_cssFontFaceSet->clear();
-
- for (auto& item : m_stagingArea)
- addFontFaceRule(item.styleRuleFontFace, item.isInitiatingElementInUserAgentShadowTree);
- m_stagingArea.clear();
-}
-
</del><span class="cx"> void CSSFontSelector::addFontFaceRule(StyleRuleFontFace& fontFaceRule, bool isInitiatingElementInUserAgentShadowTree)
</span><span class="cx"> {
</span><del>- if (m_buildIsUnderway) {
- m_stagingArea.append({fontFaceRule, isInitiatingElementInUserAgentShadowTree});
- return;
- }
-
</del><span class="cx"> const StyleProperties& style = fontFaceRule.properties();
</span><span class="cx"> RefPtr<CSSValue> fontFamily = style.getPropertyCSSValue(CSSPropertyFontFamily);
</span><span class="cx"> RefPtr<CSSValue> fontStyle = style.getPropertyCSSValue(CSSPropertyFontStyle);
</span><span class="lines">@@ -255,8 +234,6 @@
</span><span class="cx">
</span><span class="cx"> FontRanges CSSFontSelector::fontRangesForFamily(const FontDescription& fontDescription, const AtomicString& familyName)
</span><span class="cx"> {
</span><del>- ASSERT(!m_buildIsUnderway); // If this ASSERT() fires, it usually means you forgot a document.updateStyleIfNeeded() somewhere.
-
</del><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">@@ -290,6 +267,7 @@
</span><span class="cx">
</span><span class="cx"> m_document = nullptr;
</span><span class="cx">
</span><ins>+ // FIXME: This object should outlive the Document.
</ins><span class="cx"> m_cssFontFaceSet->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 (197455 => 197456)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontSelector.h        2016-03-02 18:31:22 UTC (rev 197455)
+++ trunk/Source/WebCore/css/CSSFontSelector.h        2016-03-02 18:54:03 UTC (rev 197456)
</span><span class="lines">@@ -65,8 +65,6 @@
</span><span class="cx"> virtual RefPtr<Font> fallbackFontAt(const FontDescription&, size_t) override;
</span><span class="cx">
</span><span class="cx"> void clearDocument();
</span><del>- void buildStarted();
- void buildCompleted();
</del><span class="cx">
</span><span class="cx"> void addFontFaceRule(StyleRuleFontFace&, bool isInitiatingElementInUserAgentShadowTree);
</span><span class="cx">
</span><span class="lines">@@ -93,12 +91,6 @@
</span><span class="cx">
</span><span class="cx"> void beginLoadTimerFired();
</span><span class="cx">
</span><del>- struct PendingFontFaceRule {
- StyleRuleFontFace& styleRuleFontFace;
- bool isInitiatingElementInUserAgentShadowTree;
- };
- Vector<PendingFontFaceRule> m_stagingArea;
-
</del><span class="cx"> Document* m_document;
</span><span class="cx"> RefPtr<FontFaceSet> m_fontFaceSet;
</span><span class="cx"> Ref<CSSFontFaceSet> m_cssFontFaceSet;
</span><span class="lines">@@ -110,7 +102,6 @@
</span><span class="cx"> unsigned m_uniqueId;
</span><span class="cx"> unsigned m_version;
</span><span class="cx"> bool m_creatingFont { false };
</span><del>- bool m_buildIsUnderway { false };
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSStyleSheetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSStyleSheet.cpp (197455 => 197456)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSStyleSheet.cpp        2016-03-02 18:31:22 UTC (rev 197455)
+++ trunk/Source/WebCore/css/CSSStyleSheet.cpp        2016-03-02 18:54:03 UTC (rev 197456)
</span><span class="lines">@@ -423,7 +423,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSRule* rule)
</span><del>- : m_styleSheet(rule ? rule->parentStyleSheet() : nullptr)
</del><ins>+ : m_styleSheet(rule ? rule->parentStyleSheet() : 0)
</ins><span class="cx"> , m_mutationType(OtherMutation)
</span><span class="cx"> , m_contentsWereClonedForMutation(ContentsWereNotClonedForMutation)
</span><span class="cx"> , m_insertedKeyframesRule(nullptr)
</span></span></pre></div>
<a id="trunkSourceWebCorecssSourceSizeListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SourceSizeList.cpp (197455 => 197456)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SourceSizeList.cpp        2016-03-02 18:31:22 UTC (rev 197455)
+++ trunk/Source/WebCore/css/SourceSizeList.cpp        2016-03-02 18:54:03 UTC (rev 197456)
</span><span class="lines">@@ -70,8 +70,6 @@
</span><span class="cx"> {
</span><span class="cx"> if (!view)
</span><span class="cx"> return 0;
</span><del>- if (!sizesAttribute.empty())
- view->document().updateStyleIfNeeded();
</del><span class="cx"> RenderStyle& style = view->style();
</span><span class="cx"> for (auto& sourceSize : CSSParser(CSSStrictMode).parseSizesAttribute(sizesAttribute)) {
</span><span class="cx"> if (match(WTFMove(sourceSize.expression), style, frame))
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (197455 => 197456)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2016-03-02 18:31:22 UTC (rev 197455)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2016-03-02 18:54:03 UTC (rev 197456)
</span><span class="lines">@@ -288,9 +288,6 @@
</span><span class="cx"> void StyleResolver::appendAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet>>& styleSheets)
</span><span class="cx"> {
</span><span class="cx"> m_ruleSets.appendAuthorStyleSheets(styleSheets, m_medium.get(), m_inspectorCSSOMWrappers, this);
</span><del>-
- document().fontSelector().buildCompleted();
-
</del><span class="cx"> if (auto renderView = document().renderView())
</span><span class="cx"> renderView->style().fontCascade().update(&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 (197455 => 197456)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-03-02 18:31:22 UTC (rev 197455)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-03-02 18:54:03 UTC (rev 197456)
</span><span class="lines">@@ -539,7 +539,6 @@
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><span class="cx"> , m_templateDocumentHost(nullptr)
</span><span class="cx"> #endif
</span><del>- , m_fontSelector(CSSFontSelector::create(*this))
</del><span class="cx"> #if ENABLE(WEB_REPLAY)
</span><span class="cx"> , m_inputCursor(EmptyInputCursor::create())
</span><span class="cx"> #endif
</span><span class="lines">@@ -574,8 +573,6 @@
</span><span class="cx"> initSecurityContext();
</span><span class="cx"> initDNSPrefetch();
</span><span class="cx">
</span><del>- m_fontSelector->registerForInvalidationCallbacks(*this);
-
</del><span class="cx"> for (auto& nodeListAndCollectionCount : m_nodeListAndCollectionCounts)
</span><span class="cx"> nodeListAndCollectionCount = 0;
</span><span class="cx"> }
</span><span class="lines">@@ -652,8 +649,6 @@
</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><del>- m_fontSelector->clearDocument();
- m_fontSelector->unregisterForInvalidationCallbacks(*this);
</del><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">@@ -2194,12 +2189,26 @@
</span><span class="cx"> scheduleForcedStyleRecalc();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+CSSFontSelector& Document::fontSelector()
+{
+ if (!m_fontSelector) {
+ m_fontSelector = CSSFontSelector::create(*this);
+ m_fontSelector->registerForInvalidationCallbacks(*this);
+ }
+ return *m_fontSelector;
+}
+
</ins><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>- m_fontSelector->buildStarted();
</del><ins>+ // FIXME: It would be better if the FontSelector could survive this operation.
+ if (m_fontSelector) {
+ m_fontSelector->clearDocument();
+ m_fontSelector->unregisterForInvalidationCallbacks(*this);
+ m_fontSelector = nullptr;
+ }
</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 (197455 => 197456)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2016-03-02 18:31:22 UTC (rev 197455)
+++ trunk/Source/WebCore/dom/Document.h        2016-03-02 18:54:03 UTC (rev 197456)
</span><span class="lines">@@ -503,7 +503,7 @@
</span><span class="cx"> }
</span><span class="cx"> StyleResolver& userAgentShadowTreeStyleResolver();
</span><span class="cx">
</span><del>- CSSFontSelector& fontSelector() { return m_fontSelector; }
</del><ins>+ CSSFontSelector& fontSelector();
</ins><span class="cx">
</span><span class="cx"> void notifyRemovePendingSheetIfNeeded();
</span><span class="cx">
</span><span class="lines">@@ -1742,7 +1742,7 @@
</span><span class="cx"> std::unique_ptr<CustomElementDefinitions> m_customElementDefinitions;
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- Ref<CSSFontSelector> m_fontSelector;
</del><ins>+ RefPtr<CSSFontSelector> m_fontSelector;
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(WEB_REPLAY)
</span><span class="cx"> RefPtr<JSC::InputCursor> m_inputCursor;
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleTreeResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (197455 => 197456)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleTreeResolver.cpp        2016-03-02 18:31:22 UTC (rev 197455)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp        2016-03-02 18:54:03 UTC (rev 197456)
</span><span class="lines">@@ -963,10 +963,8 @@
</span><span class="cx"> auto& renderView = *m_document.renderView();
</span><span class="cx">
</span><span class="cx"> Element* documentElement = m_document.documentElement();
</span><del>- if (!documentElement) {
- m_document.ensureStyleResolver();
</del><ins>+ if (!documentElement)
</ins><span class="cx"> return;
</span><del>- }
</del><span class="cx"> if (change != Force && !documentElement->childNeedsStyleRecalc() && !documentElement->needsStyleRecalc())
</span><span class="cx"> return;
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>