2007-11-12 01:05:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-02-14 20:51:33 +00:00
|
|
|
|
2012-05-29 01:18:45 +00:00
|
|
|
#ifndef _Accessible_H_
|
|
|
|
#define _Accessible_H_
|
2001-02-14 20:51:33 +00:00
|
|
|
|
2012-12-18 05:22:26 +00:00
|
|
|
#include "mozilla/a11y/AccTypes.h"
|
2012-01-12 03:07:35 +00:00
|
|
|
#include "mozilla/a11y/Role.h"
|
2011-07-27 12:43:01 +00:00
|
|
|
#include "mozilla/a11y/States.h"
|
2012-01-12 03:07:35 +00:00
|
|
|
#include "nsAccessNodeWrap.h"
|
2007-05-20 02:41:33 +00:00
|
|
|
|
2001-10-09 21:52:36 +00:00
|
|
|
#include "nsIAccessible.h"
|
2006-06-21 13:29:10 +00:00
|
|
|
#include "nsIAccessibleHyperLink.h"
|
2005-07-14 14:20:21 +00:00
|
|
|
#include "nsIAccessibleSelectable.h"
|
2006-06-15 16:55:32 +00:00
|
|
|
#include "nsIAccessibleValue.h"
|
2007-05-20 02:41:33 +00:00
|
|
|
#include "nsIAccessibleStates.h"
|
2012-08-01 18:31:10 +00:00
|
|
|
#include "nsIContent.h"
|
2007-05-20 02:41:33 +00:00
|
|
|
|
2010-04-27 06:52:03 +00:00
|
|
|
#include "nsStringGlue.h"
|
2009-01-18 20:14:14 +00:00
|
|
|
#include "nsTArray.h"
|
2010-06-21 13:08:27 +00:00
|
|
|
#include "nsRefPtrHashtable.h"
|
2010-04-27 06:52:03 +00:00
|
|
|
|
2012-04-13 14:17:03 +00:00
|
|
|
struct nsRoleMapEntry;
|
2012-05-01 03:08:31 +00:00
|
|
|
|
2012-11-18 02:01:44 +00:00
|
|
|
struct nsRect;
|
|
|
|
class nsIContent;
|
|
|
|
class nsIFrame;
|
|
|
|
class nsIAtom;
|
2013-01-03 13:23:11 +00:00
|
|
|
class nsView;
|
2012-11-18 02:01:44 +00:00
|
|
|
|
2012-03-28 00:53:58 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
2012-05-08 05:16:40 +00:00
|
|
|
|
2012-11-18 02:01:44 +00:00
|
|
|
class Accessible;
|
|
|
|
class AccEvent;
|
|
|
|
class AccGroupInfo;
|
2012-08-28 13:13:59 +00:00
|
|
|
class EmbeddedObjCollector;
|
2012-06-04 12:32:34 +00:00
|
|
|
class HTMLImageMapAccessible;
|
2012-05-08 05:16:40 +00:00
|
|
|
class HTMLLIAccessible;
|
2012-11-18 02:01:44 +00:00
|
|
|
class HyperTextAccessible;
|
2012-06-02 11:30:34 +00:00
|
|
|
class ImageAccessible;
|
2012-11-18 02:01:44 +00:00
|
|
|
class KeyBinding;
|
2012-06-10 22:18:31 +00:00
|
|
|
class Relation;
|
2012-03-28 00:53:58 +00:00
|
|
|
class TableAccessible;
|
2012-08-09 06:24:31 +00:00
|
|
|
class TableCellAccessible;
|
2012-05-23 18:05:57 +00:00
|
|
|
class TextLeafAccessible;
|
2012-06-08 10:28:27 +00:00
|
|
|
class XULTreeAccessible;
|
2012-05-01 03:08:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Name type flags.
|
|
|
|
*/
|
|
|
|
enum ENameValueFlag {
|
|
|
|
/**
|
|
|
|
* Name either
|
|
|
|
* a) present (not empty): !name.IsEmpty()
|
|
|
|
* b) no name (was missed): name.IsVoid()
|
|
|
|
*/
|
|
|
|
eNameOK,
|
2012-10-14 04:18:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Name was left empty by the author on purpose:
|
|
|
|
* name.IsEmpty() && !name.IsVoid().
|
|
|
|
*/
|
|
|
|
eNoNameOnPurpose,
|
|
|
|
|
2012-10-17 06:38:16 +00:00
|
|
|
/**
|
|
|
|
* Name was computed from the subtree.
|
|
|
|
*/
|
|
|
|
eNameFromSubtree,
|
|
|
|
|
2012-10-14 04:18:39 +00:00
|
|
|
/**
|
|
|
|
* Tooltip was used as a name.
|
|
|
|
*/
|
|
|
|
eNameFromTooltip
|
2012-05-01 03:08:31 +00:00
|
|
|
};
|
|
|
|
|
2012-05-30 00:51:00 +00:00
|
|
|
/**
|
|
|
|
* Group position (level, position in set and set size).
|
|
|
|
*/
|
|
|
|
struct GroupPos
|
|
|
|
{
|
|
|
|
GroupPos() : level(0), posInSet(0), setSize(0) { }
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t level;
|
|
|
|
int32_t posInSet;
|
|
|
|
int32_t setSize;
|
2012-05-30 00:51:00 +00:00
|
|
|
};
|
|
|
|
|
2012-05-29 01:18:45 +00:00
|
|
|
typedef nsRefPtrHashtable<nsPtrHashKey<const void>, Accessible>
|
|
|
|
AccessibleHashtable;
|
2010-04-27 06:52:03 +00:00
|
|
|
|
2007-03-08 15:25:35 +00:00
|
|
|
|
2010-04-27 06:52:03 +00:00
|
|
|
#define NS_ACCESSIBLE_IMPL_IID \
|
2010-01-19 04:23:44 +00:00
|
|
|
{ /* 133c8bf4-4913-4355-bd50-426bd1d6e1ad */ \
|
|
|
|
0x133c8bf4, \
|
|
|
|
0x4913, \
|
|
|
|
0x4355, \
|
|
|
|
{ 0xbd, 0x50, 0x42, 0x6b, 0xd1, 0xd6, 0xe1, 0xad } \
|
2008-10-10 12:26:55 +00:00
|
|
|
}
|
|
|
|
|
2012-06-08 10:28:27 +00:00
|
|
|
class Accessible : public nsAccessNodeWrap,
|
|
|
|
public nsIAccessible,
|
2012-05-29 01:18:45 +00:00
|
|
|
public nsIAccessibleHyperLink,
|
|
|
|
public nsIAccessibleSelectable,
|
|
|
|
public nsIAccessibleValue
|
2001-02-14 20:51:33 +00:00
|
|
|
{
|
2001-06-30 00:25:09 +00:00
|
|
|
public:
|
2012-05-29 01:18:45 +00:00
|
|
|
Accessible(nsIContent* aContent, DocAccessible* aDoc);
|
|
|
|
virtual ~Accessible();
|
Bug 109851, bug 108629, bug 109921, bug 109977, bug 109153, bug 109187, bug 109213, bug 109221. Check in latest XUL accessibility support - menus, <colorpicker>, <progressmeter>, <groupbox>, mixed states for checkboxes, buttons that can be 'checked' ie pressed down, fixes extra MSAA events being generated, couldn't see HTML content
2001-11-20 02:05:26 +00:00
|
|
|
|
2003-04-01 20:02:51 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2012-05-29 01:18:45 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(Accessible, nsAccessNode)
|
2008-08-06 12:19:56 +00:00
|
|
|
|
2003-04-01 20:02:51 +00:00
|
|
|
NS_DECL_NSIACCESSIBLE
|
2006-06-21 13:29:10 +00:00
|
|
|
NS_DECL_NSIACCESSIBLEHYPERLINK
|
2005-07-14 14:20:21 +00:00
|
|
|
NS_DECL_NSIACCESSIBLESELECTABLE
|
2006-06-15 16:55:32 +00:00
|
|
|
NS_DECL_NSIACCESSIBLEVALUE
|
2010-04-27 06:52:03 +00:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ACCESSIBLE_IMPL_IID)
|
2003-04-01 20:02:51 +00:00
|
|
|
|
2008-11-01 03:58:07 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsAccessNode
|
|
|
|
|
2010-06-12 04:04:35 +00:00
|
|
|
virtual void Shutdown();
|
2003-05-01 10:25:45 +00:00
|
|
|
|
2008-10-10 12:26:55 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Public methods
|
|
|
|
|
2011-04-23 13:14:05 +00:00
|
|
|
/**
|
2012-04-09 09:48:41 +00:00
|
|
|
* Get the description of this accessible.
|
2011-04-23 13:14:05 +00:00
|
|
|
*/
|
|
|
|
virtual void Description(nsString& aDescription);
|
|
|
|
|
2012-04-09 09:48:41 +00:00
|
|
|
/**
|
|
|
|
* Get the value of this accessible.
|
|
|
|
*/
|
|
|
|
virtual void Value(nsString& aValue);
|
|
|
|
|
2012-05-01 03:08:31 +00:00
|
|
|
/**
|
|
|
|
* Get the name of this accessible.
|
2012-10-14 04:18:39 +00:00
|
|
|
*
|
|
|
|
* Note: aName.IsVoid() when name was left empty by the author on purpose.
|
|
|
|
* aName.IsEmpty() when the author missed name, AT can try to repair a name.
|
2012-05-01 03:08:31 +00:00
|
|
|
*/
|
2012-11-18 02:01:44 +00:00
|
|
|
virtual ENameValueFlag Name(nsString& aName);
|
2012-05-01 03:08:31 +00:00
|
|
|
|
2012-02-07 13:18:33 +00:00
|
|
|
/**
|
|
|
|
* Return DOM node associated with this accessible.
|
|
|
|
*/
|
|
|
|
inline already_AddRefed<nsIDOMNode> DOMNode() const
|
|
|
|
{
|
2012-07-30 14:20:58 +00:00
|
|
|
nsIDOMNode *DOMNode = nullptr;
|
2012-02-07 13:18:33 +00:00
|
|
|
if (GetNode())
|
|
|
|
CallQueryInterface(GetNode(), &DOMNode);
|
|
|
|
return DOMNode;
|
|
|
|
}
|
|
|
|
|
2009-06-18 07:37:38 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* @param [in/out] where to fill the states into.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual void ApplyARIAState(uint64_t* aState) const;
|
2009-06-18 07:37:38 +00:00
|
|
|
|
2010-09-06 03:33:29 +00:00
|
|
|
/**
|
2012-01-12 03:07:35 +00:00
|
|
|
* Return enumerated accessible role (see constants in Role.h).
|
2010-09-06 03:33:29 +00:00
|
|
|
*/
|
2012-04-13 14:17:03 +00:00
|
|
|
mozilla::a11y::role Role();
|
2010-12-01 08:53:17 +00:00
|
|
|
|
2012-01-20 15:22:31 +00:00
|
|
|
/**
|
|
|
|
* Return true if ARIA role is specified on the element.
|
|
|
|
*/
|
2012-11-30 07:33:01 +00:00
|
|
|
bool HasARIARole() const { return mRoleMapEntry; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrun ARIA role map if any.
|
|
|
|
*/
|
|
|
|
nsRoleMapEntry* ARIARoleMap() const { return mRoleMapEntry; }
|
2012-01-20 15:22:31 +00:00
|
|
|
|
2010-12-01 08:53:17 +00:00
|
|
|
/**
|
|
|
|
* Return accessible role specified by ARIA (see constants in
|
2012-01-12 03:07:35 +00:00
|
|
|
* roles).
|
2010-12-01 08:53:17 +00:00
|
|
|
*/
|
2012-04-13 14:17:03 +00:00
|
|
|
mozilla::a11y::role ARIARole();
|
2010-09-06 03:33:29 +00:00
|
|
|
|
2009-03-07 15:38:58 +00:00
|
|
|
/**
|
|
|
|
* Returns enumerated accessible role from native markup (see constants in
|
2012-01-12 03:07:35 +00:00
|
|
|
* Role.h). Doesn't take into account ARIA roles.
|
2009-03-07 15:38:58 +00:00
|
|
|
*/
|
2012-01-12 03:07:35 +00:00
|
|
|
virtual mozilla::a11y::role NativeRole();
|
2009-03-07 15:38:58 +00:00
|
|
|
|
2007-04-02 15:56:24 +00:00
|
|
|
/**
|
2011-04-09 23:38:06 +00:00
|
|
|
* Return all states of accessible (including ARIA states).
|
2007-04-02 15:56:24 +00:00
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual uint64_t State();
|
2011-04-09 23:38:06 +00:00
|
|
|
|
2012-06-04 05:41:06 +00:00
|
|
|
/**
|
|
|
|
* Return interactive states present on the accessible
|
|
|
|
* (@see NativeInteractiveState).
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
uint64_t InteractiveState() const
|
2012-06-04 05:41:06 +00:00
|
|
|
{
|
2012-08-22 15:56:38 +00:00
|
|
|
uint64_t state = NativeInteractiveState();
|
2012-06-04 05:41:06 +00:00
|
|
|
ApplyARIAState(&state);
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2012-05-17 09:37:37 +00:00
|
|
|
/**
|
|
|
|
* Return link states present on the accessible.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
uint64_t LinkState() const
|
2012-05-17 09:37:37 +00:00
|
|
|
{
|
2012-08-22 15:56:38 +00:00
|
|
|
uint64_t state = NativeLinkState();
|
2012-05-17 09:37:37 +00:00
|
|
|
ApplyARIAState(&state);
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2011-04-09 23:38:06 +00:00
|
|
|
/**
|
|
|
|
* Return the states of accessible, not taking into account ARIA states.
|
|
|
|
* Use State() to get complete set of states.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual uint64_t NativeState();
|
2007-04-02 15:56:24 +00:00
|
|
|
|
2012-06-04 05:41:06 +00:00
|
|
|
/**
|
|
|
|
* Return native interactice state (unavailable, focusable or selectable).
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual uint64_t NativeInteractiveState() const;
|
2012-06-04 05:41:06 +00:00
|
|
|
|
2012-05-17 09:37:37 +00:00
|
|
|
/**
|
|
|
|
* Return native link states present on the accessible.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual uint64_t NativeLinkState() const;
|
2012-05-17 09:37:37 +00:00
|
|
|
|
2012-03-08 03:28:38 +00:00
|
|
|
/**
|
|
|
|
* Return bit set of invisible and offscreen states.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
uint64_t VisibilityState();
|
2012-03-08 03:28:38 +00:00
|
|
|
|
2012-06-04 05:41:06 +00:00
|
|
|
/**
|
|
|
|
* Return true if native unavailable state present.
|
|
|
|
*/
|
|
|
|
virtual bool NativelyUnavailable() const;
|
|
|
|
|
2007-04-07 09:07:24 +00:00
|
|
|
/**
|
2012-10-19 07:15:23 +00:00
|
|
|
* Return object attributes for the accessible.
|
2007-04-07 09:07:24 +00:00
|
|
|
*/
|
2012-10-19 07:15:23 +00:00
|
|
|
virtual already_AddRefed<nsIPersistentProperties> Attributes();
|
2007-04-07 09:07:24 +00:00
|
|
|
|
2012-05-30 00:51:00 +00:00
|
|
|
/**
|
|
|
|
* Return group position (level, position in set and set size).
|
|
|
|
*/
|
|
|
|
virtual mozilla::a11y::GroupPos GroupPosition();
|
|
|
|
|
2011-03-29 04:44:20 +00:00
|
|
|
/**
|
2011-06-13 22:20:54 +00:00
|
|
|
* Used by ChildAtPoint() method to get direct or deepest child at point.
|
2011-03-29 04:44:20 +00:00
|
|
|
*/
|
|
|
|
enum EWhichChildAtPoint {
|
|
|
|
eDirectChild,
|
|
|
|
eDeepestChild
|
|
|
|
};
|
|
|
|
|
2009-05-11 10:57:28 +00:00
|
|
|
/**
|
|
|
|
* Return direct or deepest child at the given point.
|
|
|
|
*
|
2011-03-29 04:44:20 +00:00
|
|
|
* @param aX [in] x coordinate relative screen
|
|
|
|
* @param aY [in] y coordinate relative screen
|
|
|
|
* @param aWhichChild [in] flag points if deepest or direct child
|
|
|
|
* should be returned
|
2009-05-11 10:57:28 +00:00
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
|
2012-05-29 01:18:45 +00:00
|
|
|
EWhichChildAtPoint aWhichChild);
|
2009-05-11 10:57:28 +00:00
|
|
|
|
2011-07-15 22:58:49 +00:00
|
|
|
/**
|
|
|
|
* Return the focused child if any.
|
|
|
|
*/
|
2012-05-29 01:18:45 +00:00
|
|
|
virtual Accessible* FocusedChild();
|
2011-07-15 22:58:49 +00:00
|
|
|
|
2010-01-06 10:36:50 +00:00
|
|
|
/**
|
|
|
|
* Return calculated group level based on accessible hierarchy.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual int32_t GetLevelInternal();
|
2010-01-06 10:36:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Calculate position in group and group size ('posinset' and 'setsize') based
|
|
|
|
* on accessible hierarchy.
|
|
|
|
*
|
|
|
|
* @param aPosInSet [out] accessible position in the group
|
|
|
|
* @param aSetSize [out] the group size
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual void GetPositionAndSizeInternal(int32_t *aPosInSet,
|
|
|
|
int32_t *aSetSize);
|
2010-01-06 10:36:50 +00:00
|
|
|
|
2011-08-10 01:44:00 +00:00
|
|
|
/**
|
|
|
|
* Get the relation of the given type.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual mozilla::a11y::Relation RelationByType(uint32_t aType);
|
2011-08-10 01:44:00 +00:00
|
|
|
|
2008-10-10 12:26:55 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-12-10 19:12:19 +00:00
|
|
|
// Initializing methods
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the ARIA role map entry for a new accessible.
|
|
|
|
*/
|
2012-12-21 03:16:44 +00:00
|
|
|
void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry)
|
|
|
|
{ mRoleMapEntry = aRoleMapEntry; }
|
2009-06-18 07:37:38 +00:00
|
|
|
|
2011-01-27 03:38:50 +00:00
|
|
|
/**
|
|
|
|
* Update the children cache.
|
|
|
|
*/
|
|
|
|
inline bool UpdateChildren()
|
|
|
|
{
|
|
|
|
InvalidateChildren();
|
|
|
|
return EnsureChildren();
|
|
|
|
}
|
|
|
|
|
2010-04-08 06:43:08 +00:00
|
|
|
/**
|
|
|
|
* Cache children if necessary. Return true if the accessible is defunct.
|
|
|
|
*/
|
2011-01-28 04:38:02 +00:00
|
|
|
bool EnsureChildren();
|
2010-04-08 06:43:08 +00:00
|
|
|
|
2009-06-18 07:37:38 +00:00
|
|
|
/**
|
2009-12-10 19:12:19 +00:00
|
|
|
* Set the child count to -1 (unknown) and null out cached child pointers.
|
|
|
|
* Should be called when accessible tree is changed because document has
|
2010-07-02 01:22:41 +00:00
|
|
|
* transformed. Note, if accessible cares about its parent relation chain
|
|
|
|
* itself should override this method to do nothing.
|
2009-06-18 07:37:38 +00:00
|
|
|
*/
|
2009-12-10 19:12:19 +00:00
|
|
|
virtual void InvalidateChildren();
|
|
|
|
|
2010-06-08 16:39:58 +00:00
|
|
|
/**
|
2010-07-02 01:22:41 +00:00
|
|
|
* Append/insert/remove a child. Return true if operation was successful.
|
2010-06-08 16:39:58 +00:00
|
|
|
*/
|
2012-05-29 01:18:45 +00:00
|
|
|
virtual bool AppendChild(Accessible* aChild);
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild);
|
2012-05-29 01:18:45 +00:00
|
|
|
virtual bool RemoveChild(Accessible* aChild);
|
2010-06-08 16:39:58 +00:00
|
|
|
|
2009-12-10 19:12:19 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Accessible tree traverse methods
|
2009-06-18 07:37:38 +00:00
|
|
|
|
|
|
|
/**
|
2009-12-10 19:12:19 +00:00
|
|
|
* Return parent accessible.
|
2009-06-18 07:37:38 +00:00
|
|
|
*/
|
2012-05-29 01:18:45 +00:00
|
|
|
Accessible* Parent() const { return mParent; }
|
2009-06-18 07:37:38 +00:00
|
|
|
|
|
|
|
/**
|
2009-12-10 19:12:19 +00:00
|
|
|
* Return child accessible at the given index.
|
2009-11-19 14:44:59 +00:00
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual Accessible* GetChildAt(uint32_t aIndex);
|
2009-11-19 14:44:59 +00:00
|
|
|
|
|
|
|
/**
|
2009-12-10 19:12:19 +00:00
|
|
|
* Return child accessible count.
|
2009-11-19 14:44:59 +00:00
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual uint32_t ChildCount() const;
|
2009-12-10 19:12:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return index of the given child accessible.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual int32_t GetIndexOf(Accessible* aChild);
|
2009-12-10 19:12:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return index in parent accessible.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual int32_t IndexInParent() const;
|
2009-06-18 07:37:38 +00:00
|
|
|
|
2010-05-21 11:27:00 +00:00
|
|
|
/**
|
|
|
|
* Return true if accessible has children;
|
|
|
|
*/
|
2011-09-29 06:19:26 +00:00
|
|
|
bool HasChildren() { return !!GetChildAt(0); }
|
2010-05-21 11:27:00 +00:00
|
|
|
|
2011-06-07 02:23:13 +00:00
|
|
|
/**
|
2011-07-23 08:38:33 +00:00
|
|
|
* Return first/last/next/previous sibling of the accessible.
|
2011-06-07 02:23:13 +00:00
|
|
|
*/
|
2012-05-29 01:18:45 +00:00
|
|
|
inline Accessible* NextSibling() const
|
2011-06-07 02:23:13 +00:00
|
|
|
{ return GetSiblingAtOffset(1); }
|
2012-05-29 01:18:45 +00:00
|
|
|
inline Accessible* PrevSibling() const
|
2011-06-07 02:23:13 +00:00
|
|
|
{ return GetSiblingAtOffset(-1); }
|
2012-05-29 01:18:45 +00:00
|
|
|
inline Accessible* FirstChild()
|
2012-05-25 10:53:45 +00:00
|
|
|
{ return GetChildAt(0); }
|
2012-05-29 01:18:45 +00:00
|
|
|
inline Accessible* LastChild()
|
2011-07-23 08:38:33 +00:00
|
|
|
{
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t childCount = ChildCount();
|
2012-07-30 14:20:58 +00:00
|
|
|
return childCount != 0 ? GetChildAt(childCount - 1) : nullptr;
|
2011-07-23 08:38:33 +00:00
|
|
|
}
|
|
|
|
|
2011-06-07 02:23:13 +00:00
|
|
|
|
2010-08-15 11:28:49 +00:00
|
|
|
/**
|
|
|
|
* Return embedded accessible children count.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t EmbeddedChildCount();
|
2010-08-15 11:28:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return embedded accessible child at the given index.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
Accessible* GetEmbeddedChildAt(uint32_t aIndex);
|
2010-08-15 11:28:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return index of the given embedded accessible child.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t GetIndexOfEmbeddedChild(Accessible* aChild);
|
2010-08-15 11:28:49 +00:00
|
|
|
|
2011-06-07 02:24:01 +00:00
|
|
|
/**
|
|
|
|
* Return number of content children/content child at index. The content
|
|
|
|
* child is created from markup in contrast to it's never constructed by its
|
|
|
|
* parent accessible (like treeitem accessibles for XUL trees).
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t ContentChildCount() const { return mChildren.Length(); }
|
|
|
|
Accessible* ContentChildAt(uint32_t aIndex) const
|
2011-06-07 02:24:01 +00:00
|
|
|
{ return mChildren.ElementAt(aIndex); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if children were initialized.
|
|
|
|
*/
|
2011-01-28 05:15:04 +00:00
|
|
|
inline bool AreChildrenCached() const
|
|
|
|
{ return !IsChildrenFlag(eChildrenUninitialized); }
|
2011-06-07 02:24:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the accessible is attached to tree.
|
|
|
|
*/
|
2011-01-28 04:38:02 +00:00
|
|
|
bool IsBoundToParent() const { return !!mParent; }
|
2009-06-18 07:37:38 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-12-10 19:12:19 +00:00
|
|
|
// Miscellaneous methods
|
2009-06-18 07:37:38 +00:00
|
|
|
|
|
|
|
/**
|
2010-01-19 04:23:44 +00:00
|
|
|
* Handle accessible event, i.e. process it, notifies observers and fires
|
|
|
|
* platform specific event.
|
2009-06-18 07:37:38 +00:00
|
|
|
*/
|
2010-08-25 02:08:28 +00:00
|
|
|
virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
|
2009-06-18 07:37:38 +00:00
|
|
|
|
|
|
|
/**
|
2012-02-08 07:31:25 +00:00
|
|
|
* Return true if this accessible allows accessible children from anonymous subtree.
|
2009-06-18 07:37:38 +00:00
|
|
|
*/
|
2012-02-08 07:31:25 +00:00
|
|
|
virtual bool CanHaveAnonChildren();
|
2009-06-18 07:37:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns text of accessible if accessible has text role otherwise empty
|
|
|
|
* string.
|
|
|
|
*
|
2011-02-01 03:00:24 +00:00
|
|
|
* @param aText [in] returned text of the accessible
|
|
|
|
* @param aStartOffset [in, optional] start offset inside of the accessible,
|
|
|
|
* if missed entire text is appended
|
|
|
|
* @param aLength [in, optional] required length of text, if missed
|
|
|
|
* then text form start offset till the end is appended
|
2009-06-18 07:37:38 +00:00
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0,
|
2012-09-28 06:57:33 +00:00
|
|
|
uint32_t aLength = UINT32_MAX);
|
2009-06-18 07:37:38 +00:00
|
|
|
|
2010-02-09 13:29:22 +00:00
|
|
|
/**
|
2010-03-09 07:25:24 +00:00
|
|
|
* Assert if child not in parent's cache if the cache was initialized at this
|
|
|
|
* point.
|
2010-02-09 13:29:22 +00:00
|
|
|
*/
|
2012-05-29 01:18:45 +00:00
|
|
|
void TestChildCache(Accessible* aCachedChild) const;
|
2010-02-09 13:29:22 +00:00
|
|
|
|
2012-05-08 00:00:36 +00:00
|
|
|
/**
|
|
|
|
* Return boundaries rect relative the bounding frame.
|
|
|
|
*/
|
|
|
|
virtual void GetBoundsRect(nsRect& aRect, nsIFrame** aRelativeFrame);
|
|
|
|
|
2011-01-28 05:15:13 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2011-09-28 01:46:11 +00:00
|
|
|
// Downcasting and types
|
2011-01-28 05:15:13 +00:00
|
|
|
|
2011-11-24 11:31:34 +00:00
|
|
|
inline bool IsAbbreviation() const
|
|
|
|
{
|
|
|
|
return mContent->IsHTML() &&
|
|
|
|
(mContent->Tag() == nsGkAtoms::abbr || mContent->Tag() == nsGkAtoms::acronym);
|
|
|
|
}
|
|
|
|
|
2012-12-18 05:22:26 +00:00
|
|
|
bool IsApplication() const { return mType == eApplicationType; }
|
2011-02-22 13:54:46 +00:00
|
|
|
|
2012-12-21 03:16:44 +00:00
|
|
|
bool IsAutoComplete() const { return HasGenericType(eAutoComplete); }
|
2011-09-28 01:46:11 +00:00
|
|
|
|
2012-12-18 05:22:26 +00:00
|
|
|
bool IsAutoCompletePopup() const
|
2012-12-21 03:16:44 +00:00
|
|
|
{ return HasGenericType(eAutoCompletePopup); }
|
2011-09-28 01:46:11 +00:00
|
|
|
|
2012-12-21 03:16:44 +00:00
|
|
|
bool IsCombobox() const { return HasGenericType(eCombobox); }
|
2011-09-28 01:46:11 +00:00
|
|
|
|
2012-12-21 03:16:44 +00:00
|
|
|
bool IsDoc() const { return HasGenericType(eDocument); }
|
2012-05-27 09:01:40 +00:00
|
|
|
DocAccessible* AsDoc();
|
2011-05-20 05:17:47 +00:00
|
|
|
|
2012-12-21 03:16:44 +00:00
|
|
|
bool IsHyperText() const { return HasGenericType(eHyperText); }
|
2012-05-31 08:04:41 +00:00
|
|
|
HyperTextAccessible* AsHyperText();
|
2011-01-28 05:15:13 +00:00
|
|
|
|
2012-12-18 05:22:26 +00:00
|
|
|
bool IsHTMLFileInput() const { return mType == eHTMLFileInputType; }
|
2011-11-30 12:36:20 +00:00
|
|
|
|
2012-12-18 05:22:26 +00:00
|
|
|
bool IsHTMLListItem() const { return mType == eHTMLLiType; }
|
|
|
|
HTMLLIAccessible* AsHTMLListItem();
|
2012-03-15 20:16:02 +00:00
|
|
|
|
2013-02-16 05:42:00 +00:00
|
|
|
bool IsHTMLTable() const { return mType == eHTMLTableType; }
|
2012-12-18 05:22:26 +00:00
|
|
|
bool IsHTMLTableRow() const { return mType == eHTMLTableRowType; }
|
2011-03-28 13:59:54 +00:00
|
|
|
|
2012-12-18 05:22:26 +00:00
|
|
|
bool IsImage() const { return mType == eImageType; }
|
|
|
|
ImageAccessible* AsImage();
|
2012-03-15 20:16:02 +00:00
|
|
|
|
2012-12-18 05:22:26 +00:00
|
|
|
bool IsImageMap() const { return mType == eImageMapType; }
|
|
|
|
HTMLImageMapAccessible* AsImageMap();
|
2012-04-03 09:54:01 +00:00
|
|
|
|
2012-12-21 03:16:44 +00:00
|
|
|
bool IsList() const { return HasGenericType(eList); }
|
2012-06-28 23:04:50 +00:00
|
|
|
|
2012-12-21 03:16:44 +00:00
|
|
|
bool IsListControl() const { return HasGenericType(eListControl); }
|
2011-09-28 01:46:11 +00:00
|
|
|
|
2012-12-21 03:16:44 +00:00
|
|
|
bool IsMenuButton() const { return HasGenericType(eMenuButton); }
|
2011-09-28 01:46:11 +00:00
|
|
|
|
2012-12-18 05:22:26 +00:00
|
|
|
bool IsMenuPopup() const { return mType == eMenuPopupType; }
|
2011-09-28 01:46:11 +00:00
|
|
|
|
2012-12-18 05:22:26 +00:00
|
|
|
bool IsProgress() const { return mType == eProgressType; }
|
2012-10-16 03:05:20 +00:00
|
|
|
|
2012-12-18 05:22:26 +00:00
|
|
|
bool IsRoot() const { return mType == eRootType; }
|
|
|
|
a11y::RootAccessible* AsRoot();
|
2011-03-02 05:16:28 +00:00
|
|
|
|
2012-12-21 03:16:44 +00:00
|
|
|
bool IsSelect() const { return HasGenericType(eSelect); }
|
2012-03-28 00:53:58 +00:00
|
|
|
|
2012-12-21 03:16:44 +00:00
|
|
|
bool IsTable() const { return HasGenericType(eTable); }
|
2012-12-18 05:22:26 +00:00
|
|
|
virtual TableAccessible* AsTable() { return nullptr; }
|
2012-08-09 06:24:31 +00:00
|
|
|
|
2012-12-18 05:22:26 +00:00
|
|
|
virtual TableCellAccessible* AsTableCell() { return nullptr; }
|
2013-02-14 10:57:35 +00:00
|
|
|
const TableCellAccessible* AsTableCell() const
|
|
|
|
{ return const_cast<Accessible*>(this)->AsTableCell(); }
|
2012-12-18 05:22:26 +00:00
|
|
|
|
2012-12-21 03:16:44 +00:00
|
|
|
bool IsTableRow() const { return HasGenericType(eTableRow); }
|
2012-12-18 05:22:26 +00:00
|
|
|
|
|
|
|
bool IsTextLeaf() const { return mType == eTextLeafType; }
|
|
|
|
TextLeafAccessible* AsTextLeaf();
|
|
|
|
|
2012-12-28 08:15:02 +00:00
|
|
|
bool IsXULTabpanels() const { return mType == eXULTabpanelsType; }
|
2012-12-18 05:22:26 +00:00
|
|
|
|
|
|
|
bool IsXULTree() const { return mType == eXULTreeType; }
|
|
|
|
XULTreeAccessible* AsXULTree();
|
2011-01-31 04:04:32 +00:00
|
|
|
|
2012-12-21 03:16:44 +00:00
|
|
|
/**
|
|
|
|
* Return true if the accessible belongs to the given accessible type.
|
|
|
|
*/
|
|
|
|
bool HasGenericType(AccGenericType aType) const;
|
|
|
|
|
2011-07-19 08:30:24 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// ActionAccessible
|
|
|
|
|
2011-06-05 19:35:43 +00:00
|
|
|
/**
|
|
|
|
* Return the number of actions that can be performed on this accessible.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual uint8_t ActionCount();
|
2011-06-05 19:35:43 +00:00
|
|
|
|
2011-07-19 08:30:24 +00:00
|
|
|
/**
|
|
|
|
* Return access key, such as Alt+D.
|
|
|
|
*/
|
|
|
|
virtual KeyBinding AccessKey() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return global keyboard shortcut for default action, such as Ctrl+O for
|
|
|
|
* Open file menuitem.
|
|
|
|
*/
|
|
|
|
virtual KeyBinding KeyboardShortcut() const;
|
|
|
|
|
2010-09-01 03:26:13 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// HyperLinkAccessible
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the accessible is hyper link accessible.
|
|
|
|
*/
|
2011-06-24 04:29:43 +00:00
|
|
|
virtual bool IsLink();
|
2010-09-01 03:26:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the start offset of the link within the parent accessible.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual uint32_t StartOffset();
|
2010-09-01 03:26:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the end offset of the link within the parent accessible.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual uint32_t EndOffset();
|
2010-09-01 03:26:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the link is valid (e. g. points to a valid URL).
|
|
|
|
*/
|
2011-06-22 05:43:25 +00:00
|
|
|
inline bool IsLinkValid()
|
|
|
|
{
|
2011-06-24 04:29:43 +00:00
|
|
|
NS_PRECONDITION(IsLink(), "IsLinkValid is called on not hyper link!");
|
2011-06-22 05:43:25 +00:00
|
|
|
|
|
|
|
// XXX In order to implement this we would need to follow every link
|
|
|
|
// Perhaps we can get information about invalid links from the cache
|
|
|
|
// In the mean time authors can use role="link" aria-invalid="true"
|
|
|
|
// to force it for links they internally know to be invalid
|
2011-07-27 12:43:01 +00:00
|
|
|
return (0 == (State() & mozilla::a11y::states::INVALID));
|
2011-06-22 05:43:25 +00:00
|
|
|
}
|
2010-09-01 03:26:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the link currently has the focus.
|
|
|
|
*/
|
2011-09-28 01:46:11 +00:00
|
|
|
bool IsLinkSelected();
|
2010-09-01 03:26:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the number of anchors within the link.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual uint32_t AnchorCount();
|
2010-09-01 03:26:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an anchor accessible at the given index.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual Accessible* AnchorAt(uint32_t aAnchorIndex);
|
2010-09-01 03:26:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an anchor URI at the given index.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex);
|
2010-09-01 03:26:13 +00:00
|
|
|
|
2010-09-02 00:46:59 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// SelectAccessible
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return an array of selected items.
|
|
|
|
*/
|
|
|
|
virtual already_AddRefed<nsIArray> SelectedItems();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the number of selected items.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual uint32_t SelectedItemCount();
|
2010-09-02 00:46:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return selected item at the given index.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual Accessible* GetSelectedItem(uint32_t aIndex);
|
2010-09-02 00:46:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine if item at the given index is selected.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual bool IsItemSelected(uint32_t aIndex);
|
2010-09-02 00:46:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add item at the given index the selection. Return true if success.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual bool AddItemToSelection(uint32_t aIndex);
|
2010-09-02 00:46:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove item at the given index from the selection. Return if success.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual bool RemoveItemFromSelection(uint32_t aIndex);
|
2010-09-02 00:46:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Select all items. Return true if success.
|
|
|
|
*/
|
|
|
|
virtual bool SelectAll();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unselect all items. Return true if success.
|
|
|
|
*/
|
|
|
|
virtual bool UnselectAll();
|
|
|
|
|
2011-09-28 01:46:11 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Widgets
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if accessible is a widget, i.e. control or accessible that
|
|
|
|
* manages its items. Note, being a widget the accessible may be a part of
|
|
|
|
* composite widget.
|
|
|
|
*/
|
|
|
|
virtual bool IsWidget() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the widget is active, i.e. has a focus within it.
|
|
|
|
*/
|
|
|
|
virtual bool IsActiveWidget() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the widget has items and items are operable by user and
|
|
|
|
* can be activated.
|
|
|
|
*/
|
|
|
|
virtual bool AreItemsOperable() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the current item of the widget, i.e. an item that has or will have
|
|
|
|
* keyboard focus when widget gets active.
|
|
|
|
*/
|
2012-05-29 01:18:45 +00:00
|
|
|
virtual Accessible* CurrentItem();
|
2011-09-28 01:46:11 +00:00
|
|
|
|
2011-12-08 12:20:15 +00:00
|
|
|
/**
|
|
|
|
* Set the current item of the widget.
|
|
|
|
*/
|
2012-05-29 01:18:45 +00:00
|
|
|
virtual void SetCurrentItem(Accessible* aItem);
|
2011-12-08 12:20:15 +00:00
|
|
|
|
2011-09-28 01:46:11 +00:00
|
|
|
/**
|
|
|
|
* Return container widget this accessible belongs to.
|
|
|
|
*/
|
2012-05-29 01:18:45 +00:00
|
|
|
virtual Accessible* ContainerWidget() const;
|
2011-09-28 01:46:11 +00:00
|
|
|
|
2012-01-27 06:14:09 +00:00
|
|
|
/**
|
|
|
|
* Return the localized string for the given key.
|
|
|
|
*/
|
2012-05-10 13:43:04 +00:00
|
|
|
static void TranslateString(const nsString& aKey, nsAString& aStringOut);
|
2012-01-27 06:14:09 +00:00
|
|
|
|
2012-03-28 15:59:01 +00:00
|
|
|
/**
|
|
|
|
* Return true if the accessible is defunct.
|
|
|
|
*/
|
2012-12-11 03:31:42 +00:00
|
|
|
bool IsDefunct() const { return mStateFlags & eIsDefunct; }
|
2012-03-28 15:59:01 +00:00
|
|
|
|
2012-06-12 14:30:59 +00:00
|
|
|
/**
|
|
|
|
* Return true if the accessible is no longer in the document.
|
|
|
|
*/
|
2012-12-11 03:31:42 +00:00
|
|
|
bool IsInDocument() const { return !(mStateFlags & eIsNotInDocument); }
|
2012-06-12 14:30:59 +00:00
|
|
|
|
2012-09-04 06:06:10 +00:00
|
|
|
/**
|
2012-10-13 06:34:21 +00:00
|
|
|
* Return true if the accessible should be contained by document node map.
|
|
|
|
*/
|
|
|
|
bool IsNodeMapEntry() const
|
2012-12-11 03:31:42 +00:00
|
|
|
{ return HasOwnContent() && !(mStateFlags & eNotNodeMapEntry); }
|
2012-10-13 06:34:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the accessible has associated DOM content.
|
|
|
|
*/
|
2012-12-11 03:31:42 +00:00
|
|
|
bool HasOwnContent() const
|
|
|
|
{ return mContent && !(mStateFlags & eSharedNode); }
|
2012-09-04 06:06:10 +00:00
|
|
|
|
2012-10-04 14:34:56 +00:00
|
|
|
/**
|
|
|
|
* Return true if the accessible has a numeric value.
|
|
|
|
*/
|
|
|
|
bool HasNumericValue() const;
|
|
|
|
|
2009-12-10 19:12:19 +00:00
|
|
|
protected:
|
|
|
|
|
2012-10-19 07:15:23 +00:00
|
|
|
/**
|
|
|
|
* Return the accessible name provided by native markup. It doesn't take
|
|
|
|
* into account ARIA markup used to specify the name.
|
|
|
|
*/
|
|
|
|
virtual mozilla::a11y::ENameValueFlag NativeName(nsString& aName);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return object attributes provided by native markup. It doesn't take into
|
|
|
|
* account ARIA.
|
|
|
|
*/
|
|
|
|
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes();
|
|
|
|
|
2009-06-18 07:37:38 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-12-10 19:12:19 +00:00
|
|
|
// Initializing, cache and tree traverse methods
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cache accessible children.
|
|
|
|
*/
|
|
|
|
virtual void CacheChildren();
|
|
|
|
|
2010-07-02 01:22:41 +00:00
|
|
|
/**
|
|
|
|
* Set accessible parent and index in parent.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual void BindToParent(Accessible* aParent, uint32_t aIndexInParent);
|
2012-03-23 12:21:31 +00:00
|
|
|
virtual void UnbindFromParent();
|
2010-07-02 01:22:41 +00:00
|
|
|
|
2009-12-10 19:12:19 +00:00
|
|
|
/**
|
|
|
|
* Return sibling accessible at the given offset.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
|
2012-07-30 14:20:58 +00:00
|
|
|
nsresult *aError = nullptr) const;
|
2009-12-10 19:12:19 +00:00
|
|
|
|
2011-01-28 05:15:04 +00:00
|
|
|
/**
|
|
|
|
* Flags used to describe the state and type of children.
|
|
|
|
*/
|
|
|
|
enum ChildrenFlags {
|
|
|
|
eChildrenUninitialized = 0, // children aren't initialized
|
|
|
|
eMixedChildren = 1 << 0, // text leaf children are presented
|
2012-12-18 05:22:26 +00:00
|
|
|
eEmbeddedChildren = 1 << 1, // all children are embedded objects
|
|
|
|
|
|
|
|
eLastChildrenFlag = eEmbeddedChildren
|
2011-01-28 05:15:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the children flag is set.
|
|
|
|
*/
|
2012-12-11 03:31:42 +00:00
|
|
|
bool IsChildrenFlag(ChildrenFlags aFlag) const
|
|
|
|
{ return static_cast<ChildrenFlags>(mChildrenFlags) == aFlag; }
|
2011-01-28 05:15:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set children flag.
|
|
|
|
*/
|
2012-12-11 03:31:42 +00:00
|
|
|
void SetChildrenFlag(ChildrenFlags aFlag) { mChildrenFlags = aFlag; }
|
2011-01-28 05:15:04 +00:00
|
|
|
|
2011-01-28 05:15:13 +00:00
|
|
|
/**
|
2012-03-28 15:59:01 +00:00
|
|
|
* Flags used to describe the state of this accessible.
|
2011-01-28 05:15:13 +00:00
|
|
|
* @note keep these flags in sync with ChildrenFlags
|
|
|
|
*/
|
2012-03-28 15:59:01 +00:00
|
|
|
enum StateFlags {
|
2012-12-11 03:31:42 +00:00
|
|
|
eIsDefunct = 1 << 0, // accessible is defunct
|
|
|
|
eIsNotInDocument = 1 << 1, // accessible is not in document
|
|
|
|
eSharedNode = 1 << 2, // accessible shares DOM node from another accessible
|
|
|
|
eNotNodeMapEntry = 1 << 3, // accessible shouldn't be in document node map
|
2012-12-18 05:22:26 +00:00
|
|
|
eHasNumericValue = 1 << 4, // accessible has a numeric value
|
2012-03-28 15:59:01 +00:00
|
|
|
|
2012-12-18 05:22:26 +00:00
|
|
|
eLastStateFlag = eHasNumericValue
|
2011-01-28 05:15:13 +00:00
|
|
|
};
|
|
|
|
|
2012-11-11 02:16:17 +00:00
|
|
|
protected:
|
|
|
|
|
2009-12-10 19:12:19 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Miscellaneous helpers
|
2007-11-12 01:05:37 +00:00
|
|
|
|
2010-12-01 08:53:17 +00:00
|
|
|
/**
|
|
|
|
* Return ARIA role (helper method).
|
|
|
|
*/
|
2012-03-30 00:04:06 +00:00
|
|
|
mozilla::a11y::role ARIATransformRole(mozilla::a11y::role aRole);
|
2010-12-01 08:53:17 +00:00
|
|
|
|
2008-12-03 07:18:41 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-12-10 19:12:19 +00:00
|
|
|
// Name helpers
|
2008-12-03 07:18:41 +00:00
|
|
|
|
|
|
|
/**
|
2012-10-14 04:18:39 +00:00
|
|
|
* Returns the accessible name specified by ARIA.
|
2008-12-03 07:18:41 +00:00
|
|
|
*/
|
2012-10-17 06:38:16 +00:00
|
|
|
void ARIAName(nsString& aName);
|
2008-12-03 07:18:41 +00:00
|
|
|
|
|
|
|
/**
|
2012-10-14 04:18:39 +00:00
|
|
|
* Compute the name of HTML/XUL node.
|
2008-12-03 07:18:41 +00:00
|
|
|
*/
|
2012-10-17 06:38:16 +00:00
|
|
|
mozilla::a11y::ENameValueFlag GetHTMLName(nsString& aName);
|
|
|
|
mozilla::a11y::ENameValueFlag GetXULName(nsString& aName);
|
2008-12-03 07:18:41 +00:00
|
|
|
|
Bug 109851, bug 108629, bug 109921, bug 109977, bug 109153, bug 109187, bug 109213, bug 109221. Check in latest XUL accessibility support - menus, <colorpicker>, <progressmeter>, <groupbox>, mixed states for checkboxes, buttons that can be 'checked' ie pressed down, fixes extra MSAA events being generated, couldn't see HTML content
2001-11-20 02:05:26 +00:00
|
|
|
// helper method to verify frames
|
2002-05-08 20:43:49 +00:00
|
|
|
static nsresult GetFullKeyName(const nsAString& aModifierName, const nsAString& aKeyName, nsAString& aStringOut);
|
2001-09-25 22:32:32 +00:00
|
|
|
|
2007-03-06 13:44:42 +00:00
|
|
|
/**
|
2009-11-02 01:02:09 +00:00
|
|
|
* 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).
|
|
|
|
*
|
|
|
|
* @param aStartNode [in] the DOM node to start from
|
|
|
|
* @return the resulting accessible
|
2010-05-25 08:05:52 +00:00
|
|
|
*/
|
2012-05-29 01:18:45 +00:00
|
|
|
Accessible* GetFirstAvailableAccessible(nsINode* aStartNode) const;
|
2007-03-06 13:44:42 +00:00
|
|
|
|
2009-08-20 06:45:19 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Action helpers
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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).
|
|
|
|
*
|
|
|
|
* @param aContent [in, optional] element to click
|
|
|
|
* @param aActionIndex [in, optional] index of accessible action
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
void DoCommand(nsIContent *aContent = nullptr, uint32_t aActionIndex = 0);
|
2009-08-20 06:45:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatch click event.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual void DispatchClickEvent(nsIContent *aContent, uint32_t aActionIndex);
|
2009-08-20 06:45:19 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Helpers
|
2005-02-01 09:40:36 +00:00
|
|
|
|
2007-09-18 21:40:04 +00:00
|
|
|
/**
|
2007-12-12 02:10:26 +00:00
|
|
|
* Get the container node for an atomic region, defined by aria-atomic="true"
|
2007-09-18 21:40:04 +00:00
|
|
|
* @return the container node
|
|
|
|
*/
|
2011-08-10 01:44:00 +00:00
|
|
|
nsIContent* GetAtomicRegion() const;
|
2007-09-18 21:40:04 +00:00
|
|
|
|
2007-08-04 05:27:27 +00:00
|
|
|
/**
|
2007-09-25 01:19:03 +00:00
|
|
|
* Get numeric value of the given ARIA attribute.
|
2007-08-04 05:27:27 +00:00
|
|
|
*
|
2007-09-25 01:19:03 +00:00
|
|
|
* @param aAriaProperty - the ARIA property we're using
|
2007-08-04 05:27:27 +00:00
|
|
|
* @param aValue - value of the attribute
|
|
|
|
*
|
|
|
|
* @return - NS_OK_NO_ARIA_VALUE if there is no setted ARIA attribute
|
|
|
|
*/
|
2007-12-12 02:10:26 +00:00
|
|
|
nsresult GetAttrValue(nsIAtom *aAriaProperty, double *aValue);
|
2007-08-04 05:27:27 +00:00
|
|
|
|
2008-10-08 12:54:58 +00:00
|
|
|
/**
|
|
|
|
* Return the action rule based on ARIA enum constants EActionRule
|
2011-06-05 19:35:43 +00:00
|
|
|
* (see nsARIAMap.h). Used by ActionCount() and GetActionName().
|
2008-10-08 12:54:58 +00:00
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t GetActionRule();
|
2008-10-08 12:54:58 +00:00
|
|
|
|
2010-07-03 03:11:35 +00:00
|
|
|
/**
|
|
|
|
* Return group info.
|
|
|
|
*/
|
|
|
|
AccGroupInfo* GetGroupInfo();
|
|
|
|
|
2008-06-16 06:16:18 +00:00
|
|
|
/**
|
|
|
|
* Fires platform accessible event. It's notification method only. It does
|
2010-01-19 04:23:44 +00:00
|
|
|
* 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.
|
2008-06-16 06:16:18 +00:00
|
|
|
*
|
|
|
|
* @param aEvent the accessible event to fire.
|
|
|
|
*/
|
2010-08-25 02:08:28 +00:00
|
|
|
virtual nsresult FirePlatformEvent(AccEvent* aEvent) = 0;
|
2008-06-16 06:16:18 +00:00
|
|
|
|
2001-05-11 21:11:38 +00:00
|
|
|
// Data Members
|
2012-05-29 01:18:45 +00:00
|
|
|
nsRefPtr<Accessible> mParent;
|
|
|
|
nsTArray<nsRefPtr<Accessible> > mChildren;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mIndexInParent;
|
2008-08-06 12:19:56 +00:00
|
|
|
|
2012-12-18 05:22:26 +00:00
|
|
|
static const uint8_t kChildrenFlagsBits = 2;
|
|
|
|
static const uint8_t kStateFlagsBits = 5;
|
|
|
|
static const uint8_t kTypeBits = 5;
|
|
|
|
static const uint8_t kGenericTypesBits = 12;
|
|
|
|
|
2012-12-11 03:31:42 +00:00
|
|
|
/**
|
2012-12-18 05:22:26 +00:00
|
|
|
* Keep in sync with ChildrenFlags, StateFlags and AccTypes.
|
2012-12-11 03:31:42 +00:00
|
|
|
*/
|
2012-12-18 05:22:26 +00:00
|
|
|
uint32_t mChildrenFlags : kChildrenFlagsBits;
|
|
|
|
uint32_t mStateFlags : kStateFlagsBits;
|
|
|
|
uint32_t mType : kTypeBits;
|
|
|
|
uint32_t mGenericTypes : kGenericTypesBits;
|
|
|
|
|
|
|
|
void StaticAsserts() const;
|
2011-01-28 05:15:04 +00:00
|
|
|
|
2012-06-12 14:30:59 +00:00
|
|
|
friend class DocAccessible;
|
2010-08-15 11:28:49 +00:00
|
|
|
|
2012-08-28 13:13:59 +00:00
|
|
|
nsAutoPtr<mozilla::a11y::EmbeddedObjCollector> mEmbeddedObjCollector;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mIndexOfEmbeddedChild;
|
2012-11-18 02:01:44 +00:00
|
|
|
friend class EmbeddedObjCollector;
|
2010-08-15 11:28:49 +00:00
|
|
|
|
2010-07-03 03:11:35 +00:00
|
|
|
nsAutoPtr<AccGroupInfo> mGroupInfo;
|
|
|
|
friend class AccGroupInfo;
|
2012-06-04 12:32:34 +00:00
|
|
|
|
2012-04-16 09:24:23 +00:00
|
|
|
/**
|
|
|
|
* Non-null indicates author-supplied role; possibly state & value as well
|
|
|
|
*/
|
|
|
|
nsRoleMapEntry* mRoleMapEntry;
|
Bug 109851, bug 108629, bug 109921, bug 109977, bug 109153, bug 109187, bug 109213, bug 109221. Check in latest XUL accessibility support - menus, <colorpicker>, <progressmeter>, <groupbox>, mixed states for checkboxes, buttons that can be 'checked' ie pressed down, fixes extra MSAA events being generated, couldn't see HTML content
2001-11-20 02:05:26 +00:00
|
|
|
};
|
|
|
|
|
2012-05-29 01:18:45 +00:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(Accessible,
|
2010-04-27 06:52:03 +00:00
|
|
|
NS_ACCESSIBLE_IMPL_IID)
|
2005-01-28 02:35:26 +00:00
|
|
|
|
2011-07-19 08:30:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Represent key binding associated with accessible (such as access key and
|
|
|
|
* global keyboard shortcuts).
|
|
|
|
*/
|
|
|
|
class KeyBinding
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Modifier mask values.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
static const uint32_t kShift = 1;
|
|
|
|
static const uint32_t kControl = 2;
|
|
|
|
static const uint32_t kAlt = 4;
|
|
|
|
static const uint32_t kMeta = 8;
|
|
|
|
static const uint32_t kOS = 16;
|
2011-07-19 08:30:24 +00:00
|
|
|
|
|
|
|
KeyBinding() : mKey(0), mModifierMask(0) {}
|
2012-08-22 15:56:38 +00:00
|
|
|
KeyBinding(uint32_t aKey, uint32_t aModifierMask) :
|
2012-12-09 17:23:19 +00:00
|
|
|
mKey(aKey), mModifierMask(aModifierMask) {}
|
2011-07-19 08:30:24 +00:00
|
|
|
|
|
|
|
inline bool IsEmpty() const { return !mKey; }
|
2012-08-22 15:56:38 +00:00
|
|
|
inline uint32_t Key() const { return mKey; }
|
|
|
|
inline uint32_t ModifierMask() const { return mModifierMask; }
|
2011-07-19 08:30:24 +00:00
|
|
|
|
|
|
|
enum Format {
|
|
|
|
ePlatformFormat,
|
|
|
|
eAtkFormat
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return formatted string for this key binding depending on the given format.
|
|
|
|
*/
|
|
|
|
inline void ToString(nsAString& aValue,
|
|
|
|
Format aFormat = ePlatformFormat) const
|
|
|
|
{
|
|
|
|
aValue.Truncate();
|
|
|
|
AppendToString(aValue, aFormat);
|
|
|
|
}
|
|
|
|
inline void AppendToString(nsAString& aValue,
|
|
|
|
Format aFormat = ePlatformFormat) const
|
|
|
|
{
|
|
|
|
if (mKey) {
|
|
|
|
if (aFormat == ePlatformFormat)
|
|
|
|
ToPlatformFormat(aValue);
|
|
|
|
else
|
|
|
|
ToAtkFormat(aValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void ToPlatformFormat(nsAString& aValue) const;
|
|
|
|
void ToAtkFormat(nsAString& aValue) const;
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mKey;
|
|
|
|
uint32_t mModifierMask;
|
2011-07-19 08:30:24 +00:00
|
|
|
};
|
|
|
|
|
2012-11-18 02:01:44 +00:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2010-07-16 14:15:03 +00:00
|
|
|
#endif
|