Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends

nsAccessible Class Reference

#include <nsAccessible.h>

Inheritance diagram for nsAccessible:
Collaboration diagram for nsAccessible:

List of all members.

Classes

class  nsRunnableMethod_DispatchClickEvent

Public Member Functions

 nsAccessible (nsIContent *aContent, nsIWeakReference *aShell)
virtual ~nsAccessible ()
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLE
NS_DECL_NSIACCESSIBLEHYPERLINK
NS_DECL_NSIACCESSIBLESELECTABLE
virtual
NS_DECL_NSIACCESSIBLEVALUE
void 
Shutdown ()
 Shutdown the access node object.
nsresult GetARIAName (nsAString &aName)
 Returns the accessible name specified by ARIA.
virtual nsresult GetARIAState (PRUint32 *aState, PRUint32 *aExtraState)
 Maps ARIA state attributes to state of accessible.
virtual nsresult GetNameInternal (nsAString &aName)
 Returns the accessible name provided by native markup.
PRUint32 Role ()
 Return enumerated accessible role (see constants in nsIAccessibleRole).
PRUint32 ARIARole ()
 Return accessible role specified by ARIA (see constants in nsIAccessibleRole).
virtual PRUint32 NativeRole ()
 Returns enumerated accessible role from native markup (see constants in nsIAccessibleRole).
virtual nsresult GetStateInternal (PRUint32 *aState, PRUint32 *aExtraState)
 Return the state of accessible that doesn't take into account ARIA states.
virtual nsresult GetAttributesInternal (nsIPersistentProperties *aAttributes)
 Returns attributes for accessible without explicitly setted ARIA attributes.
virtual nsresult GetChildAtPoint (PRInt32 aX, PRInt32 aY, PRBool aDeepestChild, nsIAccessible **aChild)
 Return direct or deepest child at the given point.
virtual PRInt32 GetLevelInternal ()
 Return calculated group level based on accessible hierarchy.
virtual void GetPositionAndSizeInternal (PRInt32 *aPosInSet, PRInt32 *aSetSize)
 Calculate position in group and group size ('posinset' and 'setsize') based on accessible hierarchy.
virtual void SetRoleMapEntry (nsRoleMapEntry *aRoleMapEntry)
 Set the ARIA role map entry for a new accessible.
bool UpdateChildren ()
 Update the children cache.
PRBool EnsureChildren ()
 Cache children if necessary.
virtual void InvalidateChildren ()
 Set the child count to -1 (unknown) and null out cached child pointers.
virtual PRBool AppendChild (nsAccessible *aChild)
 Append/insert/remove a child.
virtual PRBool InsertChildAt (PRUint32 aIndex, nsAccessible *aChild)
virtual PRBool RemoveChild (nsAccessible *aChild)
virtual nsAccessibleGetParent ()
 Return parent accessible.
virtual nsAccessibleGetChildAt (PRUint32 aIndex)
 Return child accessible at the given index.
virtual PRInt32 GetChildCount ()
 Return child accessible count.
virtual PRInt32 GetIndexOf (nsAccessible *aChild)
 Return index of the given child accessible.
virtual PRInt32 GetIndexInParent ()
 Return index in parent accessible.
PRBool HasChildren ()
 Return true if accessible has children;.
PRInt32 GetEmbeddedChildCount ()
 Return embedded accessible children count.
nsAccessibleGetEmbeddedChildAt (PRUint32 aIndex)
 Return embedded accessible child at the given index.
PRInt32 GetIndexOfEmbeddedChild (nsAccessible *aChild)
 Return index of the given embedded accessible child.
nsAccessibleGetCachedParent () const
 Return cached accessible of parent-child relatives.
nsAccessibleGetCachedNextSibling () const
nsAccessibleGetCachedPrevSibling () const
PRUint32 GetCachedChildCount () const
nsAccessibleGetCachedChildAt (PRUint32 aIndex) const
PRBool AreChildrenCached () const
bool IsBoundToParent () const
virtual nsresult HandleAccEvent (AccEvent *aAccEvent)
 Handle accessible event, i.e.
virtual PRBool GetAllowsAnonChildAccessibles ()
 Return true if there are accessible children in anonymous content.
virtual nsresult AppendTextTo (nsAString &aText, PRUint32 aStartOffset, PRUint32 aLength)
 Returns text of accessible if accessible has text role otherwise empty string.
void TestChildCache (nsAccessible *aCachedChild)
 Assert if child not in parent's cache if the cache was initialized at this point.
virtual bool IsHyperLink ()
 Return true if the accessible is hyper link accessible.
virtual PRUint32 StartOffset ()
 Return the start offset of the link within the parent accessible.
