Index: Source/WebCore/dom/Document.cpp |
=================================================================== |
--- Source/WebCore/dom/Document.cpp (revision 95343) |
+++ Source/WebCore/dom/Document.cpp (working copy) |
@@ -546,6 +546,8 @@ |
(*m_pageGroupUserSheets)[i]->clearOwnerNode(); |
} |
+ deleteRetiredCustomFonts(); |
+ |
m_weakReference->clear(); |
if (m_mediaQueryMatcher) |
@@ -1528,6 +1530,9 @@ |
if (change >= Inherit || n->childNeedsStyleRecalc() || n->needsStyleRecalc()) |
n->recalcStyle(change); |
+ // Now that all RenderStyles that pointed to retired fonts have been updated, the fonts can safely be deleted. |
+ deleteRetiredCustomFonts(); |
+ |
#if USE(ACCELERATED_COMPOSITING) |
if (view()) { |
bool layoutPending = view()->layoutPending() || renderer()->needsLayout(); |
@@ -1664,6 +1669,20 @@ |
return style.release(); |
} |
+void Document::retireCustomFont(FontData* fontData) |
+{ |
+ m_retiredCustomFonts.append(adoptPtr(fontData)); |
+} |
+ |
+void Document::deleteRetiredCustomFonts() |
+{ |
+ size_t size = m_retiredCustomFonts.size(); |
+ for (size_t i = 0; i < size; ++i) |
+ GlyphPageTreeNode::pruneTreeCustomFontData(m_retiredCustomFonts[i].get()); |
+ |
+ m_retiredCustomFonts.clear(); |
+} |
+ |
bool Document::isPageBoxVisible(int pageIndex) |
{ |
RefPtr<RenderStyle> style = styleForPage(pageIndex); |