comments and removal of dead code

git-svn-id: svn://10.0.0.236/trunk@17863 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
buster%netscape.com 1999-01-15 19:55:19 +00:00
parent 6aa855c91d
commit a86baa60f0
4 changed files with 116 additions and 154 deletions

View File

@ -184,63 +184,6 @@ nsresult nsTableOuterFrame::RecoverState(OuterTableReflowState& aReflowState,
return NS_OK;
}
nsresult nsTableOuterFrame::AdjustSiblingsAfterReflow(nsIPresContext& aPresContext,
OuterTableReflowState& aReflowState,
nsIFrame* aKidFrame,
nscoord aDeltaY)
{
// XXX: this is now dead code
nsIFrame* lastKidFrame = aKidFrame;
if (aDeltaY != 0) {
// Move the frames that follow aKidFrame by aDeltaY
nsIFrame* kidFrame;
aKidFrame->GetNextSibling(kidFrame);
while (nsnull != kidFrame) {
nsPoint origin;
// XXX We can't just slide the child if it has a next-in-flow
kidFrame->GetOrigin(origin);
origin.y += aDeltaY;
// XXX We need to send move notifications to the frame...
nsIHTMLReflow* htmlReflow;
if (NS_OK == kidFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
}
kidFrame->MoveTo(origin.x, origin.y);
// Get the next frame
lastKidFrame = kidFrame;
kidFrame->GetNextSibling(kidFrame);
}
} else {
// Get the last frame
lastKidFrame = LastFrame(mFirstChild);
}
// Update our running y-offset to reflect the bottommost child
nsRect rect;
lastKidFrame->GetRect(rect);
aReflowState.y = rect.YMost();
// Get the bottom margin for the last child frame
const nsStyleSpacing* kidSpacing;
lastKidFrame->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct *&)kidSpacing);
nsMargin margin;
kidSpacing->CalcMarginFor(lastKidFrame, margin);
if (margin.bottom < 0) {
aReflowState.prevMaxNegBottomMargin = -margin.bottom;
} else {
aReflowState.prevMaxPosBottomMargin = margin.bottom;
}
return NS_OK;
}
nsresult nsTableOuterFrame::IncrementalReflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
@ -369,7 +312,7 @@ nsresult nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext& aPres
if (PR_TRUE==gsDebugIR) printf("inner table needs resize reflow.\n");
// Compute the width to use for the table. In the case of an auto sizing
// table this represents the maximum available width
nscoord tableWidth = GetTableWidth(aReflowState.reflowState);
nscoord tableWidth = ComputeAvailableTableWidth(aReflowState.reflowState);
// If the caption max element size is larger, then use it instead.
// XXX: caption align = left|right ignored here!
@ -836,10 +779,8 @@ nsresult nsTableOuterFrame::SizeAndPlaceChildren(const nsSize & aInnerS
return rv;
}
/**
* Called by the Reflow() member function to compute the table width
*/
nscoord nsTableOuterFrame::GetTableWidth(const nsHTMLReflowState& aReflowState)
/* computes the table width */
nscoord nsTableOuterFrame::ComputeAvailableTableWidth(const nsHTMLReflowState& aReflowState)
{
nscoord maxWidth;
@ -973,7 +914,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext,
// Compute the width to use for the table. In the case of an auto sizing
// table this represents the maximum available width
nscoord tableWidth = GetTableWidth(aReflowState);
nscoord tableWidth = ComputeAvailableTableWidth(aReflowState);
// If the caption max element size is larger, then use it instead.
// XXX: caption align = left|right ignored here!
@ -1116,10 +1057,9 @@ void nsTableOuterFrame::PlaceChild( OuterTableReflowState& aReflowState,
aReflowState.availSize.height -= aKidRect.height;
}
/* Update the maximum element size, which is the sum of:
/* Update the maximum element size, which is the max of:
* the maxElementSize of our first row
* plus the maxElementSize of the top caption if we include it
* plus the maxElementSize of the bottom caption if we include it
* or the maxElementSize of the caption if we include it
*/
if (aKidFrame == mCaptionFrame)
{

View File

@ -24,6 +24,10 @@
struct OuterTableReflowState;
struct nsStyleText;
/* TODO
1. decide if we'll allow subclassing. If so, decide which methods really need to be virtual.
*/
/**
* main frame for an nsTable content object,
* the nsTableOuterFrame contains 0 or one caption frame, and a nsTableFrame
@ -40,14 +44,13 @@ public:
/** instantiate a new instance of nsTableOuterFrame.
* @param aResult the new object is returned in this out-param
* @param aContent the table object to map
* @param aParent the parent of the new frame
*
* @return NS_OK if the frame was properly allocated, otherwise an error code
*/
friend nsresult
NS_NewTableOuterFrame(nsIFrame*& aResult);
/** @see nsIFrame::SetInitialChildList */
NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
@ -58,28 +61,37 @@ public:
const nsRect& aDirtyRect,
nsFramePaintLayer aWhichLayer);
/** process a reflow command for the table.
* This involves reflowing the caption and the inner table.
* @see nsIFrame::Reflow */
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
/** @see nsContainerFrame */
/** @see nsIFrame::CreateContinuingFrame */
NS_IMETHOD CreateContinuingFrame(nsIPresContext& aPresContext,
nsIFrame* aParent,
nsIStyleContext* aStyleContext,
nsIFrame*& aContinuingFrame);
/** @see nsIFrame::GetFrameName */
NS_IMETHOD GetFrameName(nsString& aResult) const;
/** return the min width of the caption. Return 0 if there is no caption. */
/** return the min width of the caption. Return 0 if there is no caption.
* The return value is only meaningful after the caption has had a pass1 reflow.
*/
nscoord GetMinCaptionWidth();
/** @see nsIFrame::List */
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const;
protected:
/** implement abstract method on nsHTMLContainerFrame */
/** Always returns 0, since the outer table frame has no border of its own
* The inner table frame can answer this question in a meaningful way.
* @see nsHTMLContainerFrame::GetSkipSides */
virtual PRIntn GetSkipSides() const;
/** return PR_TRUE if the table needs to be reflowed.
@ -89,13 +101,30 @@ protected:
*/
PRBool NeedsReflow(const nsHTMLReflowState& aReflowState, const nsSize& aMaxSize);
/** position the child frame
* @param aReflowState the state of the reflow process
* @param aKidFrame the frame to place.
* @param aKidRect the computed dimensions of aKidFrame. The origin of aKidRect
* is relative to the upper-left origin of this frame.
* @param aMaxElementSize the table's maxElementSize
* may be nsnull, meaning that we're not computing maxElementSize during this reflow
* set to the caption's maxElementSize, if aKidFrame is the caption
* the tables maxElementSize eventually gets set to the max of
* the value here and the value of the inner table, elsewhere during reflow.
* @param aKidMaxElementSize the maxElementSize of aKidFrame, if available
*/
void PlaceChild(OuterTableReflowState& aReflowState,
nsIFrame* aKidFrame,
const nsRect& aKidRect,
nsSize* aMaxElementSize,
nsSize& aKidMaxElementSize);
nscoord GetTableWidth(const nsHTMLReflowState& aReflowState);
/** compute the width available to the table during reflow, based on
* the reflow state and the table's style.
* @return the computed width
*/
nscoord ComputeAvailableTableWidth(const nsHTMLReflowState& aReflowState);
/** overridden here to handle special caption-table relationship
* @see nsContainerFrame::VerifyTree
@ -118,39 +147,51 @@ protected:
PRBool DeleteChildsNextInFlow(nsIPresContext& aPresContext, nsIFrame* aChild);
// begin Incremental Reflow methods
/** prepare aReflowState for an incremental reflow */
NS_IMETHOD RecoverState(OuterTableReflowState& aReflowState, nsIFrame* aKidFrame);
/** process an incremental reflow command */
NS_IMETHOD IncrementalReflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
nsReflowStatus& aStatus);
/** process an incremental reflow command targeted at a child of this frame. */
NS_IMETHOD IR_TargetIsChild(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
nsReflowStatus& aStatus,
nsIFrame * aNextFrame);
/** process an incremental reflow command targeted at the table inner frame. */
NS_IMETHOD IR_TargetIsInnerTableFrame(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
nsReflowStatus& aStatus);
/** process an incremental reflow command targeted at the caption. */
NS_IMETHOD IR_TargetIsCaptionFrame(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
nsReflowStatus& aStatus);
/** process an incremental reflow command targeted at this frame.
* many incremental reflows that are targeted at this outer frame
* are actually handled by the inner frame. The logic to decide this
* is here.
*/
NS_IMETHOD IR_TargetIsMe(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
nsReflowStatus& aStatus);
/** pass along the incremental reflow command to the inner table. */
NS_IMETHOD IR_InnerTableReflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
nsReflowStatus& aStatus);
/** handle incremental reflow notification that a caption was inserted. */
NS_IMETHOD IR_CaptionInserted(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
@ -158,23 +199,23 @@ protected:
nsIFrame * aCaptionFrame,
PRBool aReplace);
/** handle incremental reflow notification that a caption was deleted. */
NS_IMETHOD IR_CaptionRemoved(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
nsReflowStatus& aStatus);
/** handle incremental reflow notification that the caption style was changed
* such that it is now left|right instead of top|bottom, or vice versa.
*/
PRBool IR_CaptionChangedAxis(const nsStyleText* aOldStyle,
const nsStyleText* aNewStyle) const;
/** set the size and the location of both the inner table frame and the caption. */
NS_IMETHOD SizeAndPlaceChildren(const nsSize & aInnerSize,
const nsSize & aCaptionSize,
OuterTableReflowState& aReflowState);
NS_IMETHOD AdjustSiblingsAfterReflow(nsIPresContext& aPresContext,
OuterTableReflowState& aReflowState,
nsIFrame* aKidFrame,
nscoord aDeltaY);
// end Incremental Reflow methods
private:

View File

@ -184,63 +184,6 @@ nsresult nsTableOuterFrame::RecoverState(OuterTableReflowState& aReflowState,
return NS_OK;
}
nsresult nsTableOuterFrame::AdjustSiblingsAfterReflow(nsIPresContext& aPresContext,
OuterTableReflowState& aReflowState,
nsIFrame* aKidFrame,
nscoord aDeltaY)
{
// XXX: this is now dead code
nsIFrame* lastKidFrame = aKidFrame;
if (aDeltaY != 0) {
// Move the frames that follow aKidFrame by aDeltaY
nsIFrame* kidFrame;
aKidFrame->GetNextSibling(kidFrame);
while (nsnull != kidFrame) {
nsPoint origin;
// XXX We can't just slide the child if it has a next-in-flow
kidFrame->GetOrigin(origin);
origin.y += aDeltaY;
// XXX We need to send move notifications to the frame...
nsIHTMLReflow* htmlReflow;
if (NS_OK == kidFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
}
kidFrame->MoveTo(origin.x, origin.y);
// Get the next frame
lastKidFrame = kidFrame;
kidFrame->GetNextSibling(kidFrame);
}
} else {
// Get the last frame
lastKidFrame = LastFrame(mFirstChild);
}
// Update our running y-offset to reflect the bottommost child
nsRect rect;
lastKidFrame->GetRect(rect);
aReflowState.y = rect.YMost();
// Get the bottom margin for the last child frame
const nsStyleSpacing* kidSpacing;
lastKidFrame->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct *&)kidSpacing);
nsMargin margin;
kidSpacing->CalcMarginFor(lastKidFrame, margin);
if (margin.bottom < 0) {
aReflowState.prevMaxNegBottomMargin = -margin.bottom;
} else {
aReflowState.prevMaxPosBottomMargin = margin.bottom;
}
return NS_OK;
}
nsresult nsTableOuterFrame::IncrementalReflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
@ -369,7 +312,7 @@ nsresult nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext& aPres
if (PR_TRUE==gsDebugIR) printf("inner table needs resize reflow.\n");
// Compute the width to use for the table. In the case of an auto sizing
// table this represents the maximum available width
nscoord tableWidth = GetTableWidth(aReflowState.reflowState);
nscoord tableWidth = ComputeAvailableTableWidth(aReflowState.reflowState);
// If the caption max element size is larger, then use it instead.
// XXX: caption align = left|right ignored here!
@ -836,10 +779,8 @@ nsresult nsTableOuterFrame::SizeAndPlaceChildren(const nsSize & aInnerS
return rv;
}
/**
* Called by the Reflow() member function to compute the table width
*/
nscoord nsTableOuterFrame::GetTableWidth(const nsHTMLReflowState& aReflowState)
/* computes the table width */
nscoord nsTableOuterFrame::ComputeAvailableTableWidth(const nsHTMLReflowState& aReflowState)
{
nscoord maxWidth;
@ -973,7 +914,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext,
// Compute the width to use for the table. In the case of an auto sizing
// table this represents the maximum available width
nscoord tableWidth = GetTableWidth(aReflowState);
nscoord tableWidth = ComputeAvailableTableWidth(aReflowState);
// If the caption max element size is larger, then use it instead.
// XXX: caption align = left|right ignored here!
@ -1116,10 +1057,9 @@ void nsTableOuterFrame::PlaceChild( OuterTableReflowState& aReflowState,
aReflowState.availSize.height -= aKidRect.height;
}
/* Update the maximum element size, which is the sum of:
/* Update the maximum element size, which is the max of:
* the maxElementSize of our first row
* plus the maxElementSize of the top caption if we include it
* plus the maxElementSize of the bottom caption if we include it
* or the maxElementSize of the caption if we include it
*/
if (aKidFrame == mCaptionFrame)
{

View File

@ -24,6 +24,10 @@
struct OuterTableReflowState;
struct nsStyleText;
/* TODO
1. decide if we'll allow subclassing. If so, decide which methods really need to be virtual.
*/
/**
* main frame for an nsTable content object,
* the nsTableOuterFrame contains 0 or one caption frame, and a nsTableFrame
@ -40,14 +44,13 @@ public:
/** instantiate a new instance of nsTableOuterFrame.
* @param aResult the new object is returned in this out-param
* @param aContent the table object to map
* @param aParent the parent of the new frame
*
* @return NS_OK if the frame was properly allocated, otherwise an error code
*/
friend nsresult
NS_NewTableOuterFrame(nsIFrame*& aResult);
/** @see nsIFrame::SetInitialChildList */
NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
@ -58,28 +61,37 @@ public:
const nsRect& aDirtyRect,
nsFramePaintLayer aWhichLayer);
/** process a reflow command for the table.
* This involves reflowing the caption and the inner table.
* @see nsIFrame::Reflow */
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
/** @see nsContainerFrame */
/** @see nsIFrame::CreateContinuingFrame */
NS_IMETHOD CreateContinuingFrame(nsIPresContext& aPresContext,
nsIFrame* aParent,
nsIStyleContext* aStyleContext,
nsIFrame*& aContinuingFrame);
/** @see nsIFrame::GetFrameName */
NS_IMETHOD GetFrameName(nsString& aResult) const;
/** return the min width of the caption. Return 0 if there is no caption. */
/** return the min width of the caption. Return 0 if there is no caption.
* The return value is only meaningful after the caption has had a pass1 reflow.
*/
nscoord GetMinCaptionWidth();
/** @see nsIFrame::List */
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const;
protected:
/** implement abstract method on nsHTMLContainerFrame */
/** Always returns 0, since the outer table frame has no border of its own
* The inner table frame can answer this question in a meaningful way.
* @see nsHTMLContainerFrame::GetSkipSides */
virtual PRIntn GetSkipSides() const;
/** return PR_TRUE if the table needs to be reflowed.
@ -89,13 +101,30 @@ protected:
*/
PRBool NeedsReflow(const nsHTMLReflowState& aReflowState, const nsSize& aMaxSize);
/** position the child frame
* @param aReflowState the state of the reflow process
* @param aKidFrame the frame to place.
* @param aKidRect the computed dimensions of aKidFrame. The origin of aKidRect
* is relative to the upper-left origin of this frame.
* @param aMaxElementSize the table's maxElementSize
* may be nsnull, meaning that we're not computing maxElementSize during this reflow
* set to the caption's maxElementSize, if aKidFrame is the caption
* the tables maxElementSize eventually gets set to the max of
* the value here and the value of the inner table, elsewhere during reflow.
* @param aKidMaxElementSize the maxElementSize of aKidFrame, if available
*/
void PlaceChild(OuterTableReflowState& aReflowState,
nsIFrame* aKidFrame,
const nsRect& aKidRect,
nsSize* aMaxElementSize,
nsSize& aKidMaxElementSize);
nscoord GetTableWidth(const nsHTMLReflowState& aReflowState);
/** compute the width available to the table during reflow, based on
* the reflow state and the table's style.
* @return the computed width
*/
nscoord ComputeAvailableTableWidth(const nsHTMLReflowState& aReflowState);
/** overridden here to handle special caption-table relationship
* @see nsContainerFrame::VerifyTree
@ -118,39 +147,51 @@ protected:
PRBool DeleteChildsNextInFlow(nsIPresContext& aPresContext, nsIFrame* aChild);
// begin Incremental Reflow methods
/** prepare aReflowState for an incremental reflow */
NS_IMETHOD RecoverState(OuterTableReflowState& aReflowState, nsIFrame* aKidFrame);
/** process an incremental reflow command */
NS_IMETHOD IncrementalReflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
nsReflowStatus& aStatus);
/** process an incremental reflow command targeted at a child of this frame. */
NS_IMETHOD IR_TargetIsChild(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
nsReflowStatus& aStatus,
nsIFrame * aNextFrame);
/** process an incremental reflow command targeted at the table inner frame. */
NS_IMETHOD IR_TargetIsInnerTableFrame(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
nsReflowStatus& aStatus);
/** process an incremental reflow command targeted at the caption. */
NS_IMETHOD IR_TargetIsCaptionFrame(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
nsReflowStatus& aStatus);
/** process an incremental reflow command targeted at this frame.
* many incremental reflows that are targeted at this outer frame
* are actually handled by the inner frame. The logic to decide this
* is here.
*/
NS_IMETHOD IR_TargetIsMe(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
nsReflowStatus& aStatus);
/** pass along the incremental reflow command to the inner table. */
NS_IMETHOD IR_InnerTableReflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
nsReflowStatus& aStatus);
/** handle incremental reflow notification that a caption was inserted. */
NS_IMETHOD IR_CaptionInserted(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
@ -158,23 +199,23 @@ protected:
nsIFrame * aCaptionFrame,
PRBool aReplace);
/** handle incremental reflow notification that a caption was deleted. */
NS_IMETHOD IR_CaptionRemoved(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
OuterTableReflowState& aReflowState,
nsReflowStatus& aStatus);
/** handle incremental reflow notification that the caption style was changed
* such that it is now left|right instead of top|bottom, or vice versa.
*/
PRBool IR_CaptionChangedAxis(const nsStyleText* aOldStyle,
const nsStyleText* aNewStyle) const;
/** set the size and the location of both the inner table frame and the caption. */
NS_IMETHOD SizeAndPlaceChildren(const nsSize & aInnerSize,
const nsSize & aCaptionSize,
OuterTableReflowState& aReflowState);
NS_IMETHOD AdjustSiblingsAfterReflow(nsIPresContext& aPresContext,
OuterTableReflowState& aReflowState,
nsIFrame* aKidFrame,
nscoord aDeltaY);
// end Incremental Reflow methods
private: