Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes
nsAccessNode Class Reference

#include <nsAccessNode.h>

Inheritance diagram for nsAccessNode:
Inheritance graph
[legend]
Collaboration diagram for nsAccessNode:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsAccessNode (nsIDOMNode *, nsIWeakReference *aShell)
virtual ~nsAccessNode ()
NS_IMETHOD QueryInterface (REFNSIID aIID, void **aInstancePtr)
 NS_IMETHOD_ (nsrefcnt) AddRef(void)
 NS_IMETHOD_ (nsrefcnt) Release(void)
nsIAccessNode getChildNodeAt (in long childNum)
 Get the nth child of this node.
DOMString getComputedStyleValue (in DOMString pseudoElt, in DOMString propertyName)
 Retrieve the computed style value for this DOM node, if it is a DOM element.
void init ()
void shutdown ()
nsIFrame GetFrame ()

Static Public Member Functions

NS_DECL_NSIACCESSNODE static
NS_DECL_NSPIACCESSNODE void 
InitXPAccessibility ()
static void ShutdownXPAccessibility ()
static void PutCacheEntry (nsInterfaceHashtable< nsVoidHashKey, nsIAccessNode > &aCache, void *aUniqueID, nsIAccessNode *aAccessNode)
static void GetCacheEntry (nsInterfaceHashtable< nsVoidHashKey, nsIAccessNode > &aCache, void *aUniqueID, nsIAccessNode **aAccessNode)
static void ClearCache (nsInterfaceHashtable< nsVoidHashKey, nsIAccessNode > &aCache)
static PLDHashOperator PR_CALLBACK ClearCacheEntry (const void *aKey, nsCOMPtr< nsIAccessNode > &aAccessNode, void *aUserArg)
static already_AddRefed
< nsIAccessibleDocument
GetDocAccessibleFor (nsIWeakReference *aPresShell)
static already_AddRefed
< nsIAccessibleDocument
GetDocAccessibleFor (nsISupports *aContainer)
static already_AddRefed
< nsIAccessibleDocument
GetDocAccessibleFor (nsIDOMNode *aNode)
static already_AddRefed
< nsIDocShellTreeItem
GetDocShellTreeItemFor (nsIDOMNode *aStartNode)
static already_AddRefed
< nsIPresShell
GetPresShellFor (nsIDOMNode *aStartNode)
static PRBool HasRoleAttribute (nsIContent *aContent)
static PRBool GetRoleAttribute (nsIContent *aContent, nsAString &aRole)

Public Attributes

readonly attribute nsIDOMNode DOMNode
 The DOM node this nsIAccessNode is associated with.
readonly attribute long numChildren
 The number of DOM children for the DOM node, which matches the number of nsIAccessNode children for this nsIAccessNode.
readonly attribute nsIAccessNode parentNode
 The parent nsIAccessNode.
readonly attribute nsIAccessNode firstChildNode
 The first nsIAccessNode child.
readonly attribute nsIAccessNode lastChildNode
 The last nsIAccessNode child.
readonly attribute nsIAccessNode previousSiblingNode
 The previous nsIAccessNode sibling.
readonly attribute nsIAccessNode nextSiblingNode
 The next nsIAccessNode sibling.
readonly attribute
nsIAccessibleDocument 
accessibleDocument
 The nsIAccessibleDocument that this nsIAccessNode resides in.
readonly attribute DOMString innerHTML
 The innerHTML for the DOM node This is a text string of all the markup inside the DOM node, not including the start and end tag for the node.
readonly attribute voidPtr ownerWindow
 The OS window handle for the window this node is being displayed in.
readonly attribute voidPtr uniqueID
 A unique ID calculated for this DOM node, for the purposes of caching and referencing this object.

Static Public Attributes

static nsIDOMNodegLastFocusedNode = 0

Protected Member Functions

nsresult MakeAccessNode (nsIDOMNode *aNode, nsIAccessNode **aAccessNode)
already_AddRefed< nsIPresShellGetPresShell ()
nsPresContextGetPresContext ()
already_AddRefed
< nsIAccessibleDocument
GetDocAccessible ()

Protected Attributes

nsCOMPtr< nsIDOMNodemDOMNode
nsCOMPtr< nsIWeakReferencemWeakShell
PRInt32 mRefCnt