virtual PRUint32 EndOffset ()
 Return the end offset of the link within the parent accessible.
virtual bool IsValid ()
 Return true if the link is valid (e.
virtual bool IsSelected ()
 Return true if the link currently has the focus.
virtual PRUint32 AnchorCount ()
 Return the number of anchors within the link.
virtual nsAccessibleGetAnchor (PRUint32 aAnchorIndex)
 Returns an anchor accessible at the given index.
virtual already_AddRefed< nsIURIGetAnchorURI (PRUint32 aAnchorIndex)
 Returns an anchor URI at the given index.
virtual bool IsSelect ()
 Return true if the accessible is a select control containing selectable items.
virtual already_AddRefed
< nsIArray
SelectedItems ()
 Return an array of selected items.
virtual PRUint32 SelectedItemCount ()
 Return the number of selected items.
virtual nsAccessibleGetSelectedItem (PRUint32 aIndex)
 Return selected item at the given index.
virtual bool IsItemSelected (PRUint32 aIndex)
 Determine if item at the given index is selected.
virtual bool AddItemToSelection (PRUint32 aIndex)
 Add item at the given index the selection.
virtual bool RemoveItemFromSelection (PRUint32 aIndex)
 Remove item at the given index from the selection.
virtual bool SelectAll ()
 Select all items.
virtual bool UnselectAll ()
 Unselect all items.

Protected Types

enum  ChildrenFlags { eChildrenUninitialized = 0x00, eMixedChildren = 0x01, eEmbeddedChildren = 0x02 }

Protected Member Functions

virtual void CacheChildren ()
 Cache accessible children.
virtual void BindToParent (nsAccessible *aParent, PRUint32 aIndexInParent)
 Set accessible parent and index in parent.
void UnbindFromParent ()
virtual nsAccessibleGetSiblingAtOffset (PRInt32 aOffset, nsresult *aError=0L)
 Return sibling accessible at the given offset.
PRUint32 ARIARoleInternal ()
 Return ARIA role (helper method).
virtual nsIFrame * GetBoundsFrame ()
virtual void GetBoundsRect (nsRect &aRect, nsIFrame **aRelativeFrame)
PRBool IsVisible (PRBool *aIsOffscreen)
nsresult GetHTMLName (nsAString &aName)
 Compute the name of HTML node.
nsresult GetXULName (nsAString &aName)
 Compute the name for XUL node.
nsAccessibleGetFirstAvailableAccessible (nsINode *aStartNode) const
 Return an accessible for the given DOM node, or if that node isn't accessible, return the accessible for the next DOM node which has one (based on forward depth first search).
void DoCommand (nsIContent *aContent=0L, PRUint32 aActionIndex=0)
 Prepares click action that will be invoked in timeout.
virtual void DispatchClickEvent (nsIContent *aContent, PRUint32 aActionIndex)
 Dispatch click event.
PRBool CheckVisibilityInParentChain (nsIDocument *aDocument, nsIView *aView)
nsIDOMNodeGetAtomicRegion ()
 Get the container node for an atomic region, defined by aria-atomic="true".
nsresult GetAttrValue (nsIAtom *aAriaProperty, double *aValue)
 Get numeric value of the given ARIA attribute.
PRUint32 GetActionRule (PRUint32 aStates)
 Return the action rule based on ARIA enum constants EActionRule (see nsARIAMap.h).
AccGroupInfo * GetGroupInfo ()
 Return group info.
virtual nsresult FirePlatformEvent (AccEvent *aEvent)=0
 Fires platform accessible event.

Static Protected Member Functions

static nsresult GetFullKeyName (const nsAString &aModifierName, const nsAString &aKeyName, nsAString &aStringOut)
static nsresult GetTranslatedString (const nsAString &aKey, nsAString &aStringOut)

Protected Attributes

nsRefPtr< nsAccessiblemParent
nsTArray< nsRefPtr
< nsAccessible > > 
mChildren
PRInt32 mIndexInParent
ChildrenFlags mChildrenFlags
nsAutoPtr< EmbeddedObjCollector > mEmbeddedObjCollector
PRInt32 mIndexOfEmbeddedChild
nsAutoPtr< AccGroupInfo > mGroupInfo
nsRoleMapEntrymRoleMapEntry

Friends

class EmbeddedObjCollector
class AccGroupInfo

Member Enumeration Documentation

enum nsAccessible::ChildrenFlags [protected]
Enumerator:
eChildrenUninitialized 
eMixedChildren 
eEmbeddedChildren 

Constructor & Destructor Documentation

nsAccessible::nsAccessible ( nsIContent *  aContent,
nsIWeakReference aShell 
)
virtual nsAccessible::~nsAccessible (  )  [virtual]

Member Function Documentation

virtual bool nsAccessible::AddItemToSelection ( PRUint32  aIndex  )  [virtual]

Add item at the given index the selection.

Return true if success.

virtual PRUint32 nsAccessible::AnchorCount (  )  [virtual]

Return the number of anchors within the link.

virtual PRBool nsAccessible::AppendChild ( nsAccessible aChild  )  [virtual]

Append/insert/remove a child.

Return true if operation was successful.

virtual nsresult nsAccessible::AppendTextTo ( nsAString aText,
PRUint32  aStartOffset,
PRUint32  aLength 
) [virtual]

Returns text of accessible if accessible has text role otherwise empty string.

Parameters:
aText returned text of the accessible
aStartOffset start offset inside of the accesible
aLength required lenght of text
PRBool nsAccessible::AreChildrenCached (  )  const [inline]
PRUint32 nsAccessible::ARIARole (  )  [inline]

Return accessible role specified by ARIA (see constants in nsIAccessibleRole).

PRUint32 nsAccessible::ARIARoleInternal (  )  [protected]

Return ARIA role (helper method).

virtual void nsAccessible::BindToParent ( nsAccessible aParent,
PRUint32  aIndexInParent 
) [protected, virtual]

Set accessible parent and index in parent.

virtual void nsAccessible::CacheChildren (  )  [protected, virtual]

Cache accessible children.

PRBool nsAccessible::CheckVisibilityInParentChain ( nsIDocument *  aDocument,
nsIView *  aView 
) [protected]
virtual void nsAccessible::DispatchClickEvent ( nsIContent *  aContent,
PRUint32  aActionIndex 
) [protected, virtual]

Dispatch click event.

void nsAccessible::DoCommand ( nsIContent *  aContent = 0L,
PRUint32  aActionIndex = 0 
) [protected]

Prepares click action that will be invoked in timeout.

Note:
DoCommand() prepares an action in timeout because when action command opens a modal dialog/window, it won't return until the dialog/window is closed. If executing action command directly in nsIAccessible::DoAction() method, it will block AT tools (e.g. GOK) that invoke action of mozilla accessibles direclty (see bug 277888 for details).
Parameters:
aContent [in, optional] element to click
aActionIndex [in, optional] index of accessible action
virtual PRUint32 nsAccessible::EndOffset (  )  [virtual]

Return the end offset of the link within the parent accessible.

PRBool nsAccessible::EnsureChildren (  ) 

Cache children if necessary.

Return true if the accessible is defunct.

virtual nsresult nsAccessible::FirePlatformEvent ( AccEvent *  aEvent  )  [protected, pure virtual]

Fires platform accessible event.

It's notification method only. It does change nothing on Gecko side. Don't use it until you're sure what you do (see example in XUL tree accessible), use nsEventShell::FireEvent() instead. MUST be overridden in wrap classes.

Parameters:
aEvent the accessible event to fire.

Implemented in nsAccessibleWrap.

PRUint32 nsAccessible::GetActionRule ( PRUint32  aStates  )  [protected]

Return the action rule based on ARIA enum constants EActionRule (see nsARIAMap.h).

Used by GetNumActions() and GetActionName().

Parameters:
aStates [in] states of the accessible
virtual PRBool nsAccessible::GetAllowsAnonChildAccessibles (  )  [virtual]

Return true if there are accessible children in anonymous content.

virtual nsAccessible* nsAccessible::GetAnchor ( PRUint32  aAnchorIndex  )  [virtual]

Returns an anchor accessible at the given index.

virtual already_AddRefed<nsIURI> nsAccessible::GetAnchorURI ( PRUint32  aAnchorIndex  )  [virtual]

Returns an anchor URI at the given index.

nsresult nsAccessible::GetARIAName ( nsAString aName  ) 

Returns the accessible name specified by ARIA.

virtual nsresult nsAccessible::GetARIAState ( PRUint32 *  aState,
PRUint32 *  aExtraState 
) [virtual]

Maps ARIA state attributes to state of accessible.

Note the given state argument should hold states for accessible before you pass it into this method.

Parameters:
[in/out] where to fill the states into.
[in/out] where to fill the extra states into
nsIDOMNode* nsAccessible::GetAtomicRegion (  )  [protected]

Get the container node for an atomic region, defined by aria-atomic="true".

Returns:
the container node
virtual nsresult nsAccessible::GetAttributesInternal ( nsIPersistentProperties aAttributes  )  [virtual]

Returns attributes for accessible without explicitly setted ARIA attributes.

Reimplemented in nsHyperTextAccessible.

nsresult nsAccessible::GetAttrValue ( nsIAtom aAriaProperty,
double *  aValue 
) [protected]

Get numeric value of the given ARIA attribute.

Parameters:
aAriaProperty - the ARIA property we're using
aValue - value of the attribute
Returns:
- NS_OK_NO_ARIA_VALUE if there is no setted ARIA attribute
virtual nsIFrame* nsAccessible::GetBoundsFrame (  )  [protected, virtual]
virtual void nsAccessible::GetBoundsRect ( nsRect aRect,
nsIFrame **  aRelativeFrame 
) [protected, virtual]
nsAccessible* nsAccessible::GetCachedChildAt ( PRUint32  aIndex  )  const [inline]
PRUint32 nsAccessible::GetCachedChildCount (  )  const [inline]
nsAccessible* nsAccessible::GetCachedNextSibling (  )  const [inline]
nsAccessible* nsAccessible::GetCachedParent (  )  const [inline]

Return cached accessible of parent-child relatives.

nsAccessible* nsAccessible::GetCachedPrevSibling (  )  const [inline]
virtual nsAccessible* nsAccessible::GetChildAt ( PRUint32  aIndex  )  [virtual]

Return child accessible at the given index.

virtual nsresult nsAccessible::GetChildAtPoint ( PRInt32  aX,
PRInt32  aY,
PRBool  aDeepestChild,
nsIAccessible **  aChild 
) [virtual]

Return direct or deepest child at the given point.

Parameters:
aX [in] x coordinate relative screen
aY [in] y coordinate relative screen
aDeepestChild [in] flag points if deep child should be returned
aChild [out] found child
virtual PRInt32 nsAccessible::GetChildCount (  )  [virtual]

Return child accessible count.

nsAccessible* nsAccessible::GetEmbeddedChildAt ( PRUint32  aIndex  ) 

Return embedded accessible child at the given index.

PRInt32 nsAccessible::GetEmbeddedChildCount (  ) 

Return embedded accessible children count.

nsAccessible* nsAccessible::GetFirstAvailableAccessible ( nsINode *  aStartNode  )  const [protected]

Return an accessible for the given DOM node, or if that node isn't accessible, return the accessible for the next DOM node which has one (based on forward depth first search).

Parameters:
aStartNode [in] the DOM node to start from
Returns:
the resulting accessible
static nsresult nsAccessible::GetFullKeyName ( const nsAString aModifierName,
const nsAString aKeyName,
nsAString aStringOut 
) [static, protected]
AccGroupInfo* nsAccessible::GetGroupInfo (  )  [protected]

Return group info.

nsresult nsAccessible::GetHTMLName ( nsAString aName  )  [protected]

Compute the name of HTML node.

virtual PRInt32 nsAccessible::GetIndexInParent (  )  [virtual]

Return index in parent accessible.

virtual PRInt32 nsAccessible::GetIndexOf ( nsAccessible aChild  )  [virtual]

Return index of the given child accessible.

PRInt32 nsAccessible::GetIndexOfEmbeddedChild ( nsAccessible aChild  ) 

Return index of the given embedded accessible child.

virtual PRInt32 nsAccessible::GetLevelInternal (  )  [virtual]

Return calculated group level based on accessible hierarchy.

Reimplemented in nsHyperTextAccessible.

virtual nsresult nsAccessible::GetNameInternal ( nsAString aName  )  [virtual]

Returns the accessible name provided by native markup.

It doesn't take into account ARIA markup used to specify the name.

Parameters:
aName [out] the accessible name
Returns:
NS_OK_EMPTY_NAME points empty name was specified by native markup explicitly (see nsIAccessible::name attribute for details)
virtual nsAccessible* nsAccessible::GetParent (  )  [virtual]

Return parent accessible.

virtual void nsAccessible::GetPositionAndSizeInternal ( PRInt32 *  aPosInSet,
PRInt32 *  aSetSize 
) [virtual]

Calculate position in group and group size ('posinset' and 'setsize') based on accessible hierarchy.

Parameters:
aPosInSet [out] accessible position in the group
aSetSize [out] the group size
virtual nsAccessible* nsAccessible::GetSelectedItem ( PRUint32  aIndex  )  [virtual]

Return selected item at the given index.

virtual nsAccessible* nsAccessible::GetSiblingAtOffset ( PRInt32  aOffset,
nsresult aError = 0L 
) [protected, virtual]

Return sibling accessible at the given offset.

virtual nsresult nsAccessible::GetStateInternal ( PRUint32 *  aState,
PRUint32 *  aExtraState 
) [virtual]

Return the state of accessible that doesn't take into account ARIA states.

Use nsIAccessible::state to get all states for accessible. If second argument is omitted then second bit field of accessible state won't be calculated.

Reimplemented in nsHyperTextAccessible.

static nsresult nsAccessible::GetTranslatedString ( const nsAString aKey,
nsAString aStringOut 
) [static, protected]
nsresult nsAccessible::GetXULName ( nsAString aName  )  [protected]

Compute the name for XUL node.

virtual nsresult nsAccessible::HandleAccEvent ( AccEvent *  aAccEvent  )  [virtual]

Handle accessible event, i.e.

process it, notifies observers and fires platform specific event.

Reimplemented in nsAccessibleWrap.

PRBool nsAccessible::HasChildren (  )  [inline]

Return true if accessible has children;.

virtual PRBool nsAccessible::InsertChildAt ( PRUint32  aIndex,
nsAccessible aChild 
) [virtual]
virtual void nsAccessible::InvalidateChildren (  )  [virtual]

Set the child count to -1 (unknown) and null out cached child pointers.

Should be called when accessible tree is changed because document has transformed. Note, if accessible cares about its parent relation chain itself should override this method to do nothing.

Reimplemented in nsHyperTextAccessible.

bool nsAccessible::IsBoundToParent (  )  const [inline]
virtual bool nsAccessible::IsHyperLink (  )  [virtual]

Return true if the accessible is hyper link accessible.

virtual bool nsAccessible::IsItemSelected ( PRUint32  aIndex  )  [virtual]

Determine if item at the given index is selected.

virtual bool nsAccessible::IsSelect (  )  [virtual]

Return true if the accessible is a select control containing selectable items.

virtual bool nsAccessible::IsSelected (  )  [virtual]

Return true if the link currently has the focus.

virtual bool nsAccessible::IsValid (  )  [virtual]

Return true if the link is valid (e.

g. points to a valid URL).

PRBool nsAccessible::IsVisible ( PRBool aIsOffscreen  )  [protected]
virtual PRUint32 nsAccessible::NativeRole (  )  [virtual]

Returns enumerated accessible role from native markup (see constants in nsIAccessibleRole).

Doesn't take into account ARIA roles.

Reimplemented in nsHyperTextAccessible.

virtual PRBool nsAccessible::RemoveChild ( nsAccessible aChild  )  [virtual]
virtual bool nsAccessible::RemoveItemFromSelection ( PRUint32  aIndex  )  [virtual]

Remove item at the given index from the selection.

Return if success.

PRUint32 nsAccessible::Role (  )  [inline]

Return enumerated accessible role (see constants in nsIAccessibleRole).

virtual bool nsAccessible::SelectAll (  )  [virtual]

Select all items.

Return true if success.

virtual PRUint32 nsAccessible::SelectedItemCount (  )  [virtual]

Return the number of selected items.

virtual already_AddRefed<nsIArray> nsAccessible::SelectedItems (  )  [virtual]

Return an array of selected items.

virtual void nsAccessible::SetRoleMapEntry ( nsRoleMapEntry aRoleMapEntry  )  [virtual]

Set the ARIA role map entry for a new accessible.

For a newly created accessible, specify which role map entry should be used.

Parameters:
aRoleMapEntry The ARIA nsRoleMapEntry* for the accessible, or nsnull if none.
NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIACCESSIBLE NS_DECL_NSIACCESSIBLEHYPERLINK NS_DECL_NSIACCESSIBLESELECTABLE virtual NS_DECL_NSIACCESSIBLEVALUE void nsAccessible::Shutdown (  )  [virtual]

Shutdown the access node object.

Reimplemented from nsAccessNode.

Reimplemented in nsAccessibleWrap.

virtual PRUint32 nsAccessible::StartOffset (  )  [virtual]

Return the start offset of the link within the parent accessible.

void nsAccessible::TestChildCache ( nsAccessible aCachedChild  ) 

Assert if child not in parent's cache if the cache was initialized at this point.

void nsAccessible::UnbindFromParent (  )  [protected]
virtual bool nsAccessible::UnselectAll (  )  [virtual]

Unselect all items.

Return true if success.

bool nsAccessible::UpdateChildren (  )  [inline]

Update the children cache.


Friends And Related Function Documentation

friend class AccGroupInfo [friend]
friend class EmbeddedObjCollector [friend]

Member Data Documentation

nsAutoPtr<EmbeddedObjCollector> nsAccessible::mEmbeddedObjCollector [protected]
nsAutoPtr<AccGroupInfo> nsAccessible::mGroupInfo [protected]
PRInt32 nsAccessible::mIndexInParent [protected]

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