From f67db2208c010caf92148c09a99f94ee3ddfd1a9 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Thu, 17 Nov 2011 16:44:16 +1300 Subject: [PATCH] Bug 700240 - Print contents of TextFrames. r=mats --- layout/generic/nsTextFrameThebes.cpp | 29 +++++++++------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp index f7868013594d..16aa29aa8eb8 100644 --- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -7740,7 +7740,13 @@ nsTextFrame::IsEmpty() NS_IMETHODIMP nsTextFrame::GetFrameName(nsAString& aResult) const { - return MakeFrameName(NS_LITERAL_STRING("Text"), aResult); + MakeFrameName(NS_LITERAL_STRING("Text"), aResult); + PRInt32 totalContentLength; + nsCAutoString tmp; + ToCString(tmp, &totalContentLength); + tmp.SetLength(NS_MIN(tmp.Length(), 50u)); + aResult += NS_LITERAL_STRING("\"") + NS_ConvertASCIItoUTF16(tmp) + NS_LITERAL_STRING("\""); + return NS_OK; } NS_IMETHODIMP_(nsFrameState) @@ -7762,12 +7768,8 @@ nsTextFrame::List(FILE* out, PRInt32 aIndent) const } fprintf(out, " [run=%p]", static_cast(mTextRun)); - PRInt32 totalContentLength; - nsCAutoString tmp; - ToCString(tmp, &totalContentLength); - // Output the first/last content offset and prev/next in flow info - bool isComplete = GetContentEnd() == totalContentLength; + bool isComplete = GetContentEnd() == GetContent()->TextLength(); fprintf(out, "[%d,%d,%c] ", GetContentOffset(), GetContentLength(), isComplete ? 'T':'F'); @@ -7811,20 +7813,7 @@ nsTextFrame::List(FILE* out, PRInt32 aIndent) const fprintf(out, " pst=%s", NS_LossyConvertUTF16toASCII(atomString).get()); } - fputs("<\n", out); - - // Output the text - aIndent++; - - IndentBy(out, aIndent); - fputs("\"", out); - fputs(tmp.get(), out); - fputs("\"\n", out); - - aIndent--; - IndentBy(out, aIndent); - fputs(">\n", out); - + fputs("\n", out); return NS_OK; } #endif