Back to index

lightning-sunbird  0.9+nobinonly
Functions
nsLayoutDebuggingTools.cpp File Reference
#include "nsLayoutDebuggingTools.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeNode.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDOMWindow.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDocumentViewer.h"
#include "nsIServiceManager.h"
#include "nsIAtom.h"
#include "nsQuickSort.h"
#include "nsIPref.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIPresShell.h"
#include "nsIViewManager.h"
#include "nsIFrame.h"
#include "nsIFrameDebug.h"
#include "nsILayoutDebugger.h"
#include "nsLayoutCID.h"
#include "nsISelectionController.h"

Go to the source code of this file.

Functions

static NS_DEFINE_CID (kLayoutDebuggerCID, NS_LAYOUT_DEBUGGER_CID)
static already_AddRefed
< nsIContentViewer
doc_viewer (nsIDocShell *aDocShell)
static already_AddRefed
< nsIPresShell
pres_shell (nsIDocShell *aDocShell)
static nsIViewManagerview_manager (nsIDocShell *aDocShell)
static void DumpAWebShell (nsIDocShellTreeItem *aShellItem, FILE *out, PRInt32 aIndent)
static void DumpContentRecur (nsIDocShell *aDocShell, FILE *out)
static void DumpFramesRecur (nsIDocShell *aDocShell, FILE *out)
static void DumpViewsRecur (nsIDocShell *aDocShell, FILE *out)

Function Documentation

static already_AddRefed<nsIContentViewer> doc_viewer ( nsIDocShell aDocShell) [static]

Definition at line 70 of file nsLayoutDebuggingTools.cpp.

{
    if (!aDocShell)
        return nsnull;
    nsIContentViewer *result = nsnull;
    aDocShell->GetContentViewer(&result);
    return result;
}

Here is the caller graph for this function:

static void DumpAWebShell ( nsIDocShellTreeItem aShellItem,
FILE out,
PRInt32  aIndent 
) [static]

Definition at line 343 of file nsLayoutDebuggingTools.cpp.

{
    nsXPIDLString name;
    nsCOMPtr<nsIDocShellTreeItem> parent;
    PRInt32 i, n;

    for (i = aIndent; --i >= 0; )
        fprintf(out, "  ");

    fprintf(out, "%p '", NS_STATIC_CAST(void*, aShellItem));
    aShellItem->GetName(getter_Copies(name));
    aShellItem->GetSameTypeParent(getter_AddRefs(parent));
    fputs(NS_LossyConvertUCS2toASCII(name).get(), out);
    fprintf(out, "' parent=%p <\n", NS_STATIC_CAST(void*, parent));

    ++aIndent;
    nsCOMPtr<nsIDocShellTreeNode> shellAsNode(do_QueryInterface(aShellItem));
    shellAsNode->GetChildCount(&n);
    for (i = 0; i < n; ++i) {
        nsCOMPtr<nsIDocShellTreeItem> child;
        shellAsNode->GetChildAt(i, getter_AddRefs(child));
        if (child) {
            DumpAWebShell(child, out, aIndent);
        }
    }
    --aIndent;
    for (i = aIndent; --i >= 0; )
        fprintf(out, "  ");
    fputs(">\n", out);
}

Here is the call graph for this function:

static void DumpContentRecur ( nsIDocShell aDocShell,
FILE out 
) [static]

Definition at line 384 of file nsLayoutDebuggingTools.cpp.

{
#ifdef DEBUG
    if (nsnull != aDocShell) {
        fprintf(out, "docshell=%p \n", NS_STATIC_CAST(void*, aDocShell));
        nsCOMPtr<nsIDocument> doc(document(aDocShell));
        if (doc) {
            nsIContent *root = doc->GetRootContent();
            if (root) {
                root->List(out);
            }
        }
        else {
            fputs("no document\n", out);
        }
        // dump the frames of the sub documents
        PRInt32 i, n;
        nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
        docShellAsNode->GetChildCount(&n);
        for (i = 0; i < n; ++i) {
            nsCOMPtr<nsIDocShellTreeItem> child;
            docShellAsNode->GetChildAt(i, getter_AddRefs(child));
            nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
            if (child) {
                DumpContentRecur(childAsShell, out);
            }
        }
    }
#endif
}

Here is the call graph for this function:

static void DumpFramesRecur ( nsIDocShell aDocShell,
FILE out 
) [static]

Definition at line 423 of file nsLayoutDebuggingTools.cpp.

{
    if (nsnull != aDocShell) {
        fprintf(out, "webshell=%p \n", NS_STATIC_CAST(void*, aDocShell));
        nsCOMPtr<nsIPresShell> shell(pres_shell(aDocShell));
        if (shell) {
            nsIFrame* root = shell->GetRootFrame();
            if (root) {
                nsIFrameDebug* fdbg;
                if (NS_SUCCEEDED(CallQueryInterface(root, &fdbg))) {
                    fdbg->List(shell->GetPresContext(), out, 0);
                }
            }
        }
        else {
            fputs("null pres shell\n", out);
        }

        // dump the frames of the sub documents
        PRInt32 i, n;
        nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
        docShellAsNode->GetChildCount(&n);
        for (i = 0; i < n; ++i) {
            nsCOMPtr<nsIDocShellTreeItem> child;
            docShellAsNode->GetChildAt(i, getter_AddRefs(child));
            nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
            if (childAsShell) {
                DumpFramesRecur(childAsShell, out);
            }
        }
    }
}

Here is the call graph for this function:

static void DumpViewsRecur ( nsIDocShell aDocShell,
FILE out 
) [static]

Definition at line 465 of file nsLayoutDebuggingTools.cpp.

{
#ifdef DEBUG
    if (aDocShell) {
        fprintf(out, "docshell=%p \n", NS_STATIC_CAST(void*, aDocShell));
        nsCOMPtr<nsIViewManager> vm(view_manager(aDocShell));
        if (vm) {
            nsIView* root;
            vm->GetRootView(root);
            if (nsnull != root) {
                root->List(out);
            }
        }
        else {
            fputs("null view manager\n", out);
        }

        // dump the views of the sub documents
        PRInt32 i, n;
        nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
        docShellAsNode->GetChildCount(&n);
        for (i = 0; i < n; i++) {
            nsCOMPtr<nsIDocShellTreeItem> child;
            docShellAsNode->GetChildAt(i, getter_AddRefs(child));
            nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
            if (childAsShell) {
                DumpViewsRecur(childAsShell, out);
            }
        }
    }
#endif // DEBUG
}

Here is the call graph for this function:

static NS_DEFINE_CID ( kLayoutDebuggerCID  ,
NS_LAYOUT_DEBUGGER_CID   
) [static]
static already_AddRefed<nsIPresShell> pres_shell ( nsIDocShell aDocShell) [static]

Definition at line 80 of file nsLayoutDebuggingTools.cpp.

{
    nsCOMPtr<nsIDocumentViewer> dv =
        do_QueryInterface(nsCOMPtr<nsIContentViewer>(doc_viewer(aDocShell)));
    if (!dv)
        return nsnull;
    nsIPresShell *result = nsnull;
    dv->GetPresShell(&result);
    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nsIViewManager* view_manager ( nsIDocShell aDocShell) [static]

Definition at line 106 of file nsLayoutDebuggingTools.cpp.

{
    nsCOMPtr<nsIPresShell> shell(pres_shell(aDocShell));
    if (!shell)
        return nsnull;
    return shell->GetViewManager();
}

Here is the call graph for this function:

Here is the caller graph for this function: