mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug fix 91250:
Adding a return Boolean from nsIFontEnumerator::UpdateFontList() to identify if the font lang group has changed from receiving the WM_FONTCHANGE msg. /r=rbs;/sr=brendan
This commit is contained in:
parent
efd3447de7
commit
f23cd921c9
@ -55,7 +55,7 @@ interface nsIFontEnumerator : nsISupports
|
||||
|
||||
/*
|
||||
* update the global font list
|
||||
* @param None
|
||||
* return true if font list is changed
|
||||
*/
|
||||
void UpdateFontList();
|
||||
boolean updateFontList();
|
||||
};
|
||||
|
@ -468,8 +468,9 @@ nsFontEnumeratorBeOS::HaveFontFor(const char* aLangGroup, PRBool* aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFontEnumeratorBeOS::UpdateFontList()
|
||||
nsFontEnumeratorBeOS::UpdateFontList(PRBool *updateFontList)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
*updateFontList = PR_FALSE; // always return false for now
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -4199,7 +4199,8 @@ nsFontEnumeratorGTK::HaveFontFor(const char* aLangGroup, PRBool* aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFontEnumeratorGTK::UpdateFontList()
|
||||
nsFontEnumeratorGTK::UpdateFontList(PRBool *updateFontList)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
*updateFontList = PR_FALSE; // always return false for now
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1238,7 +1238,8 @@ nsFontEnumeratorMac::HaveFontFor(const char* aLangGroup,PRBool* aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFontEnumeratorMac::UpdateFontList()
|
||||
nsFontEnumeratorMac::UpdateFontList(PRBool *updateFontList)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
*updateFontList = PR_FALSE; // always return false for now
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1516,8 +1516,9 @@ nsFontEnumeratorOS2::HaveFontFor(const char* aLangGroup, PRBool* aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFontEnumeratorOS2::UpdateFontList()
|
||||
nsFontEnumeratorOS2::UpdateFontList(PRBool *updateFontList)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
*updateFontList = PR_FALSE; // always return false for now
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -586,7 +586,8 @@ NS_IMETHODIMP
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFontEnumeratorPh::UpdateFontList()
|
||||
nsFontEnumeratorPh::UpdateFontList(PRBool *updateFontList)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
*updateFontList = PR_FALSE; // always return false for now
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2180,8 +2180,9 @@ nsFontEnumeratorQT::HaveFontFor(const char *aLangGroup,PRBool *aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFontEnumeratorQT::UpdateFontList()
|
||||
nsFontEnumeratorQT::UpdateFontList(PRBool *updateFontList)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
*updateFontList = PR_FALSE; // always return false for now
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -4709,9 +4709,25 @@ nsFontEnumeratorWin::HaveFontFor(const char* aLangGroup, PRBool* aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFontEnumeratorWin::UpdateFontList()
|
||||
NS_IMETHODIMP
|
||||
nsFontEnumeratorWin::UpdateFontList(PRBool *updateFontList)
|
||||
{
|
||||
PRBool haveFontForLang = PR_FALSE;
|
||||
int charSetCounter = 0;
|
||||
PRUint16 maskBitBefore = 0;
|
||||
|
||||
// initialize updateFontList
|
||||
*updateFontList = PR_FALSE;
|
||||
|
||||
// iterate langGoup; skip DEFAULT
|
||||
for (charSetCounter = 1; charSetCounter < eCharSet_COUNT; charSetCounter++) {
|
||||
HaveFontFor(gCharSetInfo[charSetCounter].mLangGroup, &haveFontForLang);
|
||||
if (haveFontForLang) {
|
||||
maskBitBefore |= PR_BIT(charSetCounter);
|
||||
haveFontForLang = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// delete gGlobalFont
|
||||
if (nsFontMetricsWin::gGlobalFonts) {
|
||||
for (int i = 0; i < nsFontMetricsWin::gGlobalFontsCount; i++) {
|
||||
@ -4732,5 +4748,17 @@ nsFontEnumeratorWin::UpdateFontList()
|
||||
}
|
||||
::ReleaseDC(nsnull, dc);
|
||||
|
||||
PRUint16 maskBitAfter = 0;
|
||||
// iterate langGoup again; skip DEFAULT
|
||||
for (charSetCounter = 1; charSetCounter < eCharSet_COUNT; charSetCounter++) {
|
||||
HaveFontFor(gCharSetInfo[charSetCounter].mLangGroup, &haveFontForLang);
|
||||
if (haveFontForLang) {
|
||||
maskBitAfter |= PR_BIT(charSetCounter);
|
||||
haveFontForLang = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// check for change
|
||||
*updateFontList = (maskBitBefore != maskBitAfter);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4318,9 +4318,10 @@ nsFontEnumeratorXlib::HaveFontFor(const char* aLangGroup, PRBool* aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFontEnumeratorXlib::UpdateFontList()
|
||||
NS_IMETHODIMP
|
||||
nsFontEnumeratorXlib::UpdateFontList(PRBool *updateFontList)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
*updateFontList = PR_FALSE; // always return false for now
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -450,15 +450,6 @@ nsPresContext::PreferenceChanged(const char* aPrefName)
|
||||
return;
|
||||
}
|
||||
|
||||
// XXX for WM_FONTCHANGE messages, only flush the font cache (bug=89493)
|
||||
// because nsObjectFrame can't handle a reframe at this time
|
||||
if (strcmp(aPrefName,"font.internaluseonly.changed") == 0) {
|
||||
if (mDeviceContext) {
|
||||
mDeviceContext->FlushFontCache();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize our state from the user preferences
|
||||
GetUserPreferences();
|
||||
|
||||
|
@ -450,15 +450,6 @@ nsPresContext::PreferenceChanged(const char* aPrefName)
|
||||
return;
|
||||
}
|
||||
|
||||
// XXX for WM_FONTCHANGE messages, only flush the font cache (bug=89493)
|
||||
// because nsObjectFrame can't handle a reframe at this time
|
||||
if (strcmp(aPrefName,"font.internaluseonly.changed") == 0) {
|
||||
if (mDeviceContext) {
|
||||
mDeviceContext->FlushFontCache();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize our state from the user preferences
|
||||
GetUserPreferences();
|
||||
|
||||
|
@ -2998,24 +2998,27 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
|
||||
case WM_FONTCHANGE:
|
||||
{
|
||||
nsresult rv;
|
||||
PRBool didChange = PR_FALSE;
|
||||
|
||||
// update the global font list
|
||||
nsCOMPtr<nsIFontEnumerator> fontEnum = do_GetService("@mozilla.org/gfx/fontenumerator;1", &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
fontEnum->UpdateFontList();
|
||||
}
|
||||
|
||||
// update device context font cache
|
||||
// Dirty but easiest way:
|
||||
// Changing nsIPref entry which triggers callbacks
|
||||
// and flows into calling mDeviceContext->FlushFontCache()
|
||||
// to update the font cache in all the instance of Browsers
|
||||
nsCOMPtr<nsIPref> pPrefs = do_GetService(NS_PREF_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool fontInternalChange = PR_FALSE;
|
||||
pPrefs->GetBoolPref("font.internaluseonly.changed", &fontInternalChange);
|
||||
pPrefs->SetBoolPref("font.internaluseonly.changed", !fontInternalChange);
|
||||
}
|
||||
fontEnum->UpdateFontList(&didChange);
|
||||
//didChange is TRUE only if new font langGroup is added to the list.
|
||||
if (didChange) {
|
||||
// update device context font cache
|
||||
// Dirty but easiest way:
|
||||
// Changing nsIPref entry which triggers callbacks
|
||||
// and flows into calling mDeviceContext->FlushFontCache()
|
||||
// to update the font cache in all the instance of Browsers
|
||||
nsCOMPtr<nsIPref> pPrefs = do_GetService(NS_PREF_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool fontInternalChange = PR_FALSE;
|
||||
pPrefs->GetBoolPref("font.internaluseonly.changed", &fontInternalChange);
|
||||
pPrefs->SetBoolPref("font.internaluseonly.changed", !fontInternalChange);
|
||||
}
|
||||
}
|
||||
} //if (NS_SUCCEEDED(rv))
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user