diff --git a/layout/base/public/nsIFrame.h b/layout/base/public/nsIFrame.h index e8a6b725e20..b43cfa80f96 100644 --- a/layout/base/public/nsIFrame.h +++ b/layout/base/public/nsIFrame.h @@ -36,6 +36,9 @@ class nsIStyleContext; class nsIView; class nsIWidget; class nsIReflowCommand; +class nsIListFilter; +class nsAutoString; +class nsString; struct nsPoint; struct nsRect; @@ -620,9 +623,10 @@ public: NS_IMETHOD IsTransparent(PRBool& aTransparent) const = 0; // Debugging - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const= 0; + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const= 0; NS_IMETHOD ListTag(FILE* out = stdout) const = 0; NS_IMETHOD VerifyTree() const = 0; + static NS_LAYOUT nsIListFilter * GetFilter(nsString *aFilterName); /** * See if tree verification is enabled. To enable tree verification add @@ -735,4 +739,11 @@ inline nsReflowState::nsReflowState(nsIFrame* aFrame, minSize.height = 0; } +/* ----- nsIListFilter definition ----- */ +class nsIListFilter +{ + public: + virtual PRBool OutputTag(nsAutoString *aTag) const = 0; +}; + #endif /* nsIFrame_h___ */ diff --git a/layout/base/src/nsContainerFrame.cpp b/layout/base/src/nsContainerFrame.cpp index b08b0cdd935..e671c7521e9 100644 --- a/layout/base/src/nsContainerFrame.cpp +++ b/layout/base/src/nsContainerFrame.cpp @@ -949,48 +949,67 @@ void nsContainerFrame::AdjustOffsetOfEmptyNextInFlows() ///////////////////////////////////////////////////////////////////////////// // Debugging -NS_METHOD nsContainerFrame::List(FILE* out, PRInt32 aIndent) const +NS_METHOD nsContainerFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const { - // Indent - for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + // if a filter is present, only output this frame if the filter says we should + nsIAtom* tag; + nsAutoString tagString; + mContent->GetTag(tag); + if (tag != nsnull) + tag->ToString(tagString); + PRBool outputMe = (PRBool)((nsnull==aFilter) || ((PR_TRUE==aFilter->OutputTag(&tagString)) && (!IsPseudoFrame()))); + if (PR_TRUE==outputMe) + { + // Indent + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); - // Output the tag - ListTag(out); - nsIView* view; - GetView(view); - if (nsnull != view) { - fprintf(out, " [view=%p]", view); - } + // Output the tag + ListTag(out); + nsIView* view; + GetView(view); + if (nsnull != view) { + fprintf(out, " [view=%p]", view); + } - // Output the first/last content offset - fprintf(out, "[%d,%d,%c] ", mFirstContentOffset, mLastContentOffset, - (mLastContentIsComplete ? 'T' : 'F')); - if (nsnull != mPrevInFlow) { - fprintf(out, "prev-in-flow=%p ", mPrevInFlow); - } - if (nsnull != mNextInFlow) { - fprintf(out, "next-in-flow=%p ", mNextInFlow); - } + // Output the first/last content offset + fprintf(out, "[%d,%d,%c] ", mFirstContentOffset, mLastContentOffset, + (mLastContentIsComplete ? 'T' : 'F')); + if (nsnull != mPrevInFlow) { + fprintf(out, "prev-in-flow=%p ", mPrevInFlow); + } + if (nsnull != mNextInFlow) { + fprintf(out, "next-in-flow=%p ", mNextInFlow); + } - // Output the rect - out << mRect; + // Output the rect + out << mRect; + } // Output the children if (mChildCount > 0) { - if (0 != mState) { - fprintf(out, " [state=%08x]", mState); + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("<\n", out); } - fputs("<\n", out); for (nsIFrame* child = mFirstChild; child; NextChild(child, child)) { - child->List(out, aIndent + 1); + child->List(out, aIndent + 1, aFilter); + } + if (PR_TRUE==outputMe) + { + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + fputs(">\n", out); } - for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); - fputs(">\n", out); } else { - if (0 != mState) { - fprintf(out, " [state=%08x]", mState); + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("<>\n", out); } - fputs("<>\n", out); } return NS_OK; diff --git a/layout/base/src/nsContainerFrame.h b/layout/base/src/nsContainerFrame.h index 1e5794297cc..a93248173cf 100644 --- a/layout/base/src/nsContainerFrame.h +++ b/layout/base/src/nsContainerFrame.h @@ -174,7 +174,7 @@ public: PRBool IsPseudoFrame() const; // Debugging - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const; NS_IMETHOD ListTag(FILE* out = stdout) const; NS_IMETHOD VerifyTree() const; diff --git a/layout/base/src/nsFrame.cpp b/layout/base/src/nsFrame.cpp index 8458815daf9..b8efb0d609b 100644 --- a/layout/base/src/nsFrame.cpp +++ b/layout/base/src/nsFrame.cpp @@ -99,6 +99,70 @@ NS_LAYOUT PRBool nsIFrame::GetShowFrameBorders() return gShowFrameBorders; } +//////////////////////////////////////////////// +// Debug Listing Helper Class +//////////////////////////////////////////////// +class TableListFilter : public nsIListFilter +{ +private: + static char* kTagTable[]; + +public: + + TableListFilter() + {}; + + virtual ~TableListFilter() + {}; + + virtual PRBool OutputTag(nsAutoString *aTag) const + { + PRBool result = PR_FALSE; + if (nsnull!=aTag && 0!=aTag->Length()) + { + for (PRInt32 i=0; ; i++) + { + const char *tableTag = kTagTable[i]; + if (nsnull==tableTag) + break; + if (aTag->EqualsIgnoreCase(tableTag)) + { + result = PR_TRUE; + break; + } + } + } + return result; + }; + +}; + +char* TableListFilter::kTagTable[] = { + "table", + "tbody", "thead", "tfoot", + "tr", "td", "th", + "colgroup", "col", + //"caption", captions are left out because there's no caption frame + // to hang a decent output method on. + "" +}; + +NS_LAYOUT nsIListFilter * nsIFrame::GetFilter(nsString *aFilterName) +{ + nsIListFilter *result = nsnull; + if (nsnull!=aFilterName) + { + if (aFilterName->EqualsIgnoreCase("table")) + { + static nsIListFilter * tableListFilter; + if (nsnull==tableListFilter) + tableListFilter = new TableListFilter(); + result = tableListFilter; + } + } + return result; +} + /** * Note: the log module is created during library initialization which * means that you cannot perform logging before then. @@ -1389,22 +1453,34 @@ NS_METHOD nsFrame::IsTransparent(PRBool& aTransparent) const } // Debugging -NS_METHOD nsFrame::List(FILE* out, PRInt32 aIndent) const +NS_METHOD nsFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const { - // Indent - for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + // if a filter is present, only output this frame if the filter says we should + nsIAtom* tag; + nsAutoString tagString; + mContent->GetTag(tag); + if (tag != nsnull) + { + tag->ToString(tagString); + NS_RELEASE(tag); + } + if ((nsnull==aFilter) || (PR_TRUE==aFilter->OutputTag(&tagString))) + { + // Indent + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); - // Output the tag and rect - ListTag(out); - if (nsnull != mView) { - fprintf(out, " [view=%p]", mView); + // Output the tag and rect + ListTag(out); + if (nsnull != mView) { + fprintf(out, " [view=%p]", mView); + } + fputs(" ", out); + out << mRect; + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("<>\n", out); } - fputs(" ", out); - out << mRect; - if (0 != mState) { - fprintf(out, " [state=%08x]", mState); - } - fputs("<>\n", out); return NS_OK; } diff --git a/layout/base/src/nsFrame.h b/layout/base/src/nsFrame.h index cec25af08fd..91c17135806 100644 --- a/layout/base/src/nsFrame.h +++ b/layout/base/src/nsFrame.h @@ -201,7 +201,7 @@ public: NS_IMETHOD GetNextSibling(nsIFrame*& aNextSibling) const; NS_IMETHOD SetNextSibling(nsIFrame* aNextSibling); NS_IMETHOD IsTransparent(PRBool& aTransparent) const; - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const; NS_IMETHOD ListTag(FILE* out = stdout) const; NS_IMETHOD VerifyTree() const; diff --git a/layout/css/layout/src/nsCSSBlockFrame.cpp b/layout/css/layout/src/nsCSSBlockFrame.cpp index 388477c93f6..5825d57e539 100644 --- a/layout/css/layout/src/nsCSSBlockFrame.cpp +++ b/layout/css/layout/src/nsCSSBlockFrame.cpp @@ -77,6 +77,8 @@ // XXX Tuneup: if mNoWrap is true and we are given a ResizeReflow we // can just return because there's nothing to do!; this is true in // nsCSSInlineFrame too! +// Except that noWrap is ignored if the containers width is too small +// (like a table cell with a fixed width.) //---------------------------------------------------------------------- // XXX It's really important that blocks strip out extra whitespace; @@ -144,7 +146,7 @@ public: NS_IMETHOD DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus); #endif - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; + NS_IMETHOD List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter = nsnull) const; NS_IMETHOD ListTag(FILE* out) const; NS_IMETHOD VerifyTree() const; // XXX implement regular reflow method too! @@ -302,7 +304,8 @@ struct LineData { ~LineData(); - void List(FILE* out, PRInt32 aIndent) const; + void List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter = nsnull, + PRBool aOutputMe=PR_TRUE) const; nsIFrame* LastChild() const; @@ -432,30 +435,39 @@ LineData::StateToString(char* aBuf, PRInt32 aBufSize) const } void -LineData::List(FILE* out, PRInt32 aIndent) const +LineData::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter, + PRBool aOutputMe) const { + // if a filter is present, only output this frame if the filter says we should PRInt32 i; - for (i = aIndent; --i >= 0; ) fputs(" ", out); - char cbuf[100]; - fprintf(out, "line %p: count=%d state=%s {%d,%d,%d,%d} ibm=%d obm=%d <\n", - this, mChildCount, StateToString(cbuf, sizeof(cbuf)), - mBounds.x, mBounds.y, mBounds.width, mBounds.height, - mInnerBottomMargin, mOuterBottomMargin); + + if (PR_TRUE==aOutputMe) + { + for (i = aIndent; --i >= 0; ) fputs(" ", out); + char cbuf[100]; + fprintf(out, "line %p: count=%d state=%s {%d,%d,%d,%d} ibm=%d obm=%d <\n", + this, mChildCount, StateToString(cbuf, sizeof(cbuf)), + mBounds.x, mBounds.y, mBounds.width, mBounds.height, + mInnerBottomMargin, mOuterBottomMargin); + } nsIFrame* frame = mFirstChild; PRInt32 n = mChildCount; while (--n >= 0) { - frame->List(out, aIndent + 1); + frame->List(out, aIndent + 1, aFilter); frame->GetNextSibling(frame); } - for (i = aIndent; --i >= 0; ) fputs(" ", out); + if (PR_TRUE==aOutputMe) + { + for (i = aIndent; --i >= 0; ) fputs(" ", out); - if (nsnull != mFloaters) { - fputs("> bcl-floaters=<", out); - ListFloaters(out, mFloaters); + if (nsnull != mFloaters) { + fputs("> bcl-floaters=<", out); + ListFloaters(out, mFloaters); + } + fputs(">\n", out); } - fputs(">\n", out); } nsIFrame* @@ -1053,73 +1065,95 @@ nsCSSBlockFrame::ListTag(FILE* out) const } NS_METHOD -nsCSSBlockFrame::List(FILE* out, PRInt32 aIndent) const +nsCSSBlockFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const { + // if a filter is present, only output this frame if the filter says we should + nsIAtom* tag; + nsAutoString tagString; + mContent->GetTag(tag); + if (tag != nsnull) + { + tag->ToString(tagString); + NS_RELEASE(tag); + } + PRInt32 i; - - // Indent - for (i = aIndent; --i >= 0; ) fputs(" ", out); - - // Output the tag - ListTag(out); - nsIView* view; - GetView(view); - if (nsnull != view) { - fprintf(out, " [view=%p]", view); - } - - // Output the first/last content offset - fprintf(out, "[%d,%d,%c] ", - GetFirstContentOffset(), GetLastContentOffset(), - (GetLastContentIsComplete() ? 'T' : 'F')); - if (nsnull != mPrevInFlow) { - fprintf(out, "prev-in-flow=%p ", mPrevInFlow); - } - if (nsnull != mNextInFlow) { - fprintf(out, "next-in-flow=%p ", mNextInFlow); - } - - // Output the rect and state - out << mRect; - if (0 != mState) { - fprintf(out, " [state=%08x]", mState); - } - -#if XXX - // Dump run-in floaters - if (nsnull != mRunInFloaters) { - fputs(" run-in-floaters=<", out); - ListFloaters(out, mRunInFloaters); + PRBool outputMe = (PRBool)((nsnull==aFilter) || ((PR_TRUE==aFilter->OutputTag(&tagString)) && (!IsPseudoFrame()))); + if (PR_TRUE==outputMe) + { + // Indent for (i = aIndent; --i >= 0; ) fputs(" ", out); - fputs(">", out); + + // Output the tag + ListTag(out); + nsIView* view; + GetView(view); + if (nsnull != view) { + fprintf(out, " [view=%p]", view); + } + + // Output the first/last content offset + fprintf(out, "[%d,%d,%c] ", + GetFirstContentOffset(), GetLastContentOffset(), + (GetLastContentIsComplete() ? 'T' : 'F')); + if (nsnull != mPrevInFlow) { + fprintf(out, "prev-in-flow=%p ", mPrevInFlow); + } + if (nsnull != mNextInFlow) { + fprintf(out, "next-in-flow=%p ", mNextInFlow); + } + + // Output the rect and state + out << mRect; + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + + #if XXX + // Dump run-in floaters + if (nsnull != mRunInFloaters) { + fputs(" run-in-floaters=<", out); + ListFloaters(out, mRunInFloaters); + for (i = aIndent; --i >= 0; ) fputs(" ", out); + fputs(">", out); + } + #endif } -#endif + // Output the children, one line at a time if (nsnull != mLines) { - fputs("<\n", out); + if (PR_TRUE==outputMe) + fputs("<\n", out); aIndent++; LineData* line = mLines; while (nsnull != line) { - line->List(out, aIndent); + line->List(out, aIndent, aFilter, outputMe); line = line->mNext; } aIndent--; - for (i = aIndent; --i >= 0; ) fputs(" ", out); - fputs(">", out); + if (PR_TRUE==outputMe) + { + for (i = aIndent; --i >= 0; ) fputs(" ", out); + fputs(">", out); + } } else { - fputs("<>", out); + if (PR_TRUE==outputMe) + fputs("<>", out); } - // Output the text-runs - if (nsnull != mTextRuns) { - fputs(" text-runs=<\n", out); - ListTextRuns(out, aIndent + 1, mTextRuns); - for (i = aIndent; --i >= 0; ) fputs(" ", out); - fputs(">", out); + if (PR_TRUE==outputMe) + { + // Output the text-runs + if (nsnull != mTextRuns) { + fputs(" text-runs=<\n", out); + ListTextRuns(out, aIndent + 1, mTextRuns); + for (i = aIndent; --i >= 0; ) fputs(" ", out); + fputs(">", out); + } + fputs("\n", out); } - fputs("\n", out); return NS_OK; } diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index e8a6b725e20..b43cfa80f96 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -36,6 +36,9 @@ class nsIStyleContext; class nsIView; class nsIWidget; class nsIReflowCommand; +class nsIListFilter; +class nsAutoString; +class nsString; struct nsPoint; struct nsRect; @@ -620,9 +623,10 @@ public: NS_IMETHOD IsTransparent(PRBool& aTransparent) const = 0; // Debugging - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const= 0; + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const= 0; NS_IMETHOD ListTag(FILE* out = stdout) const = 0; NS_IMETHOD VerifyTree() const = 0; + static NS_LAYOUT nsIListFilter * GetFilter(nsString *aFilterName); /** * See if tree verification is enabled. To enable tree verification add @@ -735,4 +739,11 @@ inline nsReflowState::nsReflowState(nsIFrame* aFrame, minSize.height = 0; } +/* ----- nsIListFilter definition ----- */ +class nsIListFilter +{ + public: + virtual PRBool OutputTag(nsAutoString *aTag) const = 0; +}; + #endif /* nsIFrame_h___ */ diff --git a/layout/html/table/src/BasicTableLayoutStrategy.h b/layout/html/table/src/BasicTableLayoutStrategy.h index efc59c43550..1f83b9c9300 100644 --- a/layout/html/table/src/BasicTableLayoutStrategy.h +++ b/layout/html/table/src/BasicTableLayoutStrategy.h @@ -92,7 +92,12 @@ public: const nsReflowState& aReflowState, nscoord aMaxWidth); + // these accessors are mostly for debugging purposes + nscoord GetTableMinWidth() const; nscoord GetTableMaxWidth() const; + nscoord GetTableFixedWidth() const; + nscoord GetCOLSAttribute() const; + nscoord GetNumCols() const; protected: @@ -253,8 +258,22 @@ protected: }; +// these accessors are mostly for debugging purposes +inline nscoord BasicTableLayoutStrategy::GetTableMinWidth() const +{ return mMinTableWidth; }; + inline nscoord BasicTableLayoutStrategy::GetTableMaxWidth() const { return mMaxTableWidth; }; +inline nscoord BasicTableLayoutStrategy::GetTableFixedWidth() const +{ return mFixedTableWidth; }; + +inline nscoord BasicTableLayoutStrategy::GetCOLSAttribute() const +{ return mCols; }; + +inline nscoord BasicTableLayoutStrategy::GetNumCols() const +{ return mNumCols; }; + + #endif diff --git a/layout/html/table/src/nsITableLayoutStrategy.h b/layout/html/table/src/nsITableLayoutStrategy.h index 77bb1986c2c..c35bec0c9ae 100644 --- a/layout/html/table/src/nsITableLayoutStrategy.h +++ b/layout/html/table/src/nsITableLayoutStrategy.h @@ -53,6 +53,26 @@ public: */ virtual nscoord GetTableMaxWidth() const = 0; + /** return the computed minimum possible size of the table. + * this is the sum of the minimum sizes of the content taking into account table + * attributes, but NOT factoring in the available size the table is laying out into. + * the actual table width in a given situation will depend on the available size + * provided by the parent (especially for percent-width tables.) + */ + virtual nscoord GetTableMinWidth() const = 0; + + /** return the portion of the table width that is specified as "fixed" aka + * the amount of table width that does not vary with available width or other + * inputs to the table balancing algorithm. + */ + virtual nscoord GetTableFixedWidth() const = 0; + + /** return the value of the COLS attribute, used for balancing column widths */ + virtual nscoord GetCOLSAttribute() const = 0; + + /** return the total number of columns in the table */ + virtual nscoord GetNumCols() const = 0; + }; #endif diff --git a/layout/html/table/src/nsTableCellFrame.cpp b/layout/html/table/src/nsTableCellFrame.cpp index 1afef9e0cbd..1a0c8725cc7 100644 --- a/layout/html/table/src/nsTableCellFrame.cpp +++ b/layout/html/table/src/nsTableCellFrame.cpp @@ -1030,48 +1030,138 @@ void nsTableCellFrame::RecalcLayoutData(nsTableFrame* aTableFrame, mCalculated = NS_OK; } +/* ----- debugging methods ----- */ +NS_METHOD nsTableCellFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const +{ + // if a filter is present, only output this frame if the filter says we should + // since this could be any "tag" with the right display type, we'll + // just pretend it's a cell + if (nsnull==aFilter) + return nsContainerFrame::List(out, aIndent, aFilter); + + nsAutoString tagString("td"); + PRBool outputMe = aFilter->OutputTag(&tagString); + if (PR_TRUE==outputMe) + { + // Indent + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + + // Output the tag and rect + nsIAtom* tag; + mContent->GetTag(tag); + if (tag != nsnull) { + nsAutoString buf; + tag->ToString(buf); + fputs(buf, out); + NS_RELEASE(tag); + } + PRInt32 contentIndex; + + GetContentIndex(contentIndex); + fprintf(out, "(%d)", contentIndex); + out << mRect; + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("\n", out); + } + // Output the children + if (mChildCount > 0) { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + for (nsIFrame* child = mFirstChild; child; NextChild(child, child)) { + child->List(out, aIndent + 1, aFilter); + } + } else { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + } + return NS_OK; +} + #if 0 //QQQ void nsTableCellFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const { - PRInt32 indent; - - nsIContent* cell; - - this->GetContent(cell); - if (cell != nsnull) +// if a filter is present, only output this frame if the filter says we should + nsIAtom* tag; + nsAutoString tagString; + mContent->GetTag(tag); + if (tag != nsnull) + tag->ToString(tagString); + if ((nsnull==aFilter) || (PR_TRUE==aFilter->OutputTag(&tagString))) { - /* - for (indent = aIndent; --indent >= 0; ) fputs(" ", out); - fprintf(out,"RowSpan = %d ColSpan = %d \n",cell->GetRowSpan(),cell->GetColSpan()); - */ - for (indent = aIndent; --indent >= 0; ) fputs(" ", out); - fprintf(out,"Margin -- Top: %d Left: %d Bottom: %d Right: %d \n", - NSTwipsToIntPoints(mMargin.top), - NSTwipsToIntPoints(mMargin.left), - NSTwipsToIntPoints(mMargin.bottom), - NSTwipsToIntPoints(mMargin.right)); + PRInt32 indent; + + nsIContent* cell; + + this->GetContent(cell); + if (cell != nsnull) + { + /* + for (indent = aIndent; --indent >= 0; ) fputs(" ", out); + fprintf(out,"RowSpan = %d ColSpan = %d \n",cell->GetRowSpan(),cell->GetColSpan()); + */ + for (indent = aIndent; --indent >= 0; ) fputs(" ", out); + fprintf(out,"Margin -- Top: %d Left: %d Bottom: %d Right: %d \n", + NSTwipsToIntPoints(mMargin.top), + NSTwipsToIntPoints(mMargin.left), + NSTwipsToIntPoints(mMargin.bottom), + NSTwipsToIntPoints(mMargin.right)); - for (indent = aIndent; --indent >= 0; ) fputs(" ", out); + for (indent = aIndent; --indent >= 0; ) fputs(" ", out); - nscoord top,left,bottom,right; + nscoord top,left,bottom,right; - top = (mBorderFrame[NS_SIDE_TOP] ? GetBorderWidth((nsIFrame*)mBorderFrame[NS_SIDE_TOP], NS_SIDE_TOP) : 0); - left = (mBorderFrame[NS_SIDE_LEFT] ? GetBorderWidth((nsIFrame*)mBorderFrame[NS_SIDE_LEFT], NS_SIDE_LEFT) : 0); - bottom = (mBorderFrame[NS_SIDE_BOTTOM] ? GetBorderWidth((nsIFrame*)mBorderFrame[NS_SIDE_BOTTOM], NS_SIDE_BOTTOM) : 0); - right = (mBorderFrame[NS_SIDE_RIGHT] ? GetBorderWidth((nsIFrame*)mBorderFrame[NS_SIDE_RIGHT], NS_SIDE_RIGHT) : 0); + top = (mBorderFrame[NS_SIDE_TOP] ? GetBorderWidth((nsIFrame*)mBorderFrame[NS_SIDE_TOP], NS_SIDE_TOP) : 0); + left = (mBorderFrame[NS_SIDE_LEFT] ? GetBorderWidth((nsIFrame*)mBorderFrame[NS_SIDE_LEFT], NS_SIDE_LEFT) : 0); + bottom = (mBorderFrame[NS_SIDE_BOTTOM] ? GetBorderWidth((nsIFrame*)mBorderFrame[NS_SIDE_BOTTOM], NS_SIDE_BOTTOM) : 0); + right = (mBorderFrame[NS_SIDE_RIGHT] ? GetBorderWidth((nsIFrame*)mBorderFrame[NS_SIDE_RIGHT], NS_SIDE_RIGHT) : 0); - fprintf(out,"Border -- Top: %d Left: %d Bottom: %d Right: %d \n", - NSTwipsToIntPoints(top), - NSTwipsToIntPoints(left), - NSTwipsToIntPoints(bottom), - NSTwipsToIntPoints(right)); + fprintf(out,"Border -- Top: %d Left: %d Bottom: %d Right: %d \n", + NSTwipsToIntPoints(top), + NSTwipsToIntPoints(left), + NSTwipsToIntPoints(bottom), + NSTwipsToIntPoints(right)); - cell->List(out,aIndent); - NS_RELEASE(cell); + cell->List(out,aIndent); + NS_RELEASE(cell); + } + } + + // Output the children + if (mChildCount > 0) { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + } + for (nsIFrame* child = mFirstChild; child; NextChild(child, child)) { + child->List(out, aIndent + 1, aFilter); + } + if (PR_TRUE==outputMe) + { + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + } + } else { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + } } } diff --git a/layout/html/table/src/nsTableCellFrame.h b/layout/html/table/src/nsTableCellFrame.h index 04b5cd9dc20..c6b99bee5f9 100644 --- a/layout/html/table/src/nsTableCellFrame.h +++ b/layout/html/table/src/nsTableCellFrame.h @@ -185,6 +185,8 @@ private: void CalculateMargins(nsTableFrame* aTableFrame, nsVoidArray* aBoundaryCells[4]); + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const; + protected: /** protected constructor. diff --git a/layout/html/table/src/nsTableColFrame.cpp b/layout/html/table/src/nsTableColFrame.cpp index f6e9faad98b..bfe76797dc7 100644 --- a/layout/html/table/src/nsTableColFrame.cpp +++ b/layout/html/table/src/nsTableColFrame.cpp @@ -97,3 +97,40 @@ nsresult nsTableColFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } +/* ----- debugging methods ----- */ +NS_METHOD nsTableColFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const +{ + // if a filter is present, only output this frame if the filter says we should + // since this could be any "tag" with the right display type, we'll + // just pretend it's a cell + if (nsnull==aFilter) + return nsFrame::List(out, aIndent, aFilter); + + nsAutoString tagString("col"); + if (PR_TRUE==aFilter->OutputTag(&tagString)) + { + // Indent + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + + // Output the tag and rect + nsIAtom* tag; + mContent->GetTag(tag); + if (tag != nsnull) { + nsAutoString buf; + tag->ToString(buf); + fputs(buf, out); + NS_RELEASE(tag); + } + PRInt32 contentIndex; + + GetContentIndex(contentIndex); + fprintf(out, "(%d)", contentIndex); + out << mRect; + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("\n", out); + } + + return NS_OK; +} \ No newline at end of file diff --git a/layout/html/table/src/nsTableColFrame.h b/layout/html/table/src/nsTableColFrame.h index fda51866ddb..3f0ad33873c 100644 --- a/layout/html/table/src/nsTableColFrame.h +++ b/layout/html/table/src/nsTableColFrame.h @@ -77,6 +77,8 @@ public: /** convenience method, calls into cellmap */ PRInt32 Count() const; + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const; + protected: nsTableColFrame(nsIContent* aContent, nsIFrame* aParentFrame); diff --git a/layout/html/table/src/nsTableColGroupFrame.cpp b/layout/html/table/src/nsTableColGroupFrame.cpp index b6f1910cdea..ffaa97e7551 100644 --- a/layout/html/table/src/nsTableColGroupFrame.cpp +++ b/layout/html/table/src/nsTableColGroupFrame.cpp @@ -256,4 +256,61 @@ nsresult nsTableColGroupFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } +/* ----- debugging methods ----- */ +NS_METHOD nsTableColGroupFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const +{ + // if a filter is present, only output this frame if the filter says we should + // since this could be any "tag" with the right display type, we'll + // just pretend it's a colgroup + if (nsnull==aFilter) + return nsContainerFrame::List(out, aIndent, aFilter); + + nsAutoString tagString("colgroup"); + PRBool outputMe = aFilter->OutputTag(&tagString); + if (PR_TRUE==outputMe) + { + // Indent + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + + // Output the tag and rect + nsIAtom* tag; + mContent->GetTag(tag); + if (tag != nsnull) { + nsAutoString buf; + tag->ToString(buf); + fputs(buf, out); + NS_RELEASE(tag); + } + PRInt32 contentIndex; + + GetContentIndex(contentIndex); + fprintf(out, "(%d)", contentIndex); + out << mRect; + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("\n", out); + } + // Output the children + if (mChildCount > 0) { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + for (nsIFrame* child = mFirstChild; child; NextChild(child, child)) { + child->List(out, aIndent + 1, aFilter); + } + } else { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + } + return NS_OK; +} + diff --git a/layout/html/table/src/nsTableColGroupFrame.h b/layout/html/table/src/nsTableColGroupFrame.h index cc951f6c292..d98eb7b5ad7 100644 --- a/layout/html/table/src/nsTableColGroupFrame.h +++ b/layout/html/table/src/nsTableColGroupFrame.h @@ -60,6 +60,8 @@ public: virtual void SetStartColumnIndex (PRInt32 aIndex); + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const; + protected: nsTableColGroupFrame(nsIContent* aContent, nsIFrame* aParentFrame); diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index aae92adcfad..1088d407c70 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -3463,3 +3463,70 @@ PRBool nsTableFrame::TableIsAutoWidth(nsTableFrame *aTableFrame, return result; } +/* ----- debugging methods ----- */ +NS_METHOD nsTableFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const +{ + // if a filter is present, only output this frame if the filter says we should + // since this could be any "tag" with the right display type, we'll + // just pretend it's a table + if (nsnull==aFilter) + return nsContainerFrame::List(out, aIndent, aFilter); + + nsAutoString tagString("table"); + PRBool outputMe = aFilter->OutputTag(&tagString); + if (PR_TRUE==outputMe) + { + // Indent + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + + // Output the tag and rect + nsIAtom* tag; + mContent->GetTag(tag); + if (tag != nsnull) { + nsAutoString buf; + tag->ToString(buf); + fputs(buf, out); + NS_RELEASE(tag); + } + PRInt32 contentIndex; + + GetContentIndex(contentIndex); + fprintf(out, "(%d)", contentIndex); + out << mRect; + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("\n", out); + if (nsnull!=mTableLayoutStrategy) + { + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + fprintf(out, "min=%d, max=%d, fixed=%d, cols=%d, numCols=%d\n", + mTableLayoutStrategy->GetTableMinWidth(), + mTableLayoutStrategy->GetTableMaxWidth(), + mTableLayoutStrategy->GetTableFixedWidth(), + mTableLayoutStrategy->GetCOLSAttribute(), + mTableLayoutStrategy->GetNumCols() + ); + } + } + // Output the children + if (mChildCount > 0) { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + for (nsIFrame* child = mFirstChild; child; NextChild(child, child)) { + child->List(out, aIndent + 1, aFilter); + } + } else { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + } + return NS_OK; +} diff --git a/layout/html/table/src/nsTableFrame.h b/layout/html/table/src/nsTableFrame.h index fdc8caafbad..029385a74ca 100644 --- a/layout/html/table/src/nsTableFrame.h +++ b/layout/html/table/src/nsTableFrame.h @@ -233,6 +233,8 @@ public: virtual void AddColumnFrame (nsTableColFrame *aColFrame); + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const; + protected: /** protected constructor. diff --git a/layout/html/table/src/nsTableOuterFrame.cpp b/layout/html/table/src/nsTableOuterFrame.cpp index 09e955bb369..ac39911bb94 100644 --- a/layout/html/table/src/nsTableOuterFrame.cpp +++ b/layout/html/table/src/nsTableOuterFrame.cpp @@ -866,3 +866,61 @@ nsresult nsTableOuterFrame::NewFrame(nsIFrame** aInstancePtrResult, *aInstancePtrResult = it; return NS_OK; } + +/* ----- debugging methods ----- */ +NS_METHOD nsTableOuterFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const +{ + // if a filter is present, only output this frame if the filter says we should + // since this could be any "tag" with the right display type, we'll + // just pretend it's a tbody + if (nsnull==aFilter) + return nsContainerFrame::List(out, aIndent, aFilter); + + nsAutoString tagString("tbody"); + PRBool outputMe = aFilter->OutputTag(&tagString); + if (PR_TRUE==outputMe) + { + // Indent + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + + // Output the tag and rect + nsIAtom* tag; + mContent->GetTag(tag); + if (tag != nsnull) { + nsAutoString buf; + tag->ToString(buf); + fputs(buf, out); + NS_RELEASE(tag); + } + PRInt32 contentIndex; + + GetContentIndex(contentIndex); + fprintf(out, "(%d)", contentIndex); + out << mRect; + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("\n", out); + } + // Output the children + if (mChildCount > 0) { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + for (nsIFrame* child = mFirstChild; child; NextChild(child, child)) { + child->List(out, aIndent + 1, aFilter); + } + } else { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + } + return NS_OK; +} + diff --git a/layout/html/table/src/nsTableOuterFrame.h b/layout/html/table/src/nsTableOuterFrame.h index cc3b17ef123..43a22d09721 100644 --- a/layout/html/table/src/nsTableOuterFrame.h +++ b/layout/html/table/src/nsTableOuterFrame.h @@ -65,6 +65,8 @@ public: nsIStyleContext* aStyleContext, nsIFrame*& aContinuingFrame); + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const; + protected: /** protected constructor diff --git a/layout/html/table/src/nsTableRowFrame.cpp b/layout/html/table/src/nsTableRowFrame.cpp index 6df4f2c956b..02f8165840f 100644 --- a/layout/html/table/src/nsTableRowFrame.cpp +++ b/layout/html/table/src/nsTableRowFrame.cpp @@ -1005,3 +1005,61 @@ nsresult nsTableRowFrame::NewFrame( nsIFrame** aInstancePtrResult, return NS_OK; } +/* ----- debugging methods ----- */ +NS_METHOD nsTableRowFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const +{ + // if a filter is present, only output this frame if the filter says we should + // since this could be any "tag" with the right display type, we'll + // just pretend it's a row + if (nsnull==aFilter) + return nsContainerFrame::List(out, aIndent, aFilter); + + nsAutoString tagString("tr"); + PRBool outputMe = aFilter->OutputTag(&tagString); + if (PR_TRUE==outputMe) + { + // Indent + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + + // Output the tag and rect + nsIAtom* tag; + mContent->GetTag(tag); + if (tag != nsnull) { + nsAutoString buf; + tag->ToString(buf); + fputs(buf, out); + NS_RELEASE(tag); + } + PRInt32 contentIndex; + + GetContentIndex(contentIndex); + fprintf(out, "(%d)", contentIndex); + out << mRect; + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("\n", out); + } + // Output the children + if (mChildCount > 0) { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + for (nsIFrame* child = mFirstChild; child; NextChild(child, child)) { + child->List(out, aIndent + 1, aFilter); + } + } else { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + } + return NS_OK; +} + + diff --git a/layout/html/table/src/nsTableRowFrame.h b/layout/html/table/src/nsTableRowFrame.h index 9cd9aa8dc0b..db8e4adf89c 100644 --- a/layout/html/table/src/nsTableRowFrame.h +++ b/layout/html/table/src/nsTableRowFrame.h @@ -111,6 +111,8 @@ public: /** set this row's starting row index */ virtual void SetRowIndex (int aRowIndex); + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const; + protected: /** protected constructor. diff --git a/layout/html/table/src/nsTableRowGroupFrame.cpp b/layout/html/table/src/nsTableRowGroupFrame.cpp index d143ed3a3d8..36075015e83 100644 --- a/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -1210,45 +1210,68 @@ nsresult nsTableRowGroupFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } - - - -// For Debugging ONLY -NS_METHOD nsTableRowGroupFrame::MoveTo(nscoord aX, nscoord aY) +/* ----- debugging methods ----- */ +NS_METHOD nsTableRowGroupFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const { - if ((aX != mRect.x) || (aY != mRect.y)) { - mRect.x = aX; - mRect.y = aY; + // if a filter is present, only output this frame if the filter says we should + // since this could be any "tag" with the right display type, we'll + // just pretend it's a tbody + if (nsnull==aFilter) + return nsContainerFrame::List(out, aIndent, aFilter); - nsIView* view; - GetView(view); + nsAutoString tagString("tbody"); + PRBool outputMe = aFilter->OutputTag(&tagString); + if (PR_TRUE==outputMe) + { + // Indent + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); - // Let the view know - if (nsnull != view) { - // Position view relative to it's parent, not relative to our - // parent frame (our parent frame may not have a view). - nsIView* parentWithView; - nsPoint origin; - GetOffsetFromView(origin, parentWithView); - view->SetPosition(origin.x, origin.y); + // Output the tag and rect + nsIAtom* tag; + mContent->GetTag(tag); + if (tag != nsnull) { + nsAutoString buf; + tag->ToString(buf); + fputs(buf, out); + NS_RELEASE(tag); + } + PRInt32 contentIndex; + + GetContentIndex(contentIndex); + fprintf(out, "(%d)", contentIndex); + out << mRect; + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("\n", out); + } + + // Output the children + if (mChildCount > 0) { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + for (nsIFrame* child = mFirstChild; child; NextChild(child, child)) { + child->List(out, aIndent + 1, aFilter); + } + } else { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } } } + return NS_OK; } -NS_METHOD nsTableRowGroupFrame::SizeTo(nscoord aWidth, nscoord aHeight) -{ - mRect.width = aWidth; - mRect.height = aHeight; - nsIView* view; - GetView(view); - // Let the view know - if (nsnull != view) { - view->SetDimensions(aWidth, aHeight); - } - return NS_OK; -} + + diff --git a/layout/html/table/src/nsTableRowGroupFrame.h b/layout/html/table/src/nsTableRowGroupFrame.h index 876765538a6..996cc89ecfb 100644 --- a/layout/html/table/src/nsTableRowGroupFrame.h +++ b/layout/html/table/src/nsTableRowGroupFrame.h @@ -94,9 +94,8 @@ public: /** return the number of contained rows */ PRInt32 GetRowCount (); - // For DEBUGGING Purposes Only - NS_IMETHOD MoveTo(nscoord aX, nscoord aY); - NS_IMETHOD SizeTo(nscoord aWidth, nscoord aHeight); + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const; + protected: diff --git a/layout/tables/BasicTableLayoutStrategy.h b/layout/tables/BasicTableLayoutStrategy.h index efc59c43550..1f83b9c9300 100644 --- a/layout/tables/BasicTableLayoutStrategy.h +++ b/layout/tables/BasicTableLayoutStrategy.h @@ -92,7 +92,12 @@ public: const nsReflowState& aReflowState, nscoord aMaxWidth); + // these accessors are mostly for debugging purposes + nscoord GetTableMinWidth() const; nscoord GetTableMaxWidth() const; + nscoord GetTableFixedWidth() const; + nscoord GetCOLSAttribute() const; + nscoord GetNumCols() const; protected: @@ -253,8 +258,22 @@ protected: }; +// these accessors are mostly for debugging purposes +inline nscoord BasicTableLayoutStrategy::GetTableMinWidth() const +{ return mMinTableWidth; }; + inline nscoord BasicTableLayoutStrategy::GetTableMaxWidth() const { return mMaxTableWidth; }; +inline nscoord BasicTableLayoutStrategy::GetTableFixedWidth() const +{ return mFixedTableWidth; }; + +inline nscoord BasicTableLayoutStrategy::GetCOLSAttribute() const +{ return mCols; }; + +inline nscoord BasicTableLayoutStrategy::GetNumCols() const +{ return mNumCols; }; + + #endif diff --git a/layout/tables/nsITableLayoutStrategy.h b/layout/tables/nsITableLayoutStrategy.h index 77bb1986c2c..c35bec0c9ae 100644 --- a/layout/tables/nsITableLayoutStrategy.h +++ b/layout/tables/nsITableLayoutStrategy.h @@ -53,6 +53,26 @@ public: */ virtual nscoord GetTableMaxWidth() const = 0; + /** return the computed minimum possible size of the table. + * this is the sum of the minimum sizes of the content taking into account table + * attributes, but NOT factoring in the available size the table is laying out into. + * the actual table width in a given situation will depend on the available size + * provided by the parent (especially for percent-width tables.) + */ + virtual nscoord GetTableMinWidth() const = 0; + + /** return the portion of the table width that is specified as "fixed" aka + * the amount of table width that does not vary with available width or other + * inputs to the table balancing algorithm. + */ + virtual nscoord GetTableFixedWidth() const = 0; + + /** return the value of the COLS attribute, used for balancing column widths */ + virtual nscoord GetCOLSAttribute() const = 0; + + /** return the total number of columns in the table */ + virtual nscoord GetNumCols() const = 0; + }; #endif diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index 1afef9e0cbd..1a0c8725cc7 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -1030,48 +1030,138 @@ void nsTableCellFrame::RecalcLayoutData(nsTableFrame* aTableFrame, mCalculated = NS_OK; } +/* ----- debugging methods ----- */ +NS_METHOD nsTableCellFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const +{ + // if a filter is present, only output this frame if the filter says we should + // since this could be any "tag" with the right display type, we'll + // just pretend it's a cell + if (nsnull==aFilter) + return nsContainerFrame::List(out, aIndent, aFilter); + + nsAutoString tagString("td"); + PRBool outputMe = aFilter->OutputTag(&tagString); + if (PR_TRUE==outputMe) + { + // Indent + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + + // Output the tag and rect + nsIAtom* tag; + mContent->GetTag(tag); + if (tag != nsnull) { + nsAutoString buf; + tag->ToString(buf); + fputs(buf, out); + NS_RELEASE(tag); + } + PRInt32 contentIndex; + + GetContentIndex(contentIndex); + fprintf(out, "(%d)", contentIndex); + out << mRect; + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("\n", out); + } + // Output the children + if (mChildCount > 0) { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + for (nsIFrame* child = mFirstChild; child; NextChild(child, child)) { + child->List(out, aIndent + 1, aFilter); + } + } else { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + } + return NS_OK; +} + #if 0 //QQQ void nsTableCellFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const { - PRInt32 indent; - - nsIContent* cell; - - this->GetContent(cell); - if (cell != nsnull) +// if a filter is present, only output this frame if the filter says we should + nsIAtom* tag; + nsAutoString tagString; + mContent->GetTag(tag); + if (tag != nsnull) + tag->ToString(tagString); + if ((nsnull==aFilter) || (PR_TRUE==aFilter->OutputTag(&tagString))) { - /* - for (indent = aIndent; --indent >= 0; ) fputs(" ", out); - fprintf(out,"RowSpan = %d ColSpan = %d \n",cell->GetRowSpan(),cell->GetColSpan()); - */ - for (indent = aIndent; --indent >= 0; ) fputs(" ", out); - fprintf(out,"Margin -- Top: %d Left: %d Bottom: %d Right: %d \n", - NSTwipsToIntPoints(mMargin.top), - NSTwipsToIntPoints(mMargin.left), - NSTwipsToIntPoints(mMargin.bottom), - NSTwipsToIntPoints(mMargin.right)); + PRInt32 indent; + + nsIContent* cell; + + this->GetContent(cell); + if (cell != nsnull) + { + /* + for (indent = aIndent; --indent >= 0; ) fputs(" ", out); + fprintf(out,"RowSpan = %d ColSpan = %d \n",cell->GetRowSpan(),cell->GetColSpan()); + */ + for (indent = aIndent; --indent >= 0; ) fputs(" ", out); + fprintf(out,"Margin -- Top: %d Left: %d Bottom: %d Right: %d \n", + NSTwipsToIntPoints(mMargin.top), + NSTwipsToIntPoints(mMargin.left), + NSTwipsToIntPoints(mMargin.bottom), + NSTwipsToIntPoints(mMargin.right)); - for (indent = aIndent; --indent >= 0; ) fputs(" ", out); + for (indent = aIndent; --indent >= 0; ) fputs(" ", out); - nscoord top,left,bottom,right; + nscoord top,left,bottom,right; - top = (mBorderFrame[NS_SIDE_TOP] ? GetBorderWidth((nsIFrame*)mBorderFrame[NS_SIDE_TOP], NS_SIDE_TOP) : 0); - left = (mBorderFrame[NS_SIDE_LEFT] ? GetBorderWidth((nsIFrame*)mBorderFrame[NS_SIDE_LEFT], NS_SIDE_LEFT) : 0); - bottom = (mBorderFrame[NS_SIDE_BOTTOM] ? GetBorderWidth((nsIFrame*)mBorderFrame[NS_SIDE_BOTTOM], NS_SIDE_BOTTOM) : 0); - right = (mBorderFrame[NS_SIDE_RIGHT] ? GetBorderWidth((nsIFrame*)mBorderFrame[NS_SIDE_RIGHT], NS_SIDE_RIGHT) : 0); + top = (mBorderFrame[NS_SIDE_TOP] ? GetBorderWidth((nsIFrame*)mBorderFrame[NS_SIDE_TOP], NS_SIDE_TOP) : 0); + left = (mBorderFrame[NS_SIDE_LEFT] ? GetBorderWidth((nsIFrame*)mBorderFrame[NS_SIDE_LEFT], NS_SIDE_LEFT) : 0); + bottom = (mBorderFrame[NS_SIDE_BOTTOM] ? GetBorderWidth((nsIFrame*)mBorderFrame[NS_SIDE_BOTTOM], NS_SIDE_BOTTOM) : 0); + right = (mBorderFrame[NS_SIDE_RIGHT] ? GetBorderWidth((nsIFrame*)mBorderFrame[NS_SIDE_RIGHT], NS_SIDE_RIGHT) : 0); - fprintf(out,"Border -- Top: %d Left: %d Bottom: %d Right: %d \n", - NSTwipsToIntPoints(top), - NSTwipsToIntPoints(left), - NSTwipsToIntPoints(bottom), - NSTwipsToIntPoints(right)); + fprintf(out,"Border -- Top: %d Left: %d Bottom: %d Right: %d \n", + NSTwipsToIntPoints(top), + NSTwipsToIntPoints(left), + NSTwipsToIntPoints(bottom), + NSTwipsToIntPoints(right)); - cell->List(out,aIndent); - NS_RELEASE(cell); + cell->List(out,aIndent); + NS_RELEASE(cell); + } + } + + // Output the children + if (mChildCount > 0) { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + } + for (nsIFrame* child = mFirstChild; child; NextChild(child, child)) { + child->List(out, aIndent + 1, aFilter); + } + if (PR_TRUE==outputMe) + { + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + } + } else { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + } } } diff --git a/layout/tables/nsTableCellFrame.h b/layout/tables/nsTableCellFrame.h index 04b5cd9dc20..c6b99bee5f9 100644 --- a/layout/tables/nsTableCellFrame.h +++ b/layout/tables/nsTableCellFrame.h @@ -185,6 +185,8 @@ private: void CalculateMargins(nsTableFrame* aTableFrame, nsVoidArray* aBoundaryCells[4]); + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const; + protected: /** protected constructor. diff --git a/layout/tables/nsTableColFrame.cpp b/layout/tables/nsTableColFrame.cpp index f6e9faad98b..bfe76797dc7 100644 --- a/layout/tables/nsTableColFrame.cpp +++ b/layout/tables/nsTableColFrame.cpp @@ -97,3 +97,40 @@ nsresult nsTableColFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } +/* ----- debugging methods ----- */ +NS_METHOD nsTableColFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const +{ + // if a filter is present, only output this frame if the filter says we should + // since this could be any "tag" with the right display type, we'll + // just pretend it's a cell + if (nsnull==aFilter) + return nsFrame::List(out, aIndent, aFilter); + + nsAutoString tagString("col"); + if (PR_TRUE==aFilter->OutputTag(&tagString)) + { + // Indent + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + + // Output the tag and rect + nsIAtom* tag; + mContent->GetTag(tag); + if (tag != nsnull) { + nsAutoString buf; + tag->ToString(buf); + fputs(buf, out); + NS_RELEASE(tag); + } + PRInt32 contentIndex; + + GetContentIndex(contentIndex); + fprintf(out, "(%d)", contentIndex); + out << mRect; + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("\n", out); + } + + return NS_OK; +} \ No newline at end of file diff --git a/layout/tables/nsTableColFrame.h b/layout/tables/nsTableColFrame.h index fda51866ddb..3f0ad33873c 100644 --- a/layout/tables/nsTableColFrame.h +++ b/layout/tables/nsTableColFrame.h @@ -77,6 +77,8 @@ public: /** convenience method, calls into cellmap */ PRInt32 Count() const; + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const; + protected: nsTableColFrame(nsIContent* aContent, nsIFrame* aParentFrame); diff --git a/layout/tables/nsTableColGroupFrame.cpp b/layout/tables/nsTableColGroupFrame.cpp index b6f1910cdea..ffaa97e7551 100644 --- a/layout/tables/nsTableColGroupFrame.cpp +++ b/layout/tables/nsTableColGroupFrame.cpp @@ -256,4 +256,61 @@ nsresult nsTableColGroupFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } +/* ----- debugging methods ----- */ +NS_METHOD nsTableColGroupFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const +{ + // if a filter is present, only output this frame if the filter says we should + // since this could be any "tag" with the right display type, we'll + // just pretend it's a colgroup + if (nsnull==aFilter) + return nsContainerFrame::List(out, aIndent, aFilter); + + nsAutoString tagString("colgroup"); + PRBool outputMe = aFilter->OutputTag(&tagString); + if (PR_TRUE==outputMe) + { + // Indent + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + + // Output the tag and rect + nsIAtom* tag; + mContent->GetTag(tag); + if (tag != nsnull) { + nsAutoString buf; + tag->ToString(buf); + fputs(buf, out); + NS_RELEASE(tag); + } + PRInt32 contentIndex; + + GetContentIndex(contentIndex); + fprintf(out, "(%d)", contentIndex); + out << mRect; + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("\n", out); + } + // Output the children + if (mChildCount > 0) { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + for (nsIFrame* child = mFirstChild; child; NextChild(child, child)) { + child->List(out, aIndent + 1, aFilter); + } + } else { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + } + return NS_OK; +} + diff --git a/layout/tables/nsTableColGroupFrame.h b/layout/tables/nsTableColGroupFrame.h index cc951f6c292..d98eb7b5ad7 100644 --- a/layout/tables/nsTableColGroupFrame.h +++ b/layout/tables/nsTableColGroupFrame.h @@ -60,6 +60,8 @@ public: virtual void SetStartColumnIndex (PRInt32 aIndex); + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const; + protected: nsTableColGroupFrame(nsIContent* aContent, nsIFrame* aParentFrame); diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index aae92adcfad..1088d407c70 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -3463,3 +3463,70 @@ PRBool nsTableFrame::TableIsAutoWidth(nsTableFrame *aTableFrame, return result; } +/* ----- debugging methods ----- */ +NS_METHOD nsTableFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const +{ + // if a filter is present, only output this frame if the filter says we should + // since this could be any "tag" with the right display type, we'll + // just pretend it's a table + if (nsnull==aFilter) + return nsContainerFrame::List(out, aIndent, aFilter); + + nsAutoString tagString("table"); + PRBool outputMe = aFilter->OutputTag(&tagString); + if (PR_TRUE==outputMe) + { + // Indent + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + + // Output the tag and rect + nsIAtom* tag; + mContent->GetTag(tag); + if (tag != nsnull) { + nsAutoString buf; + tag->ToString(buf); + fputs(buf, out); + NS_RELEASE(tag); + } + PRInt32 contentIndex; + + GetContentIndex(contentIndex); + fprintf(out, "(%d)", contentIndex); + out << mRect; + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("\n", out); + if (nsnull!=mTableLayoutStrategy) + { + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + fprintf(out, "min=%d, max=%d, fixed=%d, cols=%d, numCols=%d\n", + mTableLayoutStrategy->GetTableMinWidth(), + mTableLayoutStrategy->GetTableMaxWidth(), + mTableLayoutStrategy->GetTableFixedWidth(), + mTableLayoutStrategy->GetCOLSAttribute(), + mTableLayoutStrategy->GetNumCols() + ); + } + } + // Output the children + if (mChildCount > 0) { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + for (nsIFrame* child = mFirstChild; child; NextChild(child, child)) { + child->List(out, aIndent + 1, aFilter); + } + } else { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + } + return NS_OK; +} diff --git a/layout/tables/nsTableFrame.h b/layout/tables/nsTableFrame.h index fdc8caafbad..029385a74ca 100644 --- a/layout/tables/nsTableFrame.h +++ b/layout/tables/nsTableFrame.h @@ -233,6 +233,8 @@ public: virtual void AddColumnFrame (nsTableColFrame *aColFrame); + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const; + protected: /** protected constructor. diff --git a/layout/tables/nsTableOuterFrame.cpp b/layout/tables/nsTableOuterFrame.cpp index 09e955bb369..ac39911bb94 100644 --- a/layout/tables/nsTableOuterFrame.cpp +++ b/layout/tables/nsTableOuterFrame.cpp @@ -866,3 +866,61 @@ nsresult nsTableOuterFrame::NewFrame(nsIFrame** aInstancePtrResult, *aInstancePtrResult = it; return NS_OK; } + +/* ----- debugging methods ----- */ +NS_METHOD nsTableOuterFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const +{ + // if a filter is present, only output this frame if the filter says we should + // since this could be any "tag" with the right display type, we'll + // just pretend it's a tbody + if (nsnull==aFilter) + return nsContainerFrame::List(out, aIndent, aFilter); + + nsAutoString tagString("tbody"); + PRBool outputMe = aFilter->OutputTag(&tagString); + if (PR_TRUE==outputMe) + { + // Indent + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + + // Output the tag and rect + nsIAtom* tag; + mContent->GetTag(tag); + if (tag != nsnull) { + nsAutoString buf; + tag->ToString(buf); + fputs(buf, out); + NS_RELEASE(tag); + } + PRInt32 contentIndex; + + GetContentIndex(contentIndex); + fprintf(out, "(%d)", contentIndex); + out << mRect; + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("\n", out); + } + // Output the children + if (mChildCount > 0) { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + for (nsIFrame* child = mFirstChild; child; NextChild(child, child)) { + child->List(out, aIndent + 1, aFilter); + } + } else { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + } + return NS_OK; +} + diff --git a/layout/tables/nsTableOuterFrame.h b/layout/tables/nsTableOuterFrame.h index cc3b17ef123..43a22d09721 100644 --- a/layout/tables/nsTableOuterFrame.h +++ b/layout/tables/nsTableOuterFrame.h @@ -65,6 +65,8 @@ public: nsIStyleContext* aStyleContext, nsIFrame*& aContinuingFrame); + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const; + protected: /** protected constructor diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index 6df4f2c956b..02f8165840f 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -1005,3 +1005,61 @@ nsresult nsTableRowFrame::NewFrame( nsIFrame** aInstancePtrResult, return NS_OK; } +/* ----- debugging methods ----- */ +NS_METHOD nsTableRowFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const +{ + // if a filter is present, only output this frame if the filter says we should + // since this could be any "tag" with the right display type, we'll + // just pretend it's a row + if (nsnull==aFilter) + return nsContainerFrame::List(out, aIndent, aFilter); + + nsAutoString tagString("tr"); + PRBool outputMe = aFilter->OutputTag(&tagString); + if (PR_TRUE==outputMe) + { + // Indent + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); + + // Output the tag and rect + nsIAtom* tag; + mContent->GetTag(tag); + if (tag != nsnull) { + nsAutoString buf; + tag->ToString(buf); + fputs(buf, out); + NS_RELEASE(tag); + } + PRInt32 contentIndex; + + GetContentIndex(contentIndex); + fprintf(out, "(%d)", contentIndex); + out << mRect; + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("\n", out); + } + // Output the children + if (mChildCount > 0) { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + for (nsIFrame* child = mFirstChild; child; NextChild(child, child)) { + child->List(out, aIndent + 1, aFilter); + } + } else { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + } + return NS_OK; +} + + diff --git a/layout/tables/nsTableRowFrame.h b/layout/tables/nsTableRowFrame.h index 9cd9aa8dc0b..db8e4adf89c 100644 --- a/layout/tables/nsTableRowFrame.h +++ b/layout/tables/nsTableRowFrame.h @@ -111,6 +111,8 @@ public: /** set this row's starting row index */ virtual void SetRowIndex (int aRowIndex); + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const; + protected: /** protected constructor. diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index d143ed3a3d8..36075015e83 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -1210,45 +1210,68 @@ nsresult nsTableRowGroupFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } - - - -// For Debugging ONLY -NS_METHOD nsTableRowGroupFrame::MoveTo(nscoord aX, nscoord aY) +/* ----- debugging methods ----- */ +NS_METHOD nsTableRowGroupFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const { - if ((aX != mRect.x) || (aY != mRect.y)) { - mRect.x = aX; - mRect.y = aY; + // if a filter is present, only output this frame if the filter says we should + // since this could be any "tag" with the right display type, we'll + // just pretend it's a tbody + if (nsnull==aFilter) + return nsContainerFrame::List(out, aIndent, aFilter); - nsIView* view; - GetView(view); + nsAutoString tagString("tbody"); + PRBool outputMe = aFilter->OutputTag(&tagString); + if (PR_TRUE==outputMe) + { + // Indent + for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); - // Let the view know - if (nsnull != view) { - // Position view relative to it's parent, not relative to our - // parent frame (our parent frame may not have a view). - nsIView* parentWithView; - nsPoint origin; - GetOffsetFromView(origin, parentWithView); - view->SetPosition(origin.x, origin.y); + // Output the tag and rect + nsIAtom* tag; + mContent->GetTag(tag); + if (tag != nsnull) { + nsAutoString buf; + tag->ToString(buf); + fputs(buf, out); + NS_RELEASE(tag); + } + PRInt32 contentIndex; + + GetContentIndex(contentIndex); + fprintf(out, "(%d)", contentIndex); + out << mRect; + if (0 != mState) { + fprintf(out, " [state=%08x]", mState); + } + fputs("\n", out); + } + + // Output the children + if (mChildCount > 0) { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } + } + for (nsIFrame* child = mFirstChild; child; NextChild(child, child)) { + child->List(out, aIndent + 1, aFilter); + } + } else { + if (PR_TRUE==outputMe) + { + if (0 != mState) { + fprintf(out, " [state=%08x]\n", mState); + } } } + return NS_OK; } -NS_METHOD nsTableRowGroupFrame::SizeTo(nscoord aWidth, nscoord aHeight) -{ - mRect.width = aWidth; - mRect.height = aHeight; - nsIView* view; - GetView(view); - // Let the view know - if (nsnull != view) { - view->SetDimensions(aWidth, aHeight); - } - return NS_OK; -} + + diff --git a/layout/tables/nsTableRowGroupFrame.h b/layout/tables/nsTableRowGroupFrame.h index 876765538a6..996cc89ecfb 100644 --- a/layout/tables/nsTableRowGroupFrame.h +++ b/layout/tables/nsTableRowGroupFrame.h @@ -94,9 +94,8 @@ public: /** return the number of contained rows */ PRInt32 GetRowCount (); - // For DEBUGGING Purposes Only - NS_IMETHOD MoveTo(nscoord aX, nscoord aY); - NS_IMETHOD SizeTo(nscoord aWidth, nscoord aHeight); + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const; + protected: