mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 474369 - get rid of nsVoidArray; gfx part; r+sr=vladimir
This commit is contained in:
parent
b9ae053523
commit
8d7dec737d
@ -43,7 +43,7 @@
|
||||
#include "nsIDeviceContextSpec.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsWeakReference.h"
|
||||
@ -74,9 +74,9 @@ public:
|
||||
virtual nsresult CreateFontMetricsInstance(nsIFontMetrics** fm);
|
||||
|
||||
protected:
|
||||
nsVoidArray mFontMetrics;
|
||||
nsIDeviceContext *mContext; // we do not addref this since
|
||||
// ownership is implied. MMP.
|
||||
nsTArray<nsIFontMetrics*> mFontMetrics;
|
||||
nsIDeviceContext *mContext; // we do not addref this since
|
||||
// ownership is implied. MMP.
|
||||
};
|
||||
|
||||
// inherit visibility from the NS_GFX class declaration
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "nsFont.h"
|
||||
#include "nsIView.h"
|
||||
#include "nsGfxCIID.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsILanguageAtomService.h"
|
||||
@ -480,9 +479,9 @@ nsFontCache::GetMetricsFor(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
// start from the end, which is where we put the most-recent-used element
|
||||
|
||||
nsIFontMetrics* fm;
|
||||
PRInt32 n = mFontMetrics.Count() - 1;
|
||||
PRInt32 n = mFontMetrics.Length() - 1;
|
||||
for (PRInt32 i = n; i >= 0; --i) {
|
||||
fm = static_cast<nsIFontMetrics*>(mFontMetrics[i]);
|
||||
fm = mFontMetrics[i];
|
||||
nsIThebesFontMetrics* tfm = static_cast<nsIThebesFontMetrics*>(fm);
|
||||
if (fm->Font().Equals(aFont) && tfm->GetUserFontSet() == aUserFontSet) {
|
||||
nsCOMPtr<nsIAtom> langGroup;
|
||||
@ -490,7 +489,8 @@ nsFontCache::GetMetricsFor(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
if (aLangGroup == langGroup.get()) {
|
||||
if (i != n) {
|
||||
// promote it to the end of the cache
|
||||
mFontMetrics.MoveElement(i, n);
|
||||
mFontMetrics.RemoveElementAt(i);
|
||||
mFontMetrics.AppendElement(fm);
|
||||
}
|
||||
tfm->GetThebesFontGroup()->UpdateFontList();
|
||||
NS_ADDREF(aMetrics = fm);
|
||||
@ -535,9 +535,9 @@ nsFontCache::GetMetricsFor(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
|
||||
// could not setup a new one, send an old one (XXX search a "best match"?)
|
||||
|
||||
n = mFontMetrics.Count() - 1; // could have changed in Compact()
|
||||
n = mFontMetrics.Length() - 1; // could have changed in Compact()
|
||||
if (n >= 0) {
|
||||
aMetrics = static_cast<nsIFontMetrics*>(mFontMetrics[n]);
|
||||
aMetrics = mFontMetrics[n];
|
||||
NS_ADDREF(aMetrics);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -558,15 +558,15 @@ nsFontCache::CreateFontMetricsInstance(nsIFontMetrics** fm)
|
||||
|
||||
nsresult nsFontCache::FontMetricsDeleted(const nsIFontMetrics* aFontMetrics)
|
||||
{
|
||||
mFontMetrics.RemoveElement((void*)aFontMetrics);
|
||||
mFontMetrics.RemoveElement(aFontMetrics);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsFontCache::Compact()
|
||||
{
|
||||
// Need to loop backward because the running element can be removed on the way
|
||||
for (PRInt32 i = mFontMetrics.Count()-1; i >= 0; --i) {
|
||||
nsIFontMetrics* fm = static_cast<nsIFontMetrics*>(mFontMetrics[i]);
|
||||
for (PRInt32 i = mFontMetrics.Length()-1; i >= 0; --i) {
|
||||
nsIFontMetrics* fm = mFontMetrics[i];
|
||||
nsIFontMetrics* oldfm = fm;
|
||||
// Destroy() isn't here because we want our device context to be notified
|
||||
NS_RELEASE(fm); // this will reset fm to nsnull
|
||||
@ -582,8 +582,8 @@ nsresult nsFontCache::Compact()
|
||||
|
||||
nsresult nsFontCache::Flush()
|
||||
{
|
||||
for (PRInt32 i = mFontMetrics.Count()-1; i >= 0; --i) {
|
||||
nsIFontMetrics* fm = static_cast<nsIFontMetrics*>(mFontMetrics[i]);
|
||||
for (PRInt32 i = mFontMetrics.Length()-1; i >= 0; --i) {
|
||||
nsIFontMetrics* fm = mFontMetrics[i];
|
||||
// Destroy() will unhook our device context from the fm so that we won't
|
||||
// waste time in triggering the notification of FontMetricsDeleted()
|
||||
// in the subsequent release
|
||||
|
@ -52,7 +52,6 @@
|
||||
#include "nsRect.h"
|
||||
#include "nsIRegion.h"
|
||||
#include "nsTransform2D.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIThebesFontMetrics.h"
|
||||
#include "gfxContext.h"
|
||||
|
||||
|
@ -40,7 +40,6 @@
|
||||
#define GFX_PLATFORM_H
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#include "nsIObserver.h"
|
||||
|
@ -48,7 +48,6 @@
|
||||
#endif
|
||||
#include "gfxPlatform.h"
|
||||
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsDataHashtable.h"
|
||||
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
// used when picking fallback font
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include "gfxPlatform.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "prlong.h"
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
|
Loading…
Reference in New Issue
Block a user