Bug 1028497 - Part 14: Rename some methods to talk about UserFontEntry instead of FontFace. r=jdaggett
authorCameron McCormack <cam@mcc.id.au>
Thu, 02 Oct 2014 12:32:07 +1000
changeset 231541 d2a6234767db1df6c589655152d957f6a6d136a1
parent 231540 d0160a187c9b619facb261ad323628f827252b83
child 231542 1219081be2338c8d3173f309301b7eb413830eb7
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdaggett
bugs1028497
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1028497 - Part 14: Rename some methods to talk about UserFontEntry instead of FontFace. r=jdaggett How that we have a class named "FontFace", it's a bit confusing for some of the gfxUserFontSet methods to have "FontFace" in their names, so I'm renaming them to mention "UserFontEntry" instead.
gfx/thebes/gfxUserFontSet.cpp
gfx/thebes/gfxUserFontSet.h
layout/style/FontFaceSet.cpp
layout/style/FontFaceSet.h
--- a/gfx/thebes/gfxUserFontSet.cpp
+++ b/gfx/thebes/gfxUserFontSet.cpp
@@ -668,17 +668,17 @@ gfxUserFontSet::~gfxUserFontSet()
 {
     gfxPlatformFontList* fp = gfxPlatformFontList::PlatformFontList();
     if (fp) {
         fp->RemoveUserFontSet(this);
     }
 }
 
 already_AddRefed<gfxUserFontEntry>
-gfxUserFontSet::FindOrCreateFontFace(
+gfxUserFontSet::FindOrCreateUserFontEntry(
                                const nsAString& aFamilyName,
                                const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                                uint32_t aWeight,
                                int32_t aStretch,
                                uint32_t aItalicStyle,
                                const nsTArray<gfxFontFeature>& aFeatureSettings,
                                uint32_t aLanguageOverride,
                                gfxSparseBitSet* aUnicodeRanges)
@@ -695,19 +695,19 @@ gfxUserFontSet::FindOrCreateFontFace(
     if (family) {
         entry = FindExistingUserFontEntry(family, aFontFaceSrcList, aWeight,
                                           aStretch, aItalicStyle,
                                           aFeatureSettings, aLanguageOverride,
                                           aUnicodeRanges);
     }
 
     if (!entry) {
-      entry = CreateFontFace(aFontFaceSrcList, aWeight, aStretch,
-                             aItalicStyle, aFeatureSettings, aLanguageOverride,
-                             aUnicodeRanges);
+      entry = CreateUserFontEntry(aFontFaceSrcList, aWeight, aStretch,
+                                  aItalicStyle, aFeatureSettings,
+                                  aLanguageOverride, aUnicodeRanges);
       entry->mFamilyName = aFamilyName;
 
 #ifdef PR_LOGGING
       if (LOG_ENABLED()) {
           LOG(("userfonts (%p) created \"%s\" (%p) with style: %s weight: %d "
                "stretch: %d",
                this, NS_ConvertUTF16toUTF8(aFamilyName).get(), entry.get(),
                (aItalicStyle & NS_FONT_STYLE_ITALIC ? "italic" :
@@ -716,17 +716,18 @@ gfxUserFontSet::FindOrCreateFontFace(
       }
 #endif
     }
 
     return entry.forget();
 }
 
 already_AddRefed<gfxUserFontEntry>
-gfxUserFontSet::CreateFontFace(const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
+gfxUserFontSet::CreateUserFontEntry(
+                               const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                                uint32_t aWeight,
                                int32_t aStretch,
                                uint32_t aItalicStyle,
                                const nsTArray<gfxFontFeature>& aFeatureSettings,
                                uint32_t aLanguageOverride,
                                gfxSparseBitSet* aUnicodeRanges)
 {
 
@@ -769,18 +770,18 @@ gfxUserFontSet::FindExistingUserFontEntr
 
         return existingUserFontEntry;
     }
 
     return nullptr;
 }
 
 void
-gfxUserFontSet::AddFontFace(const nsAString& aFamilyName,
-                            gfxUserFontEntry* aUserFontEntry)
+gfxUserFontSet::AddUserFontEntry(const nsAString& aFamilyName,
+                                 gfxUserFontEntry* aUserFontEntry)
 {
     gfxUserFontFamily* family = GetFamily(aFamilyName);
     family->AddFontEntry(aUserFontEntry);
 
 #ifdef PR_LOGGING
     if (LOG_ENABLED()) {
         LOG(("userfonts (%p) added \"%s\" (%p)",
              this, NS_ConvertUTF16toUTF8(aFamilyName).get(), aUserFontEntry));
--- a/gfx/thebes/gfxUserFontSet.h
+++ b/gfx/thebes/gfxUserFontSet.h
@@ -149,40 +149,40 @@ public:
 
 
     // creates a font face without adding it to a particular family
     // weight - [100, 900] (multiples of 100)
     // stretch = [NS_FONT_STRETCH_ULTRA_CONDENSED, NS_FONT_STRETCH_ULTRA_EXPANDED]
     // italic style = constants in gfxFontConstants.h, e.g. NS_FONT_STYLE_NORMAL
     // language override = result of calling gfxFontStyle::ParseFontLanguageOverride
     // TODO: support for unicode ranges not yet implemented
-    virtual already_AddRefed<gfxUserFontEntry> CreateFontFace(
+    virtual already_AddRefed<gfxUserFontEntry> CreateUserFontEntry(
                               const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                               uint32_t aWeight,
                               int32_t aStretch,
                               uint32_t aItalicStyle,
                               const nsTArray<gfxFontFeature>& aFeatureSettings,
                               uint32_t aLanguageOverride,
                               gfxSparseBitSet* aUnicodeRanges) = 0;
 
     // creates a font face for the specified family, or returns an existing
     // matching entry on the family if there is one
-    already_AddRefed<gfxUserFontEntry> FindOrCreateFontFace(
+    already_AddRefed<gfxUserFontEntry> FindOrCreateUserFontEntry(
                                const nsAString& aFamilyName,
                                const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                                uint32_t aWeight,
                                int32_t aStretch,
                                uint32_t aItalicStyle,
                                const nsTArray<gfxFontFeature>& aFeatureSettings,
                                uint32_t aLanguageOverride,
                                gfxSparseBitSet* aUnicodeRanges);
 
     // add in a font face for which we have the gfxUserFontEntry already
-    void AddFontFace(const nsAString& aFamilyName,
-                     gfxUserFontEntry* aUserFontEntry);
+    void AddUserFontEntry(const nsAString& aFamilyName,
+                          gfxUserFontEntry* aUserFontEntry);
 
     // Whether there is a face with this family name
     bool HasFamily(const nsAString& aFamilyName) const
     {
         return LookupFamily(aFamilyName) != nullptr;
     }
 
     // Look up and return the gfxUserFontFamily in mFontFamilies with
@@ -438,17 +438,17 @@ protected:
     virtual nsresult LogMessage(gfxUserFontEntry* aUserFontEntry,
                                 const char* aMessage,
                                 uint32_t aFlags = nsIScriptError::errorFlag,
                                 nsresult aStatus = NS_OK) = 0;
 
     // helper method for performing the actual userfont set rebuild
     virtual void DoRebuildUserFontSet() = 0;
 
-    // helper method for FindOrCreateFontFace
+    // helper method for FindOrCreateUserFontEntry
     gfxUserFontEntry* FindExistingUserFontEntry(
                                    gfxUserFontFamily* aFamily,
                                    const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                                    uint32_t aWeight,
                                    int32_t aStretch,
                                    uint32_t aItalicStyle,
                                    const nsTArray<gfxFontFeature>& aFeatureSettings,
                                    uint32_t aLanguageOverride,
--- a/layout/style/FontFaceSet.cpp
+++ b/layout/style/FontFaceSet.cpp
@@ -456,56 +456,57 @@ FontFaceSet::InsertRule(nsCSSFontFaceRul
       if (mUserFontSet->mLocalRulesUsed) {
         aRule->GetDesc(eCSSFontDesc_Src, val);
         unit = val.GetUnit();
         if (unit == eCSSUnit_Array && HasLocalSrc(val.GetArrayValue())) {
           break;
         }
       }
 
-      mUserFontSet->AddFontFace(fontfamily, ruleRec.mUserFontEntry);
+      mUserFontSet->AddUserFontEntry(fontfamily, ruleRec.mUserFontEntry);
       mRules.AppendElement(ruleRec);
       aOldRules.RemoveElementAt(i);
       // note the set has been modified if an old rule was skipped to find
       // this one - something has been dropped, or ordering changed
       if (i > 0) {
         aFontSetModified = true;
       }
       return;
     }
   }
 
   // this is a new rule:
   FontFaceRuleRecord ruleRec;
   ruleRec.mUserFontEntry =
-    FindOrCreateFontFaceFromRule(fontfamily, aRule, aSheetType);
+    FindOrCreateUserFontEntryFromRule(fontfamily, aRule, aSheetType);
 
   if (!ruleRec.mUserFontEntry) {
     return;
   }
 
   ruleRec.mContainer.mRule = aRule;
   ruleRec.mContainer.mSheetType = aSheetType;
 
   // Add the entry to the end of the list.  If an existing userfont entry was
-  // returned by FindOrCreateFontFaceFromRule that was already stored on the
-  // family, gfxUserFontFamily::AddFontEntry(), which AddFontFace calls,
-  // will automatically remove the earlier occurrence of the same userfont entry.
-  mUserFontSet->AddFontFace(fontfamily, ruleRec.mUserFontEntry);
+  // returned by FindOrCreateUserFontEntryFromRule that was already stored on
+  // the family, gfxUserFontFamily::AddFontEntry(), which AddUserFontEntry
+  // calls, will automatically remove the earlier occurrence of the same
+  // userfont entry.
+  mUserFontSet->AddUserFontEntry(fontfamily, ruleRec.mUserFontEntry);
 
   mRules.AppendElement(ruleRec);
 
   // this was a new rule and font entry, so note that the set was modified
   aFontSetModified = true;
 }
 
 already_AddRefed<gfxUserFontEntry>
-FontFaceSet::FindOrCreateFontFaceFromRule(const nsAString& aFamilyName,
-                                          nsCSSFontFaceRule* aRule,
-                                          uint8_t aSheetType)
+FontFaceSet::FindOrCreateUserFontEntryFromRule(const nsAString& aFamilyName,
+                                               nsCSSFontFaceRule* aRule,
+                                               uint8_t aSheetType)
 {
   nsCSSValue val;
   uint32_t unit;
 
   uint32_t weight = NS_STYLE_FONT_WEIGHT_NORMAL;
   int32_t stretch = NS_STYLE_FONT_STRETCH_NORMAL;
   uint32_t italicStyle = NS_STYLE_FONT_STYLE_NORMAL;
   uint32_t languageOverride = NO_FONT_LANGUAGE_OVERRIDE;
@@ -655,20 +656,21 @@ FontFaceSet::FindOrCreateFontFaceFromRul
     NS_ASSERTION(unit == eCSSUnit_Null, "@font-face src has unexpected unit");
   }
 
   if (srcArray.IsEmpty()) {
     return nullptr;
   }
 
   nsRefPtr<gfxUserFontEntry> entry =
-    mUserFontSet->FindOrCreateFontFace(aFamilyName, srcArray, weight, stretch,
-                                       italicStyle, featureSettings,
-                                       languageOverride,
-                                       nullptr /* aUnicodeRanges */);
+    mUserFontSet->FindOrCreateUserFontEntry(aFamilyName, srcArray, weight,
+                                            stretch, italicStyle,
+                                            featureSettings,
+                                            languageOverride,
+                                            nullptr /* aUnicodeRanges */);
   return entry.forget();
 }
 
 nsCSSFontFaceRule*
 FontFaceSet::FindRuleForEntry(gfxFontEntry* aFontEntry)
 {
   NS_ASSERTION(!aFontEntry->mIsUserFontContainer, "only platform font entries");
   for (uint32_t i = 0; i < mRules.Length(); ++i) {
@@ -1055,17 +1057,17 @@ FontFaceSet::UserFontSet::DoRebuildUserF
 {
   if (!mFontFaceSet) {
     return;
   }
   mFontFaceSet->DoRebuildUserFontSet();
 }
 
 /* virtual */ already_AddRefed<gfxUserFontEntry>
-FontFaceSet::UserFontSet::CreateFontFace(
+FontFaceSet::UserFontSet::CreateUserFontEntry(
                                const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                                uint32_t aWeight,
                                int32_t aStretch,
                                uint32_t aItalicStyle,
                                const nsTArray<gfxFontFeature>& aFeatureSettings,
                                uint32_t aLanguageOverride,
                                gfxSparseBitSet* aUnicodeRanges)
 {
--- a/layout/style/FontFaceSet.h
+++ b/layout/style/FontFaceSet.h
@@ -68,17 +68,17 @@ public:
                                       const gfxFontFaceSrc* aFontFaceSrc,
                                       uint8_t*& aBuffer,
                                       uint32_t& aBufferLength) MOZ_OVERRIDE;
     virtual nsresult LogMessage(gfxUserFontEntry* aUserFontEntry,
                                 const char* aMessage,
                                 uint32_t aFlags = nsIScriptError::errorFlag,
                                 nsresult aStatus = NS_OK) MOZ_OVERRIDE;
     virtual void DoRebuildUserFontSet() MOZ_OVERRIDE;
-    virtual already_AddRefed<gfxUserFontEntry> CreateFontFace(
+    virtual already_AddRefed<gfxUserFontEntry> CreateUserFontEntry(
                                    const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                                    uint32_t aWeight,
                                    int32_t aStretch,
                                    uint32_t aItalicStyle,
                                    const nsTArray<gfxFontFeature>& aFeatureSettings,
                                    uint32_t aLanguageOverride,
                                    gfxSparseBitSet* aUnicodeRanges) MOZ_OVERRIDE;
 
@@ -156,17 +156,17 @@ private:
     nsFontFaceRuleContainer      mContainer;
   };
 
   FontFace* FontFaceForRule(nsCSSFontFaceRule* aRule);
   void InsertRule(nsCSSFontFaceRule* aRule, uint8_t aSheetType,
                   nsTArray<FontFaceRuleRecord>& oldRules,
                   bool& aFontSetModified);
 
-  already_AddRefed<gfxUserFontEntry> FindOrCreateFontFaceFromRule(
+  already_AddRefed<gfxUserFontEntry> FindOrCreateUserFontEntryFromRule(
                                                    const nsAString& aFamilyName,
                                                    nsCSSFontFaceRule* aRule,
                                                    uint8_t aSheetType);
 
   // search for @font-face rule that matches a userfont font entry
   nsCSSFontFaceRule* FindRuleForUserFontEntry(gfxUserFontEntry* aUserFontEntry);
 
   // search for user font entry for the given @font-face rule