Back to index

lightning-sunbird  0.9+nobinonly
nsTreeBoxObject.cpp File Reference
#include "nsTreeBoxObject.h"
#include "nsCOMPtr.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsPITreeBoxObject.h"
#include "nsITreeView.h"
#include "nsITreeSelection.h"
#include "nsBoxObject.h"
#include "nsIFrame.h"
#include "nsIAtom.h"
#include "nsINodeInfo.h"
#include "nsXULAtoms.h"
#include "nsChildIterator.h"
#include "nsContentUtils.h"
#include "nsDOMError.h"

Go to the source code of this file.


 NS_IMPL_ISUPPORTS_INHERITED2 (nsTreeBoxObject, nsBoxObject, nsITreeBoxObject, nsPITreeBoxObject) NS_IMETHODIMP nsTreeBoxObject
static void FindBodyElement (nsIContent *aParent, nsIContent **aResult)
static PRBool CanTrustView (nsISupports *aValue)
nsresult NS_NewTreeBoxObject (nsIBoxObject **aResult)

Function Documentation

static PRBool CanTrustView ( nsISupports *  aValue) [static]

Definition at line 172 of file nsTreeBoxObject.cpp.

  // Untrusted content is only allowed to specify known-good views
  if (nsContentUtils::IsCallerTrustedForWrite())
    return PR_TRUE;
  nsCOMPtr<nsINativeTreeView> nativeTreeView = do_QueryInterface(aValue);
  if (!nativeTreeView || NS_FAILED(nativeTreeView->EnsureNative())) {
    // XXX ERRMSG need a good error here for developers
    return PR_FALSE;
  return PR_TRUE;

Here is the call graph for this function:

Here is the caller graph for this function:

static void FindBodyElement ( nsIContent aParent,
nsIContent **  aResult 
) [static]

Definition at line 110 of file nsTreeBoxObject.cpp.

  *aResult = nsnull;
  ChildIterator iter, last;
  for (ChildIterator::Init(aParent, &iter, &last); iter != last; ++iter) {
    nsCOMPtr<nsIContent> content = *iter;

    nsINodeInfo *ni = content->GetNodeInfo();
    if (ni && ni->Equals(nsXULAtoms::treechildren, kNameSpaceID_XUL)) {
      *aResult = content;
    } else if (ni && ni->Equals(nsXULAtoms::tree, kNameSpaceID_XUL)) {
      // There are nesting tree elements. Only the innermost should
      // find the treechilren.
    } else if (ni && !ni->Equals(nsXULAtoms::templateAtom, kNameSpaceID_XUL)) {
      FindBodyElement(content, aResult);
      if (*aResult)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 56 of file nsTreeBoxObject.cpp.

  // this should only be called with a null document, which indicates
  // that we're being torn down.
  NS_ASSERTION(aDocument == nsnull, "SetDocument called with non-null document");

  // Drop the view's ref to us.
  nsCOMPtr<nsISupports> suppView;
  GetPropertyAsSupports(NS_LITERAL_STRING("view").get(), getter_AddRefs(suppView));
  nsCOMPtr<nsITreeView> treeView(do_QueryInterface(suppView));
  if (treeView) {
    nsCOMPtr<nsITreeSelection> sel;
    if (sel)
    treeView->SetTree(nsnull); // Break the circular ref between the view and us.

  return nsBoxObject::SetDocument(aDocument);

Here is the call graph for this function:

Definition at line 441 of file nsTreeBoxObject.cpp.

  *aResult = new nsTreeBoxObject;
  if (!*aResult)
  return NS_OK;

Here is the call graph for this function: