Bug 174055, part 8: change GetLanguage to return a raw nsIAtom*.

This commit is contained in:
Zack Weinberg 2011-04-14 10:43:21 -07:00
parent d856f0c057
commit d9ffdcb05b
3 changed files with 10 additions and 20 deletions

View File

@ -268,14 +268,6 @@ nsFontMetrics::SpaceWidth()
return CEIL_TO_TWIPS(GetMetrics().spaceWidth);
}
already_AddRefed<nsIAtom>
nsFontMetrics::GetLanguage()
{
nsIAtom* result = mLanguage.get();
NS_IF_ADDREF(result);
return result;
}
PRInt32
nsFontMetrics::GetMaxStringLength()
{

View File

@ -197,7 +197,7 @@ public:
/**
* Returns the language associated with these metrics
*/
already_AddRefed<nsIAtom> GetLanguage();
nsIAtom* Language() { return mLanguage; }
PRInt32 GetMaxStringLength();

View File

@ -150,18 +150,16 @@ nsFontCache::GetMetricsFor(const nsFont& aFont, nsIAtom* aLanguage,
PRInt32 n = mFontMetrics.Length() - 1;
for (PRInt32 i = n; i >= 0; --i) {
fm = mFontMetrics[i];
if (fm->Font().Equals(aFont) && fm->GetUserFontSet() == aUserFontSet) {
nsCOMPtr<nsIAtom> language = fm->GetLanguage();
if (aLanguage == language.get()) {
if (i != n) {
// promote it to the end of the cache
mFontMetrics.RemoveElementAt(i);
mFontMetrics.AppendElement(fm);
}
fm->GetThebesFontGroup()->UpdateFontList();
NS_ADDREF(aMetrics = fm);
return NS_OK;
if (fm->Font().Equals(aFont) && fm->GetUserFontSet() == aUserFontSet &&
fm->Language() == aLanguage) {
if (i != n) {
// promote it to the end of the cache
mFontMetrics.RemoveElementAt(i);
mFontMetrics.AppendElement(fm);
}
fm->GetThebesFontGroup()->UpdateFontList();
NS_ADDREF(aMetrics = fm);
return NS_OK;
}
}