Title: [104200] branches/safari-534.54-branch

Diff

Modified: branches/safari-534.54-branch/LayoutTests/ChangeLog (104199 => 104200)


--- branches/safari-534.54-branch/LayoutTests/ChangeLog	2012-01-05 20:53:18 UTC (rev 104199)
+++ branches/safari-534.54-branch/LayoutTests/ChangeLog	2012-01-05 20:57:19 UTC (rev 104200)
@@ -1,3 +1,18 @@
+2011-1-5  Lucas Forschler  <[email protected]>
+
+    Merge 97402
+
+    2011-10-12  Abhishek Arya  <[email protected]>
+
+            Register custom fonts at their creation time,
+            rather than at retirement time.   
+            https://bugs.webkit.org/show_bug.cgi?id=68929
+
+            Reviewed by Dan Bernstein.
+
+            * fast/text/custom-font-data-crash2-expected.txt: Added.
+            * fast/text/custom-font-data-crash2.html: Added.
+
 2011-1-4  Lucas Forschler  <[email protected]>
 
     Merge 97353

Modified: branches/safari-534.54-branch/Source/WebCore/ChangeLog (104199 => 104200)


--- branches/safari-534.54-branch/Source/WebCore/ChangeLog	2012-01-05 20:53:18 UTC (rev 104199)
+++ branches/safari-534.54-branch/Source/WebCore/ChangeLog	2012-01-05 20:57:19 UTC (rev 104200)
@@ -1,3 +1,45 @@
+2011-1-5  Lucas Forschler  <[email protected]>
+
+    Merge 97402
+
+    2011-10-12  Abhishek Arya  <[email protected]>
+
+            Register custom fonts at their creation time,  
+            rather than at retirement time.
+            https://bugs.webkit.org/show_bug.cgi?id=68929
+
+            Reviewed by Dan Bernstein.
+
+            Test: fast/text/custom-font-data-crash2.html
+
+            * css/CSSFontFace.cpp:
+            * css/CSSFontFace.h: remove function added in r94508,
+            which is no longer needed. We now register custom fonts
+            at creation time.
+            * css/CSSFontFaceSource.cpp:
+            (WebCore::CSSFontFaceSource::pruneTable): no longer need
+            to delete/retire font data here, it will be handled in ~Document.
+            (WebCore::CSSFontFaceSource::getFontData): register custom
+            font to document's m_customFonts.
+            * css/CSSFontSelector.cpp:
+            * css/CSSFontSelector.h: remove function added in r94508,
+            which is no longer needed. We now register custom fonts
+            at creation time.
+            * css/CSSSegmentedFontFace.cpp:
+            (WebCore::CSSSegmentedFontFace::pruneTable): no longer need
+            to delete/retire font data here, it will be handled in ~Document.
+            (WebCore::CSSSegmentedFontFace::getFontData): register custom
+            font to document's m_customFonts.
+            * dom/Document.cpp: Change function names to registerCustomFont
+            , deleteCustomFonts and local to m_customFont.
+            (WebCore::Document::~Document):
+            (WebCore::Document::recalcStyle): yanking out the comment. We
+            no longer keep retired custom fonts. We clear all custom fonts
+            on Document destruction.
+            (WebCore::Document::registerCustomFont): 
+            (WebCore::Document::deleteCustomFonts):
+            * dom/Document.h:
+
 2011-1-4  Lucas Forschler  <[email protected]>
 
     Merge 97353

Modified: branches/safari-534.54-branch/Source/WebCore/css/CSSFontFace.cpp (104199 => 104200)


--- branches/safari-534.54-branch/Source/WebCore/css/CSSFontFace.cpp	2012-01-05 20:53:18 UTC (rev 104199)
+++ branches/safari-534.54-branch/Source/WebCore/css/CSSFontFace.cpp	2012-01-05 20:57:19 UTC (rev 104200)
@@ -118,19 +118,6 @@
     return 0;
 }
 
