зеркало из https://github.com/mozilla/gecko-dev.git
bug 39570; we were using the Western font to determine the height of the
URL bar, and this caused the Japanese text to be truncated; we now use the locale's language group when the caller does not pass us the correct one; r=nhotta
This commit is contained in:
Родитель
6bb24a2b4f
Коммит
7416f242ae
|
@ -100,13 +100,14 @@ protected:
|
|||
nsresult AliasFont(const nsString& aFont,
|
||||
const nsString& aAlias, const nsString& aAltAlias,
|
||||
PRBool aForceAlias);
|
||||
void GetLocaleLangGroup(void);
|
||||
|
||||
float mTwipsToPixels;
|
||||
float mPixelsToTwips;
|
||||
float mAppUnitsToDevUnits;
|
||||
float mDevUnitsToAppUnits;
|
||||
nsFontCache *mFontCache;
|
||||
nsCOMPtr<nsIAtom> mWestern; // XXX temporary fix for performance bug - erik
|
||||
nsCOMPtr<nsIAtom> mLocaleLangGroup; // XXX temp fix for performance bug - erik
|
||||
float mZoom;
|
||||
float mTextZoom;
|
||||
float mGammaValue;
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
#include "nsVoidArray.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsILanguageAtomService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
class nsFontCache
|
||||
{
|
||||
|
@ -236,6 +238,21 @@ nsresult DeviceContextImpl::CreateFontCache()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
DeviceContextImpl::GetLocaleLangGroup(void)
|
||||
{
|
||||
if (!mLocaleLangGroup) {
|
||||
nsCOMPtr<nsILanguageAtomService> langService;
|
||||
langService = do_GetService(NS_LANGUAGEATOMSERVICE_PROGID);
|
||||
if (langService) {
|
||||
langService->GetLocaleLanguageGroup(getter_AddRefs(mLocaleLangGroup));
|
||||
}
|
||||
if (!mLocaleLangGroup) {
|
||||
mLocaleLangGroup = getter_AddRefs(NS_NewAtom("x-western"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeviceContextImpl::GetMetricsFor(const nsFont& aFont,
|
||||
nsIAtom* aLangGroup, nsIFontMetrics*& aMetrics)
|
||||
{
|
||||
|
@ -246,12 +263,12 @@ NS_IMETHODIMP DeviceContextImpl::GetMetricsFor(const nsFont& aFont,
|
|||
return rv;
|
||||
}
|
||||
// XXX temporary fix for performance problem -- erik
|
||||
mWestern = getter_AddRefs(NS_NewAtom("x-western"));
|
||||
GetLocaleLangGroup();
|
||||
}
|
||||
|
||||
// XXX figure out why aLangGroup is NULL sometimes
|
||||
if (!aLangGroup) {
|
||||
aLangGroup = mWestern;
|
||||
aLangGroup = mLocaleLangGroup;
|
||||
}
|
||||
|
||||
return mFontCache->GetMetricsFor(aFont, aLangGroup, aMetrics);
|
||||
|
@ -266,9 +283,9 @@ NS_IMETHODIMP DeviceContextImpl::GetMetricsFor(const nsFont& aFont, nsIFontMetri
|
|||
return rv;
|
||||
}
|
||||
// XXX temporary fix for performance problem -- erik
|
||||
mWestern = getter_AddRefs(NS_NewAtom("x-western"));
|
||||
GetLocaleLangGroup();
|
||||
}
|
||||
return mFontCache->GetMetricsFor(aFont, mWestern, aMetrics);
|
||||
return mFontCache->GetMetricsFor(aFont, mLocaleLangGroup, aMetrics);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeviceContextImpl :: SetZoom(float aZoom)
|
||||
|
|
|
@ -369,8 +369,8 @@ NS_IMETHODIMP nsDeviceContextPS :: ConvertPixel(nscolor aColor, PRUint32 & aPixe
|
|||
*/
|
||||
NS_IMETHODIMP nsDeviceContextPS::GetMetricsFor(const nsFont& aFont, nsIFontMetrics *&aMetrics)
|
||||
{
|
||||
mWestern = getter_AddRefs(NS_NewAtom("x-western"));
|
||||
return GetMetricsFor(aFont, mWestern, aMetrics);
|
||||
GetLocaleLangGroup();
|
||||
return GetMetricsFor(aFont, mLocaleLangGroup, aMetrics);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDeviceContextPS::GetMetricsFor(const nsFont& aFont, nsIAtom* aLangGroup, nsIFontMetrics *&aMetrics)
|
||||
|
|
Загрузка…
Ссылка в новой задаче