Added methods for counting the number of placed frames; switched the pres-context to a ref from a pointer; removed some debris

This commit is contained in:
kipp%netscape.com 1998-09-23 02:31:00 +00:00
parent d8dc49bad0
commit a62b3d9000
2 changed files with 78 additions and 22 deletions

View File

@ -26,6 +26,7 @@ struct nsBlockReflowState;
class nsPlaceholderFrame;
struct nsStyleDisplay;
struct nsStylePosition;
struct nsStyleSpacing;
// This structure represents a run of text. In mText are the
// nsIFrame's that are considered text frames.
@ -56,14 +57,43 @@ protected:
class nsLineLayout {
public:
nsLineLayout(nsIPresContext* aPresContext,
nsLineLayout(nsIPresContext& aPresContext,
nsISpaceManager* aSpaceManager);
~nsLineLayout();
void Init(nsBlockReflowState* aReflowState) {
void Init(nsBlockReflowState* aReflowState) {/* XXX ctor arg really */
mBlockReflowState = aReflowState;
}
// Prepare this line-layout for the reflow of a new line
void Reset() {
mTotalPlacedFrames = 0;
mColumn = 0;
mSkipLeadingWS = PR_TRUE;
#ifdef NS_DEBUG
mPlacedFrames.Clear();
#endif
}
// Add to the placed-frame count
#ifdef NS_DEBUG
void AddPlacedFrame(nsIFrame* aFrame) {
mTotalPlacedFrames++;
mPlacedFrames.AppendElement(aFrame);
}
#else
void AddPlacedFrame() {
mTotalPlacedFrames++;
}
#endif
// Get the placed-frame count
PRInt32 GetPlacedFrames() const {
return mTotalPlacedFrames;
}
// --------------------------------------------------
// Reset the text-run information in preparation for a FindTextRuns
void ResetTextRuns();
@ -79,13 +109,6 @@ public:
// FindTextRuns. The internal text-run state is reset.
nsTextRun* TakeTextRuns();
// Prepare this line-layout for the reflow of a new line
void Prepare(nscoord aLeftEdge) {
mLeftEdge = aLeftEdge;
mColumn = 0;
mSkipLeadingWS = PR_TRUE;
}
PRInt32 GetColumn() {
return mColumn;
}
@ -103,13 +126,13 @@ public:
static PRBool TreatFrameAsBlock(const nsStyleDisplay* aDisplay,
const nsStylePosition* aPosition);
nsIPresContext* mPresContext;
nsIPresContext& mPresContext;
nsISpaceManager* mSpaceManager;
nsBlockReflowState* mBlockReflowState;
PRBool mListPositionOutside;
PRInt32 mLineNumber;
nscoord mLeftEdge;
// nscoord mLeftEdge;
PRInt32 mColumn;
//XXX temporary?
@ -122,6 +145,11 @@ public:
PRBool mSkipLeadingWS;
protected:
PRInt32 mTotalPlacedFrames;
#ifdef NS_DEBUG
nsVoidArray mPlacedFrames;
#endif
// These slots are used during FindTextRuns
nsTextRun* mTextRuns;
nsTextRun** mTextRunP;

View File

@ -26,6 +26,7 @@ struct nsBlockReflowState;
class nsPlaceholderFrame;
struct nsStyleDisplay;
struct nsStylePosition;
struct nsStyleSpacing;
// This structure represents a run of text. In mText are the
// nsIFrame's that are considered text frames.
@ -56,14 +57,43 @@ protected:
class nsLineLayout {
public:
nsLineLayout(nsIPresContext* aPresContext,
nsLineLayout(nsIPresContext& aPresContext,
nsISpaceManager* aSpaceManager);
~nsLineLayout();
void Init(nsBlockReflowState* aReflowState) {
void Init(nsBlockReflowState* aReflowState) {/* XXX ctor arg really */
mBlockReflowState = aReflowState;
}
// Prepare this line-layout for the reflow of a new line
void Reset() {
mTotalPlacedFrames = 0;
mColumn = 0;
mSkipLeadingWS = PR_TRUE;
#ifdef NS_DEBUG
mPlacedFrames.Clear();
#endif
}
// Add to the placed-frame count
#ifdef NS_DEBUG
void AddPlacedFrame(nsIFrame* aFrame) {
mTotalPlacedFrames++;
mPlacedFrames.AppendElement(aFrame);
}
#else
void AddPlacedFrame() {
mTotalPlacedFrames++;
}
#endif
// Get the placed-frame count
PRInt32 GetPlacedFrames() const {
return mTotalPlacedFrames;
}
// --------------------------------------------------
// Reset the text-run information in preparation for a FindTextRuns
void ResetTextRuns();
@ -79,13 +109,6 @@ public:
// FindTextRuns. The internal text-run state is reset.
nsTextRun* TakeTextRuns();
// Prepare this line-layout for the reflow of a new line
void Prepare(nscoord aLeftEdge) {
mLeftEdge = aLeftEdge;
mColumn = 0;
mSkipLeadingWS = PR_TRUE;
}
PRInt32 GetColumn() {
return mColumn;
}
@ -103,13 +126,13 @@ public:
static PRBool TreatFrameAsBlock(const nsStyleDisplay* aDisplay,
const nsStylePosition* aPosition);
nsIPresContext* mPresContext;
nsIPresContext& mPresContext;
nsISpaceManager* mSpaceManager;
nsBlockReflowState* mBlockReflowState;
PRBool mListPositionOutside;
PRInt32 mLineNumber;
nscoord mLeftEdge;
// nscoord mLeftEdge;
PRInt32 mColumn;
//XXX temporary?
@ -122,6 +145,11 @@ public:
PRBool mSkipLeadingWS;
protected:
PRInt32 mTotalPlacedFrames;
#ifdef NS_DEBUG
nsVoidArray mPlacedFrames;
#endif
// These slots are used during FindTextRuns
nsTextRun* mTextRuns;
nsTextRun** mTextRunP;