-void CSSFontFace::retireCustomFont(SimpleFontData* fontData)
-{
-    if (m_segmentedFontFaces.isEmpty()) {
-        GlyphPageTreeNode::pruneTreeCustomFontData(fontData);
-        delete fontData;
-        return;
-    }
-
-    // Use one of the CSSSegmentedFontFaces' font selector. They all have
-    // the same font selector.
-    (*m_segmentedFontFaces.begin())->fontSelector()->retireCustomFont(fontData);
-}
-
 #if ENABLE(SVG_FONTS)
 bool CSSFontFace::hasSVGFontFaceSource() const
 {

Modified: branches/safari-534.54-branch/Source/WebCore/css/CSSFontFace.h (104199 => 104200)


--- branches/safari-534.54-branch/Source/WebCore/css/CSSFontFace.h	2012-01-05 20:53:18 UTC (rev 104199)
+++ branches/safari-534.54-branch/Source/WebCore/css/CSSFontFace.h	2012-01-05 20:57:19 UTC (rev 104200)
@@ -63,7 +63,6 @@
     void addSource(CSSFontFaceSource*);
 
     void fontLoaded(CSSFontFaceSource*);
-    void retireCustomFont(SimpleFontData*);
 
     SimpleFontData* getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic);
 

Modified: branches/safari-534.54-branch/Source/WebCore/css/CSSFontFaceSource.cpp (104199 => 104200)


--- branches/safari-534.54-branch/Source/WebCore/css/CSSFontFaceSource.cpp	2012-01-05 20:53:18 UTC (rev 104199)
+++ branches/safari-534.54-branch/Source/WebCore/css/CSSFontFaceSource.cpp	2012-01-05 20:57:19 UTC (rev 104200)
@@ -70,10 +70,6 @@
     if (m_fontDataTable.isEmpty())
         return;
 
-    HashMap<unsigned, SimpleFontData*>::iterator end = m_fontDataTable.end();
-    for (HashMap<unsigned, SimpleFontData*>::iterator it = m_fontDataTable.begin(); it != end; ++it)
-        m_face->retireCustomFont(it->second);
-
     m_fontDataTable.clear();
 }
 
@@ -188,6 +184,9 @@
 
     SimpleFontData* fontDataRawPtr = fontData.leakPtr();
     m_fontDataTable.set(hashKey, fontDataRawPtr);
+    ASSERT(fontSelector->document());
+    if (Document* doc = fontSelector->document())
+        doc->registerCustomFont(fontDataRawPtr);
 
     return fontDataRawPtr;
 }

Modified: branches/safari-534.54-branch/Source/WebCore/css/CSSFontSelector.cpp (104199 => 104200)


--- branches/safari-534.54-branch/Source/WebCore/css/CSSFontSelector.cpp	2012-01-05 20:53:18 UTC (rev 104199)
+++ branches/safari-534.54-branch/Source/WebCore/css/CSSFontSelector.cpp	2012-01-05 20:57:19 UTC (rev 104200)
@@ -378,16 +378,6 @@
     dispatchInvalidationCallbacks();
 }
 
-void CSSFontSelector::retireCustomFont(FontData* fontData)
-{
-    if (m_document)
-        m_document->retireCustomFont(fontData);
-    else {
-        GlyphPageTreeNode::pruneTreeCustomFontData(fontData);
-        delete fontData;
-    }
-}
-
 static FontData* fontDataForGenericFamily(Document* document, const FontDescription& fontDescription, const AtomicString& familyName)
 {
     if (!document || !document->frame())

Modified: branches/safari-534.54-branch/Source/WebCore/css/CSSFontSelector.h (104199 => 104200)


--- branches/safari-534.54-branch/Source/WebCore/css/CSSFontSelector.h	2012-01-05 20:53:18 UTC (rev 104199)
+++ branches/safari-534.54-branch/Source/WebCore/css/CSSFontSelector.h	2012-01-05 20:57:19 UTC (rev 104200)
@@ -59,14 +59,14 @@
     void fontLoaded();
     virtual void fontCacheInvalidated();
 
-    void retireCustomFont(FontData*);
-
     bool isEmpty() const;
 
     CachedResourceLoader* cachedResourceLoader() const;
 
     virtual void registerForInvalidationCallbacks(FontSelectorClient*);
     virtual void unregisterForInvalidationCallbacks(FontSelectorClient*);
+    
+    Document* document() const { return m_document; }
 
 private:
     CSSFontSelector(Document*);

Modified: branches/safari-534.54-branch/Source/WebCore/css/CSSSegmentedFontFace.cpp (104199 => 104200)


--- branches/safari-534.54-branch/Source/WebCore/css/CSSSegmentedFontFace.cpp	2012-01-05 20:53:18 UTC (rev 104199)
+++ branches/safari-534.54-branch/Source/WebCore/css/CSSSegmentedFontFace.cpp	2012-01-05 20:57:19 UTC (rev 104200)
@@ -28,6 +28,7 @@
 
 #include "CSSFontFace.h"
 #include "CSSFontSelector.h"
+#include "Document.h"
 #include "FontDescription.h"
 #include "SegmentedFontData.h"
 #include "SimpleFontData.h"
@@ -53,10 +54,6 @@
     if (m_fontDataTable.isEmpty())
         return;
 
-    HashMap<unsigned, SegmentedFontData*>::iterator end = m_fontDataTable.end();
-    for (HashMap<unsigned, SegmentedFontData*>::iterator it = m_fontDataTable.begin(); it != end; ++it)
-        m_fontSelector->retireCustomFont(it->second);
-
     m_fontDataTable.clear();
 }
 
@@ -116,9 +113,12 @@
             }
         }
     }
-    if (fontData->numRanges())
+    if (fontData->numRanges()) {
         m_fontDataTable.set(hashKey, fontData);
-    else {
+        ASSERT(m_fontSelector->document());
+        if (Document* doc = m_fontSelector->document())
+            doc->registerCustomFont(fontData);
+    } else {
         delete fontData;
         fontData = 0;
     }

Modified: branches/safari-534.54-branch/Source/WebCore/dom/Document.cpp (104199 => 104200)


--- branches/safari-534.54-branch/Source/WebCore/dom/Document.cpp	2012-01-05 20:53:18 UTC (rev 104199)
+++ branches/safari-534.54-branch/Source/WebCore/dom/Document.cpp	2012-01-05 20:57:19 UTC (rev 104200)
@@ -544,7 +544,7 @@
             (*m_pageGroupUserSheets)[i]->clearOwnerNode();
     }
 
-    deleteRetiredCustomFonts();
+    deleteCustomFonts();
 
     m_weakReference->clear();
 
@@ -1528,15 +1528,6 @@
         if (change >= Inherit || n->childNeedsStyleRecalc() || n->needsStyleRecalc())
             n->recalcStyle(change);
 
-    // FIXME: Disabling the deletion of retired custom font data until
-    // we fix all the stale style bugs (68804, 68624, etc). These bugs
-    // indicate problems where some styles were not updated in recalcStyle,
-    // thereby retaining stale copy of font data. To prevent that, we
-    // disable this code for now and only delete retired custom font data
-    // in Document destructor.
-    // 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();
@@ -1673,18 +1664,18 @@
     return style.release();
 }
 
-void Document::retireCustomFont(FontData* fontData)
+void Document::registerCustomFont(FontData* fontData)
 {
-    m_retiredCustomFonts.append(adoptPtr(fontData));
+    m_customFonts.append(adoptPtr(fontData));
 }
 
-void Document::deleteRetiredCustomFonts()
+void Document::deleteCustomFonts()
 {
-    size_t size = m_retiredCustomFonts.size();
+    size_t size = m_customFonts.size();
     for (size_t i = 0; i < size; ++i)
-        GlyphPageTreeNode::pruneTreeCustomFontData(m_retiredCustomFonts[i].get());
+        GlyphPageTreeNode::pruneTreeCustomFontData(m_customFonts[i].get());
 
-    m_retiredCustomFonts.clear();
+    m_customFonts.clear();
 }
 
 bool Document::isPageBoxVisible(int pageIndex)

Modified: branches/safari-534.54-branch/Source/WebCore/dom/Document.h (104199 => 104200)


--- branches/safari-534.54-branch/Source/WebCore/dom/Document.h	2012-01-05 20:53:18 UTC (rev 104199)
+++ branches/safari-534.54-branch/Source/WebCore/dom/Document.h	2012-01-05 20:57:19 UTC (rev 104200)
@@ -544,7 +544,7 @@
     PassRefPtr<RenderStyle> styleForElementIgnoringPendingStylesheets(Element*);
     PassRefPtr<RenderStyle> styleForPage(int pageIndex);
 
-    void retireCustomFont(FontData*);
+    void registerCustomFont(FontData*);
 
     // Returns true if page box (margin boxes and page borders) is visible.
     bool isPageBoxVisible(int pageIndex);
@@ -1162,7 +1162,7 @@
 
     void createStyleSelector();
 
-    void deleteRetiredCustomFonts();
+    void deleteCustomFonts();
 
     PassRefPtr<NodeList> handleZeroPadding(const HitTestRequest&, HitTestResult&) const;
 
@@ -1177,7 +1177,7 @@
     OwnPtr<CSSStyleSelector> m_styleSelector;
     bool m_didCalculateStyleSelector;
     bool m_hasDirtyStyleSelector;
-    Vector<OwnPtr<FontData> > m_retiredCustomFonts;
+    Vector<OwnPtr<FontData> > m_customFonts;
 
     mutable RefPtr<CSSPrimitiveValueCache> m_cssPrimitiveValueCache;
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to