mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 12:55:46 +00:00
Check that the user font set matches before returning an entry from the font cache. (Bug 457821) r=jdaggett sr=roc a=blocking1.9.1+
This commit is contained in:
parent
6c450a816a
commit
9d19739d81
@ -51,6 +51,7 @@
|
||||
#include "nsCRT.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "gfxUserFontSet.h"
|
||||
#include "nsIThebesFontMetrics.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS3(DeviceContextImpl, nsIDeviceContext, nsIObserver, nsISupportsWeakReference)
|
||||
|
||||
@ -482,7 +483,8 @@ nsFontCache::GetMetricsFor(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
PRInt32 n = mFontMetrics.Count() - 1;
|
||||
for (PRInt32 i = n; i >= 0; --i) {
|
||||
fm = static_cast<nsIFontMetrics*>(mFontMetrics[i]);
|
||||
if (fm->Font().Equals(aFont)) {
|
||||
nsIThebesFontMetrics* tfm = static_cast<nsIThebesFontMetrics*>(fm);
|
||||
if (fm->Font().Equals(aFont) && tfm->GetUserFontSet() == aUserFontSet) {
|
||||
nsCOMPtr<nsIAtom> langGroup;
|
||||
fm->GetLangGroup(getter_AddRefs(langGroup));
|
||||
if (aLangGroup == langGroup.get()) {
|
||||
@ -490,6 +492,7 @@ nsFontCache::GetMetricsFor(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
// promote it to the end of the cache
|
||||
mFontMetrics.MoveElement(i, n);
|
||||
}
|
||||
tfm->GetThebesFontGroup()->UpdateFontList();
|
||||
NS_ADDREF(aMetrics = fm);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -116,6 +116,10 @@ public:
|
||||
virtual PRInt32 GetMaxStringLength() = 0;
|
||||
|
||||
virtual gfxFontGroup* GetThebesFontGroup() = 0;
|
||||
|
||||
// Needs to be virtual and at this level so that its caller in gkgfx can
|
||||
// avoid linking against thebes.
|
||||
virtual gfxUserFontSet* GetUserFontSet() = 0;
|
||||
};
|
||||
|
||||
#endif /* __nsIThebesFontMetrics_h */
|
||||
|
@ -494,3 +494,9 @@ nsThebesFontMetrics::GetRightToLeftText()
|
||||
{
|
||||
return mIsRightToLeft;
|
||||
}
|
||||
|
||||
/* virtual */ gfxUserFontSet*
|
||||
nsThebesFontMetrics::GetUserFontSet()
|
||||
{
|
||||
return mFontGroup->GetUserFontSet();
|
||||
}
|
||||
|
@ -141,6 +141,8 @@ public:
|
||||
virtual void SetTextRunRTL(PRBool aIsRTL) { mTextRunRTL = aIsRTL; }
|
||||
|
||||
virtual gfxFontGroup* GetThebesFontGroup() { return mFontGroup; }
|
||||
|
||||
virtual gfxUserFontSet* GetUserFontSet();
|
||||
|
||||
PRBool GetRightToLeftTextRunMode() {
|
||||
return mTextRunRTL;
|
||||
|
@ -133,6 +133,14 @@ public:
|
||||
PRBool aWrapped, gfxTextRun *aTextRun);
|
||||
|
||||
gfxAtsuiFont* GetFontAt(PRInt32 aFontIndex) {
|
||||
// If it turns out to be hard for all clients that cache font
|
||||
// groups to call UpdateFontList at appropriate times, we could
|
||||
// instead consider just calling UpdateFontList from someplace
|
||||
// more central (such as here).
|
||||
NS_ASSERTION(!mUserFontSet || mCurrGeneration == GetGeneration(),
|
||||
"Whoever was caching this font group should have "
|
||||
"called UpdateFontList on it");
|
||||
|
||||
return static_cast<gfxAtsuiFont*>(static_cast<gfxFont*>(mFonts[aFontIndex]));
|
||||
}
|
||||
|
||||
|
@ -132,6 +132,14 @@ public: // new functions
|
||||
virtual ~gfxFT2FontGroup ();
|
||||
|
||||
inline gfxFT2Font *GetFontAt (PRInt32 i) {
|
||||
// If it turns out to be hard for all clients that cache font
|
||||
// groups to call UpdateFontList at appropriate times, we could
|
||||
// instead consider just calling UpdateFontList from someplace
|
||||
// more central (such as here).
|
||||
NS_ASSERTION(!mUserFontSet || mCurrGeneration == GetGeneration(),
|
||||
"Whoever was caching this font group should have "
|
||||
"called UpdateFontList on it");
|
||||
|
||||
return static_cast <gfxFT2Font *>(static_cast <gfxFont *>(mFonts[i]));
|
||||
}
|
||||
|
||||
|
@ -1523,6 +1523,14 @@ public:
|
||||
virtual ~gfxFontGroup();
|
||||
|
||||
virtual gfxFont *GetFontAt(PRInt32 i) {
|
||||
// If it turns out to be hard for all clients that cache font
|
||||
// groups to call UpdateFontList at appropriate times, we could
|
||||
// instead consider just calling UpdateFontList from someplace
|
||||
// more central (such as here).
|
||||
NS_ASSERTION(!mUserFontSet || mCurrGeneration == GetGeneration(),
|
||||
"Whoever was caching this font group should have "
|
||||
"called UpdateFontList on it");
|
||||
|
||||
return static_cast<gfxFont*>(mFonts[i]);
|
||||
}
|
||||
virtual PRUint32 FontListLength() const {
|
||||
|
@ -107,6 +107,14 @@ public:
|
||||
const Parameters* aParams, PRUint32 aFlags);
|
||||
|
||||
gfxOS2Font *GetFontAt(PRInt32 i) {
|
||||
// If it turns out to be hard for all clients that cache font
|
||||
// groups to call UpdateFontList at appropriate times, we could
|
||||
// instead consider just calling UpdateFontList from someplace
|
||||
// more central (such as here).
|
||||
NS_ASSERTION(!mUserFontSet || mCurrGeneration == GetGeneration(),
|
||||
"Whoever was caching this font group should have "
|
||||
"called UpdateFontList on it");
|
||||
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2FontGroup[%#x]::GetFontAt(%d), %#x, %#x\n",
|
||||
(unsigned)this, i, (unsigned)&mFonts, (unsigned)&mFonts[i]);
|
||||
|
@ -1401,6 +1401,14 @@ gfxPangoFontGroup::GetBasePangoFont()
|
||||
|
||||
gfxFont *
|
||||
gfxPangoFontGroup::GetFontAt(PRInt32 i) {
|
||||
// If it turns out to be hard for all clients that cache font
|
||||
// groups to call UpdateFontList at appropriate times, we could
|
||||
// instead consider just calling UpdateFontList from someplace
|
||||
// more central (such as here).
|
||||
NS_ASSERTION(!mUserFontSet || mCurrGeneration == GetGeneration(),
|
||||
"Whoever was caching this font group should have "
|
||||
"called UpdateFontList on it");
|
||||
|
||||
NS_PRECONDITION(i == 0, "Only have one font");
|
||||
|
||||
if (!mFonts[0]) {
|
||||
|
@ -889,6 +889,14 @@ gfxWindowsFontGroup::~gfxWindowsFontGroup()
|
||||
gfxWindowsFont *
|
||||
gfxWindowsFontGroup::GetFontAt(PRInt32 i)
|
||||
{
|
||||
// If it turns out to be hard for all clients that cache font
|
||||
// groups to call UpdateFontList at appropriate times, we could
|
||||
// instead consider just calling UpdateFontList from someplace
|
||||
// more central (such as here).
|
||||
NS_ASSERTION(!mUserFontSet || mCurrGeneration == GetGeneration(),
|
||||
"Whoever was caching this font group should have "
|
||||
"called UpdateFontList on it");
|
||||
|
||||
if (!mFonts[i]) {
|
||||
nsRefPtr<gfxWindowsFont> font =
|
||||
gfxWindowsFont::GetOrMakeFont(mFontEntries[i], &mStyle);
|
||||
|
@ -12,7 +12,7 @@ fails HTTP(..) == name-override-1.html name-override-1-ref.html
|
||||
HTTP(..) == multiple-descriptor-1.html multiple-descriptor-1-ref.html
|
||||
fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) != multiple-descriptor-1.html multiple-descriptor-1-notref.html
|
||||
fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == src-list-1.html src-list-1-ref.html
|
||||
fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") random-if(MOZ_WIDGET_TOOLKIT=="cocoa") random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == src-list-2.html src-list-2-ref.html # random probably fixed by the font cache patch on bug 457821
|
||||
fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == src-list-2.html src-list-2-ref.html
|
||||
fails HTTP(..) == src-list-format-1.html src-list-format-1-ref.html
|
||||
fails HTTP(..) == src-list-format-2.html src-list-format-2-ref.html
|
||||
fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == src-list-format-3.html src-list-format-3-ref.html
|
||||
@ -26,7 +26,7 @@ fails HTTP(..) == order-2.html order-2-ref.html
|
||||
fails HTTP(..) == order-3.html order-3-ref.html
|
||||
fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == multiple-in-family-1.html multiple-in-family-1-ref.html
|
||||
fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) != multiple-in-family-1.html multiple-in-family-1-notref.html
|
||||
random-if(MOZ_WIDGET_TOOLKIT=="windows") random-if(MOZ_WIDGET_TOOLKIT=="cocoa") HTTP(..) == prop-order-over-rule-order-1a.html prop-order-over-rule-order-2a.html # randomness on cocoa should be fixed by the font cache patch on bug 457821
|
||||
random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == prop-order-over-rule-order-1a.html prop-order-over-rule-order-2a.html
|
||||
random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == prop-order-over-rule-order-1b.html prop-order-over-rule-order-2b.html
|
||||
random-if(MOZ_WIDGET_TOOLKIT=="windows") fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) != prop-order-over-rule-order-1a.html prop-order-over-rule-order-1b.html
|
||||
fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == cross-iframe-1.html cross-iframe-1-ref.html
|
||||
|
Loading…
Reference in New Issue
Block a user