Static Protected Attributes

static NS_DECL_OWNINGTHREAD
nsIStringBundle
gStringBundle = 0
static nsIStringBundlegKeyStringBundle = 0
static nsITimergDoCommandTimer = 0
static PRBool gIsAccessibilityActive = PR_FALSE
static PRBool gIsCacheDisabled = PR_FALSE
static nsInterfaceHashtable
< nsVoidHashKey, nsIAccessNode
gGlobalDocAccessibleCache

Detailed Description

Definition at line 94 of file nsAccessNode.h.


Constructor & Destructor Documentation

Definition at line 86 of file nsAccessNode.cpp.

                                                                     : 
  mDOMNode(aNode), mWeakShell(aShell), mRefCnt(0)
{
#ifdef DEBUG
  mIsInitialized = PR_FALSE;
#endif
}

Here is the caller graph for this function:

Definition at line 97 of file nsAccessNode.cpp.

{
  if (mWeakShell) {
    Shutdown();  // Otherwise virtual Shutdown() methods could get fired twice
  }
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 535 of file nsAccessNode.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

PLDHashOperator nsAccessNode::ClearCacheEntry ( const void aKey,
nsCOMPtr< nsIAccessNode > &  aAccessNode,
void aUserArg 
) [static]

Definition at line 527 of file nsAccessNode.cpp.

{
  nsCOMPtr<nsPIAccessNode> privateAccessNode(do_QueryInterface(aAccessNode));
  privateAccessNode->Shutdown();

  return PL_DHASH_REMOVE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsAccessNode::GetCacheEntry ( nsInterfaceHashtable< nsVoidHashKey, nsIAccessNode > &  aCache,
void aUniqueID,
nsIAccessNode **  aAccessNode 
) [static]

Definition at line 520 of file nsAccessNode.cpp.

{
  aCache.Get(aUniqueID, aAccessNode);  // AddRefs for us
}

Here is the call graph for this function:

Here is the caller graph for this function:

Get the nth child of this node.

Parameters:
childNumZero-based child index
Returns:
The nth nsIAccessNode child
DOMString nsIAccessNode::getComputedStyleValue ( in DOMString  pseudoElt,
in DOMString  propertyName 
) [inherited]

Retrieve the computed style value for this DOM node, if it is a DOM element.

Note: the meanings of width, height and other size measurements depend on the version of CSS being used. Therefore, for bounds information, it is better to use nsIAccessible::accGetBounds.

Parameters:
pseudoEltThe pseudo element to retrieve style for, or NULL for general computed style information for this node.
propertyNameRetrieve the computed style value for this property name, for example "border-bottom".

Definition at line 245 of file nsAccessNode.cpp.

{
  return GetDocAccessibleFor(mWeakShell); // Addref'd
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 440 of file nsAccessNode.cpp.

{
  nsIAccessibleDocument *docAccessible = nsnull;
  nsCOMPtr<nsIAccessNode> accessNode;
  gGlobalDocAccessibleCache.Get(NS_STATIC_CAST(void*, aPresShell), getter_AddRefs(accessNode));
  if (accessNode) {
    CallQueryInterface(accessNode, &docAccessible);
  }
  return docAccessible;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 452 of file nsAccessNode.cpp.

{
  nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aContainer));
  NS_ASSERTION(docShell, "This method currently only supports docshells");
  nsCOMPtr<nsIPresShell> presShell;
  docShell->GetPresShell(getter_AddRefs(presShell));
  nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(presShell));
  return weakShell ? GetDocAccessibleFor(weakShell) : nsnull;
}

Here is the call graph for this function:

Definition at line 463 of file nsAccessNode.cpp.

{
  nsCOMPtr<nsIPresShell> eventShell = GetPresShellFor(aNode);
  nsCOMPtr<nsIWeakReference> weakEventShell(do_GetWeakReference(eventShell));
  return weakEventShell? GetDocAccessibleFor(weakEventShell) : nsnull;
}

Here is the call graph for this function:

Definition at line 489 of file nsAccessNode.cpp.

{
  nsCOMPtr<nsIDOMDocument> domDoc;
  aStartNode->GetOwnerDocument(getter_AddRefs(domDoc));
  nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
  if (!doc) {
    doc = do_QueryInterface(aStartNode);
  }
  NS_ASSERTION(doc, "No document for node passed in");
  NS_ENSURE_TRUE(doc, nsnull);
  nsCOMPtr<nsISupports> container = doc->GetContainer();
  nsIDocShellTreeItem *docShellTreeItem = nsnull;
  if (container) {
    CallQueryInterface(container, &docShellTreeItem);
  }

  return docShellTreeItem;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

Definition at line 236 of file nsAccessNode.cpp.

{
  nsCOMPtr<nsIPresShell> presShell(GetPresShell());
  if (!presShell) {
    return nsnull;
  }
  return presShell->GetPresContext();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 219 of file nsAccessNode.cpp.

{
  nsIPresShell *presShell = nsnull;
  if (mWeakShell)
    CallQueryReferent(mWeakShell.get(), &presShell);
  if (!presShell) {
    if (mWeakShell) {
      // If our pres shell has died, but we're still holding onto
      // a weak reference, our accessibles are no longer relevant
      // and should be shut down
      Shutdown();
    }
    return nsnull;
  }
  return presShell;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 471 of file nsAccessNode.cpp.

{
  nsCOMPtr<nsIDOMDocument> domDocument;
  aNode->GetOwnerDocument(getter_AddRefs(domDocument));
  nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDocument));
  if (!doc) {   // This is necessary when the node is the document node
    doc = do_QueryInterface(aNode);
  }
  nsIPresShell *presShell = nsnull;
  if (doc) {
    presShell = doc->GetShellAt(0);
    NS_IF_ADDREF(presShell);
  }
  return presShell;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool nsAccessNode::GetRoleAttribute ( nsIContent aContent,
nsAString &  aRole 
) [inline, static]

Definition at line 135 of file nsAccessNode.h.

    {
      aRole.Truncate();
      return (aContent->IsContentOfType(nsIContent::eHTML) && aContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::role, aRole) != NS_CONTENT_ATTR_NOT_THERE) ||
              aContent->GetAttr(kNameSpaceID_XHTML, nsAccessibilityAtoms::role, aRole) != NS_CONTENT_ATTR_NOT_THERE ||
              aContent->GetAttr(kNameSpaceID_XHTML2_Unofficial, nsAccessibilityAtoms::role, aRole) != NS_CONTENT_ATTR_NOT_THERE;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool nsAccessNode::HasRoleAttribute ( nsIContent aContent) [inline, static]

Definition at line 127 of file nsAccessNode.h.

    {
      return (aContent->IsContentOfType(nsIContent::eHTML) && aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::role)) ||
              aContent->HasAttr(kNameSpaceID_XHTML, nsAccessibilityAtoms::role) ||
              aContent->HasAttr(kNameSpaceID_XHTML2_Unofficial, nsAccessibilityAtoms::role);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsPIAccessNode::init ( ) [inherited]

Definition at line 172 of file nsAccessNode.cpp.

{
  if (gIsAccessibilityActive) {
    return;
  }

  nsCOMPtr<nsIStringBundleService> stringBundleService =
    do_GetService(NS_STRINGBUNDLE_CONTRACTID);
  if (stringBundleService) {
    // Static variables are released in ShutdownAllXPAccessibility();
    stringBundleService->CreateBundle(ACCESSIBLE_BUNDLE_URL, 
                                      &gStringBundle);
    stringBundleService->CreateBundle(PLATFORM_KEYS_BUNDLE_URL, 
                                      &gKeyStringBundle);
  }

  nsAccessibilityAtoms::AddRefAtoms();

  gGlobalDocAccessibleCache.Init(4);

  nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
  if (prefBranch) {
    prefBranch->GetBoolPref("accessibility.disablecache", &gIsCacheDisabled);
  }

  gIsAccessibilityActive = PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAccessNode::MakeAccessNode ( nsIDOMNode aNode,
nsIAccessNode **  aAccessNode 
) [protected]

Definition at line 312 of file nsAccessNode.cpp.

{
  nsCOMPtr<nsIAccessibilityService> accService = 
    do_GetService("@mozilla.org/accessibilityService;1");
  NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);

  nsCOMPtr<nsIAccessNode> accessNode;
  accService->GetCachedAccessNode(aNode, mWeakShell, getter_AddRefs(accessNode));

  if (!accessNode) {
    nsCOMPtr<nsIAccessible> accessible;
    accService->GetAccessibleInWeakShell(aNode, mWeakShell, 
                                         getter_AddRefs(accessible));
    
    accessNode = do_QueryInterface(accessible);
  }

  if (accessNode) {
    NS_ADDREF(*aAccessNode = accessNode);
    return NS_OK;
  }

  nsAccessNode *newAccessNode = new nsAccessNode(aNode, mWeakShell);
  if (!newAccessNode) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  NS_ADDREF(*aAccessNode = newAccessNode);
  newAccessNode->Init();

  return NS_OK;
}

Here is the call graph for this function:

void nsAccessNode::PutCacheEntry ( nsInterfaceHashtable< nsVoidHashKey, nsIAccessNode > &  aCache,
void aUniqueID,
nsIAccessNode aAccessNode 
) [static]

Definition at line 508 of file nsAccessNode.cpp.

{
#ifdef DEBUG
  nsCOMPtr<nsIAccessNode> oldAccessNode;
  GetCacheEntry(aCache, aUniqueID, getter_AddRefs(oldAccessNode));
  NS_ASSERTION(!oldAccessNode, "This cache entry shouldn't exist already");
#endif
  aCache.Put(aUniqueID, aAccessNode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsAccessNode::QueryInterface ( REFNSIID  aIID,
void **  aInstancePtr 
)

Here is the caller graph for this function:

void nsPIAccessNode::shutdown ( ) [inherited]

Definition at line 200 of file nsAccessNode.cpp.

{
  // Called by nsAccessibilityService::Shutdown()
  // which happens when xpcom is shutting down
  // at exit of program

  if (!gIsAccessibilityActive) {
    return;
  }
  NS_IF_RELEASE(gStringBundle);
  NS_IF_RELEASE(gKeyStringBundle);
  NS_IF_RELEASE(gDoCommandTimer);
  NS_IF_RELEASE(gLastFocusedNode);

  ClearCache(gGlobalDocAccessibleCache);

  gIsAccessibilityActive = PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

The nsIAccessibleDocument that this nsIAccessNode resides in.

Definition at line 109 of file nsIAccessNode.idl.

The DOM node this nsIAccessNode is associated with.

Definition at line 64 of file nsIAccessNode.idl.

The first nsIAccessNode child.

Definition at line 88 of file nsIAccessNode.idl.

nsITimer * nsAccessNode::gDoCommandTimer = 0 [static, protected]

Definition at line 164 of file nsAccessNode.h.

Definition at line 168 of file nsAccessNode.h.

Definition at line 165 of file nsAccessNode.h.

Definition at line 166 of file nsAccessNode.h.

Definition at line 163 of file nsAccessNode.h.

Definition at line 143 of file nsAccessNode.h.

nsIStringBundle * nsAccessNode::gStringBundle = 0 [static, protected]

Definition at line 162 of file nsAccessNode.h.

readonly attribute DOMString nsIAccessNode::innerHTML [inherited]

The innerHTML for the DOM node This is a text string of all the markup inside the DOM node, not including the start and end tag for the node.

Definition at line 116 of file nsIAccessNode.idl.

The last nsIAccessNode child.

Definition at line 93 of file nsIAccessNode.idl.

Definition at line 151 of file nsAccessNode.h.

Definition at line 154 of file nsAccessNode.h.

Definition at line 152 of file nsAccessNode.h.

The next nsIAccessNode sibling.

Definition at line 103 of file nsIAccessNode.idl.

The number of DOM children for the DOM node, which matches the number of nsIAccessNode children for this nsIAccessNode.

Definition at line 71 of file nsIAccessNode.idl.

readonly attribute voidPtr nsIAccessNode::ownerWindow [inherited]

The OS window handle for the window this node is being displayed in.

Definition at line 122 of file nsIAccessNode.idl.

The parent nsIAccessNode.

Definition at line 83 of file nsIAccessNode.idl.

The previous nsIAccessNode sibling.

Definition at line 98 of file nsIAccessNode.idl.

readonly attribute voidPtr nsIAccessNode::uniqueID [inherited]

A unique ID calculated for this DOM node, for the purposes of caching and referencing this object.

Definition at line 128 of file nsIAccessNode.idl.


The documentation for this class was generated from the following files: