Diff
Modified: trunk/Source/WebCore/ChangeLog (197455 => 197456)
--- 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)
@@ -1,3 +1,21 @@
+2016-03-02 Commit Queue <[email protected]>
+
+ 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
+
2016-03-02 Zalan Bujtas <[email protected]>
Subpixel layout: Enable vertical/horizontal subpixel spacing for tables.
Modified: trunk/Source/WebCore/css/CSSFontFaceSet.cpp (197455 => 197456)
--- 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)
@@ -242,8 +242,6 @@
m_facesLookupTable.clear();
m_locallyInstalledFacesLookupTable.clear();
m_cache.clear();
- m_facesPartitionIndex = 0;
- m_status = Status::Loaded;
}
CSSFontFace& CSSFontFaceSet::operator[](size_t i)
Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (197455 => 197456)
--- 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)
@@ -70,6 +70,10 @@
, m_uniqueId(++fontSelectorId)
, m_version(0)
{
+ // 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.
+
ASSERT(m_document);
FontCache::singleton().addClient(*this);
m_cssFontFaceSet->addClient(*this);
@@ -97,33 +101,8 @@
return !m_cssFontFaceSet->faceCount();
}
-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();
-}
-
void CSSFontSelector::addFontFaceRule(StyleRuleFontFace& fontFaceRule, bool isInitiatingElementInUserAgentShadowTree)
{
- if (m_buildIsUnderway) {
- m_stagingArea.append({fontFaceRule, isInitiatingElementInUserAgentShadowTree});
- return;
- }
-
const StyleProperties& style = fontFaceRule.properties();
RefPtr<CSSValue> fontFamily = style.getPropertyCSSValue(CSSPropertyFontFamily);
RefPtr<CSSValue> fontStyle = style.getPropertyCSSValue(CSSPropertyFontStyle);
@@ -255,8 +234,6 @@
FontRanges CSSFontSelector::fontRangesForFamily(const FontDescription& fontDescription, const AtomicString& familyName)
{
- ASSERT(!m_buildIsUnderway); // If this ASSERT() fires, it usually means you forgot a document.updateStyleIfNeeded() somewhere.
-
// FIXME: The spec (and Firefox) says user specified generic families (sans-serif etc.) should be resolved before the @font-face lookup too.
bool resolveGenericFamilyFirst = familyName == standardFamily;
@@ -290,6 +267,7 @@
m_document = nullptr;
+ // FIXME: This object should outlive the Document.
m_cssFontFaceSet->clear();
m_clients.clear();
}
Modified: trunk/Source/WebCore/css/CSSFontSelector.h (197455 => 197456)
--- 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)
@@ -65,8 +65,6 @@
virtual RefPtr<Font> fallbackFontAt(const FontDescription&, size_t) override;
void clearDocument();
- void buildStarted();
- void buildCompleted();
void addFontFaceRule(StyleRuleFontFace&, bool isInitiatingElementInUserAgentShadowTree);
@@ -93,12 +91,6 @@
void beginLoadTimerFired();
- struct PendingFontFaceRule {
- StyleRuleFontFace& styleRuleFontFace;
- bool isInitiatingElementInUserAgentShadowTree;
- };
- Vector<PendingFontFaceRule> m_stagingArea;
-
Document* m_document;
RefPtr<FontFaceSet> m_fontFaceSet;
Ref<CSSFontFaceSet> m_cssFontFaceSet;
@@ -110,7 +102,6 @@
unsigned m_uniqueId;
unsigned m_version;
bool m_creatingFont { false };
- bool m_buildIsUnderway { false };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/css/CSSStyleSheet.cpp (197455 => 197456)
--- 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)
@@ -423,7 +423,7 @@
}
CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSRule* rule)
- : m_styleSheet(rule ? rule->parentStyleSheet() : nullptr)
+ : m_styleSheet(rule ? rule->parentStyleSheet() : 0)
, m_mutationType(OtherMutation)
, m_contentsWereClonedForMutation(ContentsWereNotClonedForMutation)
, m_insertedKeyframesRule(nullptr)
Modified: trunk/Source/WebCore/css/SourceSizeList.cpp (197455 => 197456)
--- 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)
@@ -70,8 +70,6 @@
{
if (!view)
return 0;
- if (!sizesAttribute.empty())
- view->document().updateStyleIfNeeded();
RenderStyle& style = view->style();
for (auto& sourceSize : CSSParser(CSSStrictMode).parseSizesAttribute(sizesAttribute)) {
if (match(WTFMove(sourceSize._expression_), style, frame))
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (197455 => 197456)
--- 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)
@@ -288,9 +288,6 @@
void StyleResolver::appendAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet>>& styleSheets)
{
m_ruleSets.appendAuthorStyleSheets(styleSheets, m_medium.get(), m_inspectorCSSOMWrappers, this);
-
- document().fontSelector().buildCompleted();
-
if (auto renderView = document().renderView())
renderView->style().fontCascade().update(&document().fontSelector());
Modified: trunk/Source/WebCore/dom/Document.cpp (197455 => 197456)
--- 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)
@@ -539,7 +539,6 @@
#if ENABLE(TEMPLATE_ELEMENT)
, m_templateDocumentHost(nullptr)
#endif
- , m_fontSelector(CSSFontSelector::create(*this))
#if ENABLE(WEB_REPLAY)
, m_inputCursor(EmptyInputCursor::create())
#endif
@@ -574,8 +573,6 @@
initSecurityContext();
initDNSPrefetch();
- m_fontSelector->registerForInvalidationCallbacks(*this);
-
for (auto& nodeListAndCollectionCount : m_nodeListAndCollectionCounts)
nodeListAndCollectionCount = 0;
}
@@ -652,8 +649,6 @@
extensionStyleSheets().detachFromDocument();
clearStyleResolver(); // We need to destroy CSSFontSelector before destroying m_cachedResourceLoader.
- m_fontSelector->clearDocument();
- m_fontSelector->unregisterForInvalidationCallbacks(*this);
// It's possible for multiple Documents to end up referencing the same CachedResourceLoader (e.g., SVGImages
// load the initial empty document and the SVGDocument with the same DocumentLoader).
@@ -2194,12 +2189,26 @@
scheduleForcedStyleRecalc();
}
+CSSFontSelector& Document::fontSelector()
+{
+ if (!m_fontSelector) {
+ m_fontSelector = CSSFontSelector::create(*this);
+ m_fontSelector->registerForInvalidationCallbacks(*this);
+ }
+ return *m_fontSelector;
+}
+
void Document::clearStyleResolver()
{
m_styleResolver = nullptr;
m_userAgentShadowTreeStyleResolver = nullptr;
- m_fontSelector->buildStarted();
+ // 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;
+ }
}
void Document::createRenderTree()
Modified: trunk/Source/WebCore/dom/Document.h (197455 => 197456)
--- 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)
@@ -503,7 +503,7 @@
}
StyleResolver& userAgentShadowTreeStyleResolver();
- CSSFontSelector& fontSelector() { return m_fontSelector; }
+ CSSFontSelector& fontSelector();
void notifyRemovePendingSheetIfNeeded();
@@ -1742,7 +1742,7 @@
std::unique_ptr<CustomElementDefinitions> m_customElementDefinitions;
#endif
- Ref<CSSFontSelector> m_fontSelector;
+ RefPtr<CSSFontSelector> m_fontSelector;
#if ENABLE(WEB_REPLAY)
RefPtr<JSC::InputCursor> m_inputCursor;
Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (197455 => 197456)
--- 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)
@@ -963,10 +963,8 @@
auto& renderView = *m_document.renderView();
Element* documentElement = m_document.documentElement();
- if (!documentElement) {
- m_document.ensureStyleResolver();
+ if (!documentElement)
return;
- }
if (change != Force && !documentElement->childNeedsStyleRecalc() && !documentElement->needsStyleRecalc())
return;