bug 665360 - hold reference to font family from loader. r=jdaggett a=legneato
authorJonathan Kew <jfkthame@gmail.com>
Tue, 23 Aug 2011 09:39:34 +0100
changeset 35187 f5dd7005daa85ccf07b8dce3fbe7cc55483ecce2
parent 35186 23d85432311d9e88d09f564aedc47af22fe198c2
child 35188 c7190956f9708551ac21acebf6c08a01a2a9c500
push id1974
push userjkew@mozilla.com
push dateSat, 10 Sep 2011 14:16:46 +0000
reviewersjdaggett, legneato
bugs665360
milestone1.9.2.23pre
bug 665360 - hold reference to font family from loader. r=jdaggett a=legneato
gfx/thebes/public/gfxFont.h
layout/style/nsFontFaceLoader.cpp
layout/style/nsFontFaceLoader.h
--- a/gfx/thebes/public/gfxFont.h
+++ b/gfx/thebes/public/gfxFont.h
@@ -201,16 +201,18 @@ public:
         return TestCharacterMap(ch);
     }
 
     virtual PRBool TestCharacterMap(PRUint32 aCh);
     virtual nsresult ReadCMAP();
 
     const nsString& FamilyName();
 
+    gfxFontFamily    *Family() { return mFamily; }
+
     nsString         mName;
 
     PRPackedBool     mItalic      : 1;
     PRPackedBool     mFixedPitch  : 1;
     PRPackedBool     mIsProxy     : 1;
     PRPackedBool     mIsValid     : 1;
     PRPackedBool     mIsBadUnderlineFont : 1;
     PRPackedBool     mIsUserFont  : 1;
--- a/layout/style/nsFontFaceLoader.cpp
+++ b/layout/style/nsFontFaceLoader.cpp
@@ -77,16 +77,17 @@ static PRLogModuleInfo *gFontDownloaderL
 #define LOG_ENABLED() PR_LOG_TEST(gFontDownloaderLog, PR_LOG_DEBUG)
 
 
 nsFontFaceLoader::nsFontFaceLoader(gfxFontEntry *aFontToLoad, nsIURI *aFontURI,
                                    nsUserFontSet *aFontSet, nsIChannel *aChannel)
   : mFontEntry(aFontToLoad), mFontURI(aFontURI), mFontSet(aFontSet),
     mChannel(aChannel)
 {
+  mFontFamily = aFontToLoad->Family();
 }
 
 nsFontFaceLoader::~nsFontFaceLoader()
 {
   if (mFontSet) {
     mFontSet->RemoveLoader(this);
   }
 }
--- a/layout/style/nsFontFaceLoader.h
+++ b/layout/style/nsFontFaceLoader.h
@@ -108,14 +108,15 @@ public:
   void DropChannel() { mChannel = nsnull; }
 
   static nsresult CheckLoadAllowed(nsIPrincipal* aSourcePrincipal,
                                    nsIURI* aTargetURI,
                                    nsISupports* aContext);
 
 private:
   nsRefPtr<gfxFontEntry>  mFontEntry;
+  nsRefPtr<gfxFontFamily> mFontFamily;
   nsCOMPtr<nsIURI>        mFontURI;
   nsRefPtr<nsUserFontSet> mFontSet;
   nsCOMPtr<nsIChannel>    mChannel;
 };
 
 #endif /* !defined(nsFontFaceLoader_h_) */