Improve performance by making nsWordFrame in nsLineLayout an nsDeque instead of an nsAutoVoidArray. Bug 121967, r=timeless, sr=attinasi, a=asa

This commit is contained in:
smontagu%netscape.com 2002-03-19 21:57:45 +00:00
Родитель b385b7c3d9
Коммит 2ef941a509
4 изменённых файлов: 24 добавлений и 20 удалений

Просмотреть файл

@ -163,7 +163,8 @@ nsLineLayout::nsLineLayout(nsIPresContext* aPresContext,
mBlockReflowState(aOuterReflowState),
mBlockRS(nsnull),/* XXX temporary */
mMinLineHeight(0),
mComputeMaxElementSize(aComputeMaxElementSize)
mComputeMaxElementSize(aComputeMaxElementSize),
mWordFrames(0)
{
MOZ_COUNT_CTOR(nsLineLayout);
@ -194,7 +195,8 @@ nsLineLayout::nsLineLayout(nsIPresContext* aPresContext,
}
nsLineLayout::nsLineLayout(nsIPresContext* aPresContext)
: mPresContext(aPresContext)
: mPresContext(aPresContext),
mWordFrames(0)
{
MOZ_COUNT_CTOR(nsLineLayout);
@ -3329,9 +3331,9 @@ nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsRect& aCombinedArea)
void
nsLineLayout::ForgetWordFrame(nsIFrame* aFrame)
{
NS_ASSERTION((void*)aFrame == mWordFrames[0], "forget-word-frame");
if (0 != mWordFrames.Count()) {
mWordFrames.RemoveElementAt(0);
if (0 != mWordFrames.GetSize()) {
NS_ASSERTION((void*)aFrame == mWordFrames.PeekFront(), "forget-word-frame");
mWordFrames.PopFront();
}
}

Просмотреть файл

@ -32,7 +32,7 @@
#define nsLineLayout_h___
#include "nsFrame.h"
#include "nsVoidArray.h"
#include "nsDeque.h"
#include "nsLineBox.h"
#include "nsBlockReflowState.h"
@ -193,17 +193,17 @@ public:
}
void RecordWordFrame(nsIFrame* aWordFrame) {
mWordFrames.AppendElement(aWordFrame);
mWordFrames.Push(aWordFrame);
}
PRBool InWord() const {
return 0 != mWordFrames.Count();
return 0 != mWordFrames.GetSize();
}
void ForgetWordFrame(nsIFrame* aFrame);
void ForgetWordFrames() {
mWordFrames.Clear();
mWordFrames.Empty();
}
nsIFrame* FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame);
@ -285,7 +285,7 @@ protected:
PRUint8 mPlacedFloaters;
PRInt32 mTotalPlacedFrames;
nsAutoVoidArray mWordFrames;
nsDeque mWordFrames;
nscoord mTopEdge;
nscoord mBottomEdge;

Просмотреть файл

@ -163,7 +163,8 @@ nsLineLayout::nsLineLayout(nsIPresContext* aPresContext,
mBlockReflowState(aOuterReflowState),
mBlockRS(nsnull),/* XXX temporary */
mMinLineHeight(0),
mComputeMaxElementSize(aComputeMaxElementSize)
mComputeMaxElementSize(aComputeMaxElementSize),
mWordFrames(0)
{
MOZ_COUNT_CTOR(nsLineLayout);
@ -194,7 +195,8 @@ nsLineLayout::nsLineLayout(nsIPresContext* aPresContext,
}
nsLineLayout::nsLineLayout(nsIPresContext* aPresContext)
: mPresContext(aPresContext)
: mPresContext(aPresContext),
mWordFrames(0)
{
MOZ_COUNT_CTOR(nsLineLayout);
@ -3329,9 +3331,9 @@ nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsRect& aCombinedArea)
void
nsLineLayout::ForgetWordFrame(nsIFrame* aFrame)
{
NS_ASSERTION((void*)aFrame == mWordFrames[0], "forget-word-frame");
if (0 != mWordFrames.Count()) {
mWordFrames.RemoveElementAt(0);
if (0 != mWordFrames.GetSize()) {
NS_ASSERTION((void*)aFrame == mWordFrames.PeekFront(), "forget-word-frame");
mWordFrames.PopFront();
}
}

Просмотреть файл

@ -32,7 +32,7 @@
#define nsLineLayout_h___
#include "nsFrame.h"
#include "nsVoidArray.h"
#include "nsDeque.h"
#include "nsLineBox.h"
#include "nsBlockReflowState.h"
@ -193,17 +193,17 @@ public:
}
void RecordWordFrame(nsIFrame* aWordFrame) {
mWordFrames.AppendElement(aWordFrame);
mWordFrames.Push(aWordFrame);
}
PRBool InWord() const {
return 0 != mWordFrames.Count();
return 0 != mWordFrames.GetSize();
}
void ForgetWordFrame(nsIFrame* aFrame);
void ForgetWordFrames() {
mWordFrames.Clear();
mWordFrames.Empty();
}
nsIFrame* FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame);
@ -285,7 +285,7 @@ protected:
PRUint8 mPlacedFloaters;
PRInt32 mTotalPlacedFrames;
nsAutoVoidArray mWordFrames;
nsDeque mWordFrames;
nscoord mTopEdge;
nscoord mBottomEdge;