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 1f01012410
commit b38c2c5cad
19 changed files with 74 additions and 24 deletions

View File

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

View File

@ -170,7 +170,7 @@ public:
}
#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 GetFrameName(nsAString& aResult) const;
#endif

View File

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

View File

@ -74,7 +74,7 @@ public:
bool aRespectClusters = true) MOZ_OVERRIDE;
#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
// nsContainerFrame methods

View File

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

View File

@ -668,7 +668,7 @@ private:
public:
// 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
* - calls root frame's List(...)

View File

@ -3085,7 +3085,10 @@ private:
#ifdef DEBUG
public:
// 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_(nsFrameState) GetDebugStateBits() const = 0;
NS_IMETHOD DumpRegressionData(nsPresContext* aPresContext,

View File

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

View File

@ -122,7 +122,7 @@ public:
#ifdef DEBUG
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
virtual int GetSkipSides() const;

View File

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

View File

@ -501,7 +501,7 @@ public:
#ifdef DEBUG
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;
#endif

View File

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

View File

@ -115,7 +115,7 @@ public:
#endif // DEBUG || (MOZ_REFLOW_PERF_DSP && MOZ_REFLOW_PERF)
#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
/**

View File

@ -455,6 +455,52 @@ nsSubDocumentFrame::GetIntrinsicHeight()
}
#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
{
return MakeFrameName(NS_LITERAL_STRING("FrameOuter"), aResult);

View File

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

View File

@ -114,7 +114,7 @@ public:
}
#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_(nsFrameState) GetDebugStateBits() const ;
#endif

View File

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

View File

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

View File

@ -44,7 +44,7 @@ public:
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
#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
{
return MakeFrameName(NS_LITERAL_STRING("PopupSet"), aResult);