Bug 788202 - Add optional subdocument traversal to nsIFrame::List. r=bz

Add subdocument frame traversal to nsIFrame::List, controlled via an optional
flag.
This commit is contained in:
Chris Lord
2012-09-19 15:36:35 +01:00
parent fd7b46420d
commit 8cbb24d8a8
19 changed files with 74 additions and 24 deletions

View File

@@ -333,7 +333,7 @@ nsBlockFrame::GetSplittableType() const
#ifdef DEBUG #ifdef DEBUG
NS_METHOD NS_METHOD
nsBlockFrame::List(FILE* out, int32_t aIndent) const nsBlockFrame::List(FILE* out, int32_t aIndent, uint32_t aFlags) const
{ {
IndentBy(out, aIndent); IndentBy(out, aIndent);
ListTag(out); ListTag(out);
@@ -422,7 +422,7 @@ nsBlockFrame::List(FILE* out, int32_t aIndent) const
if (!mLines.empty()) { if (!mLines.empty()) {
const_line_iterator line = begin_lines(), line_end = end_lines(); const_line_iterator line = begin_lines(), line_end = end_lines();
for ( ; line != line_end; ++line) { for ( ; line != line_end; ++line) {
line->List(out, aIndent); line->List(out, aIndent, aFlags);
} }
} }
@@ -434,7 +434,7 @@ nsBlockFrame::List(FILE* out, int32_t aIndent) const
const_line_iterator line = overflowLines->mLines.begin(), const_line_iterator line = overflowLines->mLines.begin(),
line_end = overflowLines->mLines.end(); line_end = overflowLines->mLines.end();
for ( ; line != line_end; ++line) { for ( ; line != line_end; ++line) {
line->List(out, aIndent + 1); line->List(out, aIndent + 1, aFlags);
} }
IndentBy(out, aIndent); IndentBy(out, aIndent);
fputs(">\n", out); fputs(">\n", out);
@@ -453,7 +453,7 @@ nsBlockFrame::List(FILE* out, int32_t aIndent) const
nsFrameList::Enumerator childFrames(lists.CurrentList()); nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) { for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* kid = childFrames.get(); nsIFrame* kid = childFrames.get();
kid->List(out, aIndent + 1); kid->List(out, aIndent + 1, aFlags);
} }
IndentBy(out, aIndent); IndentBy(out, aIndent);
fputs(">\n", out); fputs(">\n", out);

View File

@@ -170,7 +170,7 @@ public:
} }
#ifdef DEBUG #ifdef DEBUG
NS_IMETHOD List(FILE* out, int32_t aIndent) const; NS_IMETHOD List(FILE* out, int32_t aIndent, uint32_t aFlags = 0) const;
NS_IMETHOD_(nsFrameState) GetDebugStateBits() const; NS_IMETHOD_(nsFrameState) GetDebugStateBits() const;
NS_IMETHOD GetFrameName(nsAString& aResult) const; NS_IMETHOD GetFrameName(nsAString& aResult) const;
#endif #endif

View File

@@ -1763,7 +1763,7 @@ nsOverflowContinuationTracker::Finish(nsIFrame* aChild)
#ifdef DEBUG #ifdef DEBUG
NS_IMETHODIMP NS_IMETHODIMP
nsContainerFrame::List(FILE* out, int32_t aIndent) const nsContainerFrame::List(FILE* out, int32_t aIndent, uint32_t aFlags) const
{ {
IndentBy(out, aIndent); IndentBy(out, aIndent);
ListTag(out); ListTag(out);
@@ -1830,7 +1830,7 @@ nsContainerFrame::List(FILE* out, int32_t aIndent) const
NS_ASSERTION(kid->GetParent() == this, "bad parent frame pointer"); NS_ASSERTION(kid->GetParent() == this, "bad parent frame pointer");
// Have the child frame list // Have the child frame list
kid->List(out, aIndent + 1); kid->List(out, aIndent + 1, aFlags);
} }
IndentBy(out, aIndent); IndentBy(out, aIndent);
fputs(">\n", out); fputs(">\n", out);

View File

@@ -74,7 +74,7 @@ public:
bool aRespectClusters = true) MOZ_OVERRIDE; bool aRespectClusters = true) MOZ_OVERRIDE;
#ifdef DEBUG #ifdef DEBUG
NS_IMETHOD List(FILE* out, int32_t aIndent) const MOZ_OVERRIDE; NS_IMETHOD List(FILE* out, int32_t aIndent, uint32_t aFlags = 0) const MOZ_OVERRIDE;
#endif #endif
// nsContainerFrame methods // nsContainerFrame methods

View File

@@ -5409,7 +5409,7 @@ DebugListFrameTree(nsIFrame* aFrame)
// Debugging // Debugging
NS_IMETHODIMP NS_IMETHODIMP
nsFrame::List(FILE* out, int32_t aIndent) const nsFrame::List(FILE* out, int32_t aIndent, uint32_t aFlags) const
{ {
IndentBy(out, aIndent); IndentBy(out, aIndent);
ListTag(out); ListTag(out);

View File

@@ -668,7 +668,7 @@ private:
public: public:
// Formerly the nsIFrameDebug interface // Formerly the nsIFrameDebug interface
NS_IMETHOD List(FILE* out, int32_t aIndent) const; NS_IMETHOD List(FILE* out, int32_t aIndent, uint32_t aFlags = 0) const;
/** /**
* lists the frames beginning from the root frame * lists the frames beginning from the root frame
* - calls root frame's List(...) * - calls root frame's List(...)

View File

@@ -3085,7 +3085,10 @@ private:
#ifdef DEBUG #ifdef DEBUG
public: public:
// Formerly nsIFrameDebug // Formerly nsIFrameDebug
NS_IMETHOD List(FILE* out, int32_t aIndent) const = 0; enum {
TRAVERSE_SUBDOCUMENT_FRAMES = 0x01
};
NS_IMETHOD List(FILE* out, int32_t aIndent, uint32_t aFlags = 0) const = 0;
NS_IMETHOD GetFrameName(nsAString& aResult) const = 0; NS_IMETHOD GetFrameName(nsAString& aResult) const = 0;
NS_IMETHOD_(nsFrameState) GetDebugStateBits() const = 0; NS_IMETHOD_(nsFrameState) GetDebugStateBits() const = 0;
NS_IMETHOD DumpRegressionData(nsPresContext* aPresContext, NS_IMETHOD DumpRegressionData(nsPresContext* aPresContext,

View File

@@ -1708,7 +1708,7 @@ nsImageFrame::GetFrameName(nsAString& aResult) const
} }
NS_IMETHODIMP NS_IMETHODIMP
nsImageFrame::List(FILE* out, int32_t aIndent) const nsImageFrame::List(FILE* out, int32_t aIndent, uint32_t aFlags) const
{ {
IndentBy(out, aIndent); IndentBy(out, aIndent);
ListTag(out); ListTag(out);

View File

@@ -122,7 +122,7 @@ public:
#ifdef DEBUG #ifdef DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const; NS_IMETHOD GetFrameName(nsAString& aResult) const;
NS_IMETHOD List(FILE* out, int32_t aIndent) const; NS_IMETHOD List(FILE* out, int32_t aIndent, uint32_t aFlags = 0) const;
#endif #endif
virtual int GetSkipSides() const; virtual int GetSkipSides() const;

View File

@@ -224,7 +224,7 @@ nsLineBox::StateToString(char* aBuf, int32_t aBufSize) const
} }
void void
nsLineBox::List(FILE* out, int32_t aIndent) const nsLineBox::List(FILE* out, int32_t aIndent, uint32_t aFlags) const
{ {
int32_t i; int32_t i;
@@ -254,7 +254,7 @@ nsLineBox::List(FILE* out, int32_t aIndent) const
nsIFrame* frame = mFirstChild; nsIFrame* frame = mFirstChild;
int32_t n = GetChildCount(); int32_t n = GetChildCount();
while (--n >= 0) { while (--n >= 0) {
frame->List(out, aIndent + 1); frame->List(out, aIndent + 1, aFlags);
frame = frame->GetNextSibling(); frame = frame->GetNextSibling();
} }

View File

@@ -501,7 +501,7 @@ public:
#ifdef DEBUG #ifdef DEBUG
char* StateToString(char* aBuf, int32_t aBufSize) const; char* StateToString(char* aBuf, int32_t aBufSize) const;
void List(FILE* out, int32_t aIndent) const; void List(FILE* out, int32_t aIndent, uint32_t aFlags = 0) const;
nsIFrame* LastChild() const; nsIFrame* LastChild() const;
#endif #endif

View File

@@ -228,7 +228,7 @@ nsPlaceholderFrame::GetFrameName(nsAString& aResult) const
} }
NS_IMETHODIMP NS_IMETHODIMP
nsPlaceholderFrame::List(FILE* out, int32_t aIndent) const nsPlaceholderFrame::List(FILE* out, int32_t aIndent, uint32_t aFlags) const
{ {
IndentBy(out, aIndent); IndentBy(out, aIndent);
ListTag(out); ListTag(out);

View File

@@ -115,7 +115,7 @@ public:
#endif // DEBUG || (MOZ_REFLOW_PERF_DSP && MOZ_REFLOW_PERF) #endif // DEBUG || (MOZ_REFLOW_PERF_DSP && MOZ_REFLOW_PERF)
#ifdef DEBUG #ifdef DEBUG
NS_IMETHOD List(FILE* out, int32_t aIndent) const MOZ_OVERRIDE; NS_IMETHOD List(FILE* out, int32_t aIndent, uint32_t aFlags = 0) const MOZ_OVERRIDE;
#endif // DEBUG #endif // DEBUG
/** /**

View File

@@ -455,6 +455,52 @@ nsSubDocumentFrame::GetIntrinsicHeight()
} }
#ifdef DEBUG #ifdef DEBUG
NS_IMETHODIMP
nsSubDocumentFrame::List(FILE* out, int32_t aIndent, uint32_t aFlags) const
{
IndentBy(out, aIndent);
ListTag(out);
#ifdef DEBUG_waterson
fprintf(out, " [parent=%p]", static_cast<void*>(mParent));
#endif
if (HasView()) {
fprintf(out, " [view=%p]", static_cast<void*>(GetView()));
}
fprintf(out, " {%d,%d,%d,%d}", mRect.x, mRect.y, mRect.width, mRect.height);
if (0 != mState) {
fprintf(out, " [state=%016llx]", (unsigned long long)mState);
}
nsIFrame* prevInFlow = GetPrevInFlow();
nsIFrame* nextInFlow = GetNextInFlow();
if (nullptr != prevInFlow) {
fprintf(out, " prev-in-flow=%p", static_cast<void*>(prevInFlow));
}
if (nullptr != nextInFlow) {
fprintf(out, " next-in-flow=%p", static_cast<void*>(nextInFlow));
}
fprintf(out, " [content=%p]", static_cast<void*>(mContent));
nsSubDocumentFrame* f = const_cast<nsSubDocumentFrame*>(this);
if (f->HasOverflowAreas()) {
nsRect overflowArea = f->GetVisualOverflowRect();
fprintf(out, " [vis-overflow=%d,%d,%d,%d]", overflowArea.x, overflowArea.y,
overflowArea.width, overflowArea.height);
overflowArea = f->GetScrollableOverflowRect();
fprintf(out, " [scr-overflow=%d,%d,%d,%d]", overflowArea.x, overflowArea.y,
overflowArea.width, overflowArea.height);
}
fprintf(out, " [sc=%p]", static_cast<void*>(mStyleContext));
fputs("\n", out);
if (aFlags & TRAVERSE_SUBDOCUMENT_FRAMES) {
nsIFrame* subdocRootFrame = f->GetSubdocumentRootFrame();
if (subdocRootFrame) {
subdocRootFrame->List(out, aIndent + 1);
}
}
return NS_OK;
}
NS_IMETHODIMP nsSubDocumentFrame::GetFrameName(nsAString& aResult) const NS_IMETHODIMP nsSubDocumentFrame::GetFrameName(nsAString& aResult) const
{ {
return MakeFrameName(NS_LITERAL_STRING("FrameOuter"), aResult); return MakeFrameName(NS_LITERAL_STRING("FrameOuter"), aResult);

View File

@@ -24,6 +24,7 @@ public:
nsSubDocumentFrame(nsStyleContext* aContext); nsSubDocumentFrame(nsStyleContext* aContext);
#ifdef DEBUG #ifdef DEBUG
NS_IMETHOD List(FILE* out, int32_t aIndent, uint32_t aFlags = 0) const;
NS_IMETHOD GetFrameName(nsAString& aResult) const; NS_IMETHOD GetFrameName(nsAString& aResult) const;
#endif #endif

View File

@@ -114,7 +114,7 @@ public:
} }
#ifdef DEBUG #ifdef DEBUG
NS_IMETHOD List(FILE* out, int32_t aIndent) const; NS_IMETHOD List(FILE* out, int32_t aIndent, uint32_t aFlags = 0) const;
NS_IMETHOD GetFrameName(nsAString& aResult) const; NS_IMETHOD GetFrameName(nsAString& aResult) const;
NS_IMETHOD_(nsFrameState) GetDebugStateBits() const ; NS_IMETHOD_(nsFrameState) GetDebugStateBits() const ;
#endif #endif

View File

@@ -8392,7 +8392,7 @@ nsTextFrame::GetDebugStateBits() const
} }
NS_IMETHODIMP NS_IMETHODIMP
nsTextFrame::List(FILE* out, int32_t aIndent) const nsTextFrame::List(FILE* out, int32_t aIndent, uint32_t aFlags) const
{ {
// Output the tag // Output the tag
IndentBy(out, aIndent); IndentBy(out, aIndent);

View File

@@ -150,7 +150,7 @@ nsPopupSetFrame::AddPopupFrameList(nsFrameList& aPopupFrameList)
#ifdef DEBUG #ifdef DEBUG
NS_IMETHODIMP NS_IMETHODIMP
nsPopupSetFrame::List(FILE* out, int32_t aIndent) const nsPopupSetFrame::List(FILE* out, int32_t aIndent, uint32_t aFlags) const
{ {
IndentBy(out, aIndent); IndentBy(out, aIndent);
ListTag(out); ListTag(out);
@@ -210,7 +210,7 @@ nsPopupSetFrame::List(FILE* out, int32_t aIndent) const
NS_ASSERTION(kid->GetParent() == this, "bad parent frame pointer"); NS_ASSERTION(kid->GetParent() == this, "bad parent frame pointer");
// Have the child frame list // Have the child frame list
kid->List(out, aIndent + 1); kid->List(out, aIndent + 1, aFlags);
} }
IndentBy(out, aIndent); IndentBy(out, aIndent);
fputs(">\n", out); fputs(">\n", out);
@@ -229,7 +229,7 @@ nsPopupSetFrame::List(FILE* out, int32_t aIndent) const
fputs(" <\n", out); fputs(" <\n", out);
++aIndent; ++aIndent;
for (nsFrameList::Enumerator e(mPopupList); !e.AtEnd(); e.Next()) { for (nsFrameList::Enumerator e(mPopupList); !e.AtEnd(); e.Next()) {
e.get()->List(out, aIndent); e.get()->List(out, aIndent, aFlags);
} }
--aIndent; --aIndent;
IndentBy(out, aIndent); IndentBy(out, aIndent);

View File

@@ -44,7 +44,7 @@ public:
virtual nsIAtom* GetType() const MOZ_OVERRIDE; virtual nsIAtom* GetType() const MOZ_OVERRIDE;
#ifdef DEBUG #ifdef DEBUG
NS_IMETHOD List(FILE* out, int32_t aIndent) const MOZ_OVERRIDE; NS_IMETHOD List(FILE* out, int32_t aIndent, uint32_t aFlags = 0) const MOZ_OVERRIDE;
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE
{ {
return MakeFrameName(NS_LITERAL_STRING("PopupSet"), aResult); return MakeFrameName(NS_LITERAL_STRING("PopupSet"), aResult);