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

git-svn-id: svn://10.0.0.236/trunk@116883 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
smontagu%netscape.com 2002-03-19 21:57:45 +00:00
parent a5a0c6c5e4
commit 395a7140b7
4 changed files with 24 additions and 20 deletions

View File

@ -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();
}
}

View File

@ -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;

View File

@ -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();
}
}

View File

@ -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;