2007-11-12 01:05:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2001-09-25 00:48:50 +00:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-17 21:52:36 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
2001-02-14 20:51:33 +00:00
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
2001-02-14 20:51:33 +00:00
|
|
|
*
|
2001-09-25 00:48:50 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
2001-02-14 20:51:33 +00:00
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-25 00:48:50 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
2001-02-14 20:51:33 +00:00
|
|
|
*
|
2001-09-25 00:48:50 +00:00
|
|
|
* Contributor(s):
|
2004-04-17 21:52:36 +00:00
|
|
|
* John Gaunt (jgaunt@netscape.com)
|
2001-09-25 00:48:50 +00:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-17 21:52:36 +00:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-25 00:48:50 +00:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-17 21:52:36 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-25 00:48:50 +00:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-17 21:52:36 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
2001-09-25 00:48:50 +00:00
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2001-02-14 20:51:33 +00:00
|
|
|
|
|
|
|
#ifndef _nsAccessible_H_
|
|
|
|
#define _nsAccessible_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 "nsIAccessibleRole.h"
|
|
|
|
#include "nsIAccessibleStates.h"
|
|
|
|
|
2010-12-01 08:53:17 +00:00
|
|
|
#include "nsARIAMap.h"
|
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
|
|
|
|
2011-01-31 04:04:32 +00:00
|
|
|
class AccEvent;
|
2010-07-03 03:11:35 +00:00
|
|
|
class AccGroupInfo;
|
2010-08-15 11:28:49 +00:00
|
|
|
class EmbeddedObjCollector;
|
2011-07-19 08:30:24 +00:00
|
|
|
class KeyBinding;
|
2010-04-27 06:52:03 +00:00
|
|
|
class nsAccessible;
|
2011-01-31 04:04:32 +00:00
|
|
|
class nsHyperTextAccessible;
|
2012-01-06 04:05:03 +00:00
|
|
|
class nsHTMLImageAccessible;
|
2012-03-15 20:16:02 +00:00
|
|
|
class nsHTMLImageMapAccessible;
|
2011-03-28 13:59:54 +00:00
|
|
|
class nsHTMLLIAccessible;
|
2010-04-27 06:52:03 +00:00
|
|
|
struct nsRoleMapEntry;
|
2011-08-10 01:44:00 +00:00
|
|
|
class Relation;
|
2012-03-28 00:53:58 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
class TableAccessible;
|
|
|
|
}
|
|
|
|
}
|
2011-01-31 04:04:32 +00:00
|
|
|
class nsTextAccessible;
|
2001-02-14 20:51:33 +00:00
|
|
|
|
2003-04-15 08:45:55 +00:00
|
|
|
struct nsRect;
|
2001-10-09 21:52:36 +00:00
|
|
|
class nsIContent;
|
|
|
|
class nsIFrame;
|
2003-04-15 08:45:55 +00:00
|
|
|
class nsIAtom;
|
2007-03-19 06:45:35 +00:00
|
|
|
class nsIView;
|
2001-02-14 20:51:33 +00:00
|
|
|
|
2012-03-21 18:07:31 +00:00
|
|
|
typedef nsRefPtrHashtable<nsPtrHashKey<const void>, nsAccessible>
|
2010-04-27 06:52:03 +00:00
|
|
|
nsAccessibleHashtable;
|
|
|
|
|
2008-12-16 16:13:49 +00:00
|
|
|
// see nsAccessible::GetAttrValue
|
2007-08-04 05:27:27 +00:00
|
|
|
#define NS_OK_NO_ARIA_VALUE \
|
|
|
|
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x21)
|
|
|
|
|
2008-12-16 16:13:49 +00:00
|
|
|
// see nsAccessible::GetNameInternal
|
|
|
|
#define NS_OK_EMPTY_NAME \
|
|
|
|
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x23)
|
|
|
|
|
2009-02-27 10:54:39 +00:00
|
|
|
// see nsAccessible::GetNameInternal
|
|
|
|
#define NS_OK_NAME_FROM_TOOLTIP \
|
|
|
|
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x25)
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2003-07-09 07:01:46 +00:00
|
|
|
class nsAccessible : public nsAccessNodeWrap,
|
|
|
|
public nsIAccessible,
|
2006-06-21 13:29:10 +00:00
|
|
|
public nsIAccessibleHyperLink,
|
2006-06-15 16:55:32 +00:00
|
|
|
public nsIAccessibleSelectable,
|
|
|
|
public nsIAccessibleValue
|
2001-02-14 20:51:33 +00:00
|
|
|
{
|
2001-06-30 00:25:09 +00:00
|
|
|
public:
|
2012-02-07 22:38:54 +00:00
|
|
|
nsAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
|
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
|
|
|
virtual ~nsAccessible();
|
|
|
|
|
2003-04-01 20:02:51 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2008-08-06 12:19:56 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsAccessible, nsAccessNode)
|
|
|
|
|
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
|
|
|
/**
|
|
|
|
* get the description of this accessible
|
|
|
|
*/
|
|
|
|
virtual void Description(nsString& aDescription);
|
|
|
|
|
2012-02-07 13:18:33 +00:00
|
|
|
/**
|
|
|
|
* Return DOM node associated with this accessible.
|
|
|
|
*/
|
|
|
|
inline already_AddRefed<nsIDOMNode> DOMNode() const
|
|
|
|
{
|
|
|
|
nsIDOMNode *DOMNode = nsnull;
|
|
|
|
if (GetNode())
|
|
|
|
CallQueryInterface(GetNode(), &DOMNode);
|
|
|
|
return DOMNode;
|
|
|
|
}
|
|
|
|
|
2008-10-10 12:26:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the accessible name specified by ARIA.
|
|
|
|
*/
|
|
|
|
nsresult GetARIAName(nsAString& aName);
|
|
|
|
|
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.
|
|
|
|
*/
|
2011-04-09 23:38:06 +00:00
|
|
|
virtual void ApplyARIAState(PRUint64* aState);
|
2009-06-18 07:37:38 +00:00
|
|
|
|
2008-10-10 12:26:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the accessible name provided by native markup. It doesn't take
|
2008-12-16 16:13:49 +00:00
|
|
|
* into account ARIA markup used to specify the name.
|
|
|
|
*
|
|
|
|
* @param aName [out] the accessible name
|
|
|
|
*
|
|
|
|
* @return NS_OK_EMPTY_NAME points empty name was specified by native markup
|
|
|
|
* explicitly (see nsIAccessible::name attribute for
|
|
|
|
* details)
|
2008-10-10 12:26:55 +00:00
|
|
|
*/
|
|
|
|
virtual nsresult GetNameInternal(nsAString& aName);
|
|
|
|
|
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-01-12 03:07:35 +00:00
|
|
|
inline mozilla::a11y::role Role()
|
2010-12-01 08:53:17 +00:00
|
|
|
{
|
|
|
|
if (!mRoleMapEntry || mRoleMapEntry->roleRule != kUseMapRole)
|
|
|
|
return NativeRole();
|
|
|
|
|
|
|
|
return ARIARoleInternal();
|
|
|
|
}
|
|
|
|
|
2012-01-20 15:22:31 +00:00
|
|
|
/**
|
|
|
|
* Return true if ARIA role is specified on the element.
|
|
|
|
*/
|
|
|
|
inline bool HasARIARole() const
|
|
|
|
{
|
|
|
|
return mRoleMapEntry;
|
|
|
|
}
|
|
|
|
|
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-01-12 03:07:35 +00:00
|
|
|
inline mozilla::a11y::role ARIARole()
|
2010-12-01 08:53:17 +00:00
|
|
|
{
|
|
|
|
if (!mRoleMapEntry || mRoleMapEntry->roleRule != kUseMapRole)
|
2012-01-12 03:07:35 +00:00
|
|
|
return mozilla::a11y::roles::NOTHING;
|
2010-12-01 08:53:17 +00:00
|
|
|
|
|
|
|
return ARIARoleInternal();
|
|
|
|
}
|
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
|
|
|
*/
|
2011-04-09 23:38:06 +00:00
|
|
|
virtual PRUint64 State();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the states of accessible, not taking into account ARIA states.
|
|
|
|
* Use State() to get complete set of states.
|
|
|
|
*/
|
|
|
|
virtual PRUint64 NativeState();
|
2007-04-02 15:56:24 +00:00
|
|
|
|
2012-03-08 03:28:38 +00:00
|
|
|
/**
|
|
|
|
* Return bit set of invisible and offscreen states.
|
|
|
|
*/
|
|
|
|
PRUint64 VisibilityState();
|
|
|
|
|
2007-04-07 09:07:24 +00:00
|
|
|
/**
|
|
|
|
* Returns attributes for accessible without explicitly setted ARIA
|
|
|
|
* attributes.
|
|
|
|
*/
|
|
|
|
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
|
|
|
|
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
|
|
|
*/
|
2011-06-13 22:20:54 +00:00
|
|
|
virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
|
|
|
EWhichChildAtPoint aWhichChild);
|
2009-05-11 10:57:28 +00:00
|
|
|
|
2011-07-15 22:58:49 +00:00
|
|
|
/**
|
|
|
|
* Return the focused child if any.
|
|
|
|
*/
|
|
|
|
virtual nsAccessible* FocusedChild();
|
|
|
|
|
2010-01-06 10:36:50 +00:00
|
|
|
/**
|
|
|
|
* Return calculated group level based on accessible hierarchy.
|
|
|
|
*/
|
|
|
|
virtual PRInt32 GetLevelInternal();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
|
|
|
PRInt32 *aSetSize);
|
|
|
|
|
2011-08-10 01:44:00 +00:00
|
|
|
/**
|
|
|
|
* Get the relation of the given type.
|
|
|
|
*/
|
|
|
|
virtual Relation RelationByType(PRUint32 aType);
|
|
|
|
|
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.
|
|
|
|
* For a newly created accessible, specify which role map entry should be used.
|
|
|
|
*
|
|
|
|
* @param aRoleMapEntry The ARIA nsRoleMapEntry* for the accessible, or
|
|
|
|
* nsnull if none.
|
|
|
|
*/
|
|
|
|
virtual void SetRoleMapEntry(nsRoleMapEntry *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
|
|
|
*/
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool AppendChild(nsAccessible* aChild);
|
|
|
|
virtual bool InsertChildAt(PRUint32 aIndex, nsAccessible* aChild);
|
|
|
|
virtual bool RemoveChild(nsAccessible* 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
|
|
|
*/
|
2011-07-23 08:38:33 +00:00
|
|
|
nsAccessible* 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
|
|
|
*/
|
2010-01-11 14:14:06 +00:00
|
|
|
virtual nsAccessible* GetChildAt(PRUint32 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
|
|
|
*/
|
2009-12-10 19:12:19 +00:00
|
|
|
virtual PRInt32 GetChildCount();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return index of the given child accessible.
|
|
|
|
*/
|
2010-07-02 01:22:41 +00:00
|
|
|
virtual PRInt32 GetIndexOf(nsAccessible* aChild);
|
2009-12-10 19:12:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return index in parent accessible.
|
|
|
|
*/
|
2011-06-13 09:08:40 +00:00
|
|
|
virtual PRInt32 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
|
|
|
*/
|
|
|
|
inline nsAccessible* NextSibling() const
|
|
|
|
{ return GetSiblingAtOffset(1); }
|
|
|
|
inline nsAccessible* PrevSibling() const
|
|
|
|
{ return GetSiblingAtOffset(-1); }
|
2011-07-23 08:38:33 +00:00
|
|
|
inline nsAccessible* FirstChild()
|
|
|
|
{ return GetChildCount() != 0 ? GetChildAt(0) : nsnull; }
|
|
|
|
inline nsAccessible* LastChild()
|
|
|
|
{
|
|
|
|
PRUint32 childCount = GetChildCount();
|
|
|
|
return childCount != 0 ? GetChildAt(childCount - 1) : nsnull;
|
|
|
|
}
|
|
|
|
|
2011-06-07 02:23:13 +00:00
|
|
|
|
2010-08-15 11:28:49 +00:00
|
|
|
/**
|
|
|
|
* Return embedded accessible children count.
|
|
|
|
*/
|
|
|
|
PRInt32 GetEmbeddedChildCount();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return embedded accessible child at the given index.
|
|
|
|
*/
|
|
|
|
nsAccessible* GetEmbeddedChildAt(PRUint32 aIndex);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return index of the given embedded accessible child.
|
|
|
|
*/
|
|
|
|
PRInt32 GetIndexOfEmbeddedChild(nsAccessible* aChild);
|
|
|
|
|
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).
|
|
|
|
*/
|
|
|
|
PRUint32 ContentChildCount() const { return mChildren.Length(); }
|
|
|
|
nsAccessible* ContentChildAt(PRUint32 aIndex) const
|
|
|
|
{ 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
|
|
|
*/
|
2011-02-01 03:00:24 +00:00
|
|
|
virtual void AppendTextTo(nsAString& aText, PRUint32 aStartOffset = 0,
|
|
|
|
PRUint32 aLength = PR_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
|
|
|
*/
|
2011-01-28 04:37:08 +00:00
|
|
|
void TestChildCache(nsAccessible* aCachedChild) const;
|
2010-02-09 13:29:22 +00:00
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2011-02-22 13:54:46 +00:00
|
|
|
inline bool IsApplication() const { return mFlags & eApplicationAccessible; }
|
|
|
|
|
2011-09-28 01:46:11 +00:00
|
|
|
bool IsAutoComplete() const { return mFlags & eAutoCompleteAccessible; }
|
|
|
|
|
|
|
|
inline bool IsAutoCompletePopup() const { return mFlags & eAutoCompletePopupAccessible; }
|
|
|
|
|
|
|
|
inline bool IsCombobox() const { return mFlags & eComboboxAccessible; }
|
|
|
|
|
2011-05-20 05:17:47 +00:00
|
|
|
inline bool IsDoc() const { return mFlags & eDocAccessible; }
|
|
|
|
nsDocAccessible* AsDoc();
|
|
|
|
|
2011-01-28 05:15:13 +00:00
|
|
|
inline bool IsHyperText() const { return mFlags & eHyperTextAccessible; }
|
|
|
|
nsHyperTextAccessible* AsHyperText();
|
|
|
|
|
2011-11-30 12:36:20 +00:00
|
|
|
inline bool IsHTMLFileInput() const { return mFlags & eHTMLFileInputAccessible; }
|
|
|
|
|
2011-03-28 13:59:54 +00:00
|
|
|
inline bool IsHTMLListItem() const { return mFlags & eHTMLListItemAccessible; }
|
|
|
|
nsHTMLLIAccessible* AsHTMLListItem();
|
2012-03-15 20:16:02 +00:00
|
|
|
|
2012-01-06 04:05:03 +00:00
|
|
|
inline bool IsImageAccessible() const { return mFlags & eImageAccessible; }
|
|
|
|
nsHTMLImageAccessible* AsImage();
|
2011-03-28 13:59:54 +00:00
|
|
|
|
2012-03-15 20:16:02 +00:00
|
|
|
bool IsImageMapAccessible() const { return mFlags & eImageMapAccessible; }
|
|
|
|
nsHTMLImageMapAccessible* AsImageMap();
|
|
|
|
|
2011-09-28 01:46:11 +00:00
|
|
|
inline bool IsListControl() const { return mFlags & eListControlAccessible; }
|
|
|
|
|
|
|
|
inline bool IsMenuButton() const { return mFlags & eMenuButtonAccessible; }
|
|
|
|
|
|
|
|
inline bool IsMenuPopup() const { return mFlags & eMenuPopupAccessible; }
|
|
|
|
|
2011-03-02 05:16:28 +00:00
|
|
|
inline bool IsRoot() const { return mFlags & eRootAccessible; }
|
|
|
|
nsRootAccessible* AsRoot();
|
|
|
|
|
2012-03-28 00:53:58 +00:00
|
|
|
virtual mozilla::a11y::TableAccessible* AsTable() { return nsnull; }
|
|
|
|
|
2011-01-31 04:04:32 +00:00
|
|
|
inline bool IsTextLeaf() const { return mFlags & eTextLeafAccessible; }
|
|
|
|
nsTextAccessible* AsTextLeaf();
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
virtual PRUint8 ActionCount();
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
virtual PRUint32 StartOffset();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the end offset of the link within the parent accessible.
|
|
|
|
*/
|
|
|
|
virtual PRUint32 EndOffset();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
virtual PRUint32 AnchorCount();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an anchor accessible at the given index.
|
|
|
|
*/
|
2011-06-14 03:56:42 +00:00
|
|
|
virtual nsAccessible* AnchorAt(PRUint32 aAnchorIndex);
|
2010-09-01 03:26:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an anchor URI at the given index.
|
|
|
|
*/
|
2011-06-14 03:56:42 +00:00
|
|
|
virtual already_AddRefed<nsIURI> AnchorURIAt(PRUint32 aAnchorIndex);
|
2010-09-01 03:26:13 +00:00
|
|
|
|
2010-09-02 00:46:59 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// SelectAccessible
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the accessible is a select control containing selectable
|
|
|
|
* items.
|
|
|
|
*/
|
|
|
|
virtual bool IsSelect();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return an array of selected items.
|
|
|
|
*/
|
|
|
|
virtual already_AddRefed<nsIArray> SelectedItems();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the number of selected items.
|
|
|
|
*/
|
|
|
|
virtual PRUint32 SelectedItemCount();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return selected item at the given index.
|
|
|
|
*/
|
|
|
|
virtual nsAccessible* GetSelectedItem(PRUint32 aIndex);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine if item at the given index is selected.
|
|
|
|
*/
|
|
|
|
virtual bool IsItemSelected(PRUint32 aIndex);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add item at the given index the selection. Return true if success.
|
|
|
|
*/
|
|
|
|
virtual bool AddItemToSelection(PRUint32 aIndex);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove item at the given index from the selection. Return if success.
|
|
|
|
*/
|
|
|
|
virtual bool RemoveItemFromSelection(PRUint32 aIndex);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
virtual nsAccessible* CurrentItem();
|
|
|
|
|
2011-12-08 12:20:15 +00:00
|
|
|
/**
|
|
|
|
* Set the current item of the widget.
|
|
|
|
*/
|
|
|
|
virtual void SetCurrentItem(nsAccessible* aItem);
|
|
|
|
|
2011-09-28 01:46:11 +00:00
|
|
|
/**
|
|
|
|
* Return container widget this accessible belongs to.
|
|
|
|
*/
|
|
|
|
virtual nsAccessible* ContainerWidget() const;
|
|
|
|
|
2012-01-27 06:14:09 +00:00
|
|
|
/**
|
|
|
|
* Return the localized string for the given key.
|
|
|
|
*/
|
|
|
|
static void TranslateString(const nsAString& aKey, nsAString& aStringOut);
|
|
|
|
|
2012-03-28 15:59:01 +00:00
|
|
|
/**
|
|
|
|
* Return true if the accessible is defunct.
|
|
|
|
*/
|
|
|
|
bool IsDefunct() const { return mFlags & eIsDefunct; }
|
|
|
|
|
2009-12-10 19:12:19 +00:00
|
|
|
protected:
|
|
|
|
|
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.
|
|
|
|
*/
|
2010-11-12 19:01:04 +00:00
|
|
|
virtual void BindToParent(nsAccessible* aParent, PRUint32 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.
|
|
|
|
*/
|
2010-03-10 10:26:11 +00:00
|
|
|
virtual nsAccessible* GetSiblingAtOffset(PRInt32 aOffset,
|
2011-06-07 02:23:13 +00:00
|
|
|
nsresult *aError = nsnull) 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
|
|
|
|
eEmbeddedChildren = 1 << 1 // all children are embedded objects
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the children flag is set.
|
|
|
|
*/
|
|
|
|
inline bool IsChildrenFlag(ChildrenFlags aFlag) const
|
2011-05-31 21:01:32 +00:00
|
|
|
{ return static_cast<ChildrenFlags> (mFlags & kChildrenFlagsMask) == aFlag; }
|
2011-01-28 05:15:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set children flag.
|
|
|
|
*/
|
|
|
|
inline void SetChildrenFlag(ChildrenFlags aFlag)
|
|
|
|
{ mFlags = (mFlags & ~kChildrenFlagsMask) | aFlag; }
|
|
|
|
|
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 {
|
|
|
|
eIsDefunct = 1 << 2 // accessible is defunct
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Flags describing the type of this accessible.
|
|
|
|
* @note keep these flags in sync with ChildrenFlags and StateFlags
|
|
|
|
*/
|
2011-01-28 05:15:13 +00:00
|
|
|
enum AccessibleTypes {
|
2012-03-28 15:59:01 +00:00
|
|
|
eApplicationAccessible = 1 << 3,
|
|
|
|
eAutoCompleteAccessible = 1 << 4,
|
|
|
|
eAutoCompletePopupAccessible = 1 << 5,
|
|
|
|
eComboboxAccessible = 1 << 6,
|
|
|
|
eDocAccessible = 1 << 7,
|
|
|
|
eHyperTextAccessible = 1 << 8,
|
|
|
|
eHTMLFileInputAccessible = 1 << 9,
|
|
|
|
eHTMLListItemAccessible = 1 << 10,
|
|
|
|
eImageAccessible = 1 << 11,
|
|
|
|
eImageMapAccessible = 1 << 12,
|
|
|
|
eListControlAccessible = 1 << 13,
|
|
|
|
eMenuButtonAccessible = 1 << 14,
|
|
|
|
eMenuPopupAccessible = 1 << 15,
|
|
|
|
eRootAccessible = 1 << 16,
|
|
|
|
eTextLeafAccessible = 1 << 17
|
2011-01-28 05:15:13 +00:00
|
|
|
};
|
|
|
|
|
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-01-12 03:07:35 +00:00
|
|
|
mozilla::a11y::role ARIARoleInternal();
|
2010-12-01 08:53:17 +00:00
|
|
|
|
2001-03-28 00:49:05 +00:00
|
|
|
virtual nsIFrame* GetBoundsFrame();
|
2003-07-31 08:09:39 +00:00
|
|
|
virtual void GetBoundsRect(nsRect& aRect, nsIFrame** aRelativeFrame);
|
2012-01-06 03:45:11 +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
|
|
|
|
|
|
|
/**
|
|
|
|
* Compute the name of HTML node.
|
|
|
|
*/
|
|
|
|
nsresult GetHTMLName(nsAString& aName);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compute the name for XUL node.
|
|
|
|
*/
|
|
|
|
nsresult GetXULName(nsAString& aName);
|
|
|
|
|
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
|
|
|
*/
|
2010-06-11 08:23:18 +00:00
|
|
|
nsAccessible *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
|
|
|
|
*/
|
2010-01-25 15:09:25 +00:00
|
|
|
void DoCommand(nsIContent *aContent = nsnull, PRUint32 aActionIndex = 0);
|
2009-08-20 06:45:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatch click event.
|
|
|
|
*/
|
|
|
|
virtual void DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex);
|
|
|
|
|
2010-01-25 15:08:08 +00:00
|
|
|
NS_DECL_RUNNABLEMETHOD_ARG2(nsAccessible, DispatchClickEvent,
|
|
|
|
nsCOMPtr<nsIContent>, PRUint32)
|
|
|
|
|
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
|
|
|
*
|
|
|
|
* @param aStates [in] states of the accessible
|
|
|
|
*/
|
2011-04-09 23:38:06 +00:00
|
|
|
PRUint32 GetActionRule(PRUint64 aStates);
|
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
|
2010-01-11 14:14:06 +00:00
|
|
|
nsRefPtr<nsAccessible> mParent;
|
|
|
|
nsTArray<nsRefPtr<nsAccessible> > mChildren;
|
2010-07-02 01:22:41 +00:00
|
|
|
PRInt32 mIndexInParent;
|
2008-08-06 12:19:56 +00:00
|
|
|
|
2011-01-28 05:15:04 +00:00
|
|
|
static const PRUint32 kChildrenFlagsMask =
|
|
|
|
eChildrenUninitialized | eMixedChildren | eEmbeddedChildren;
|
|
|
|
|
|
|
|
PRUint32 mFlags;
|
2010-08-15 11:28:49 +00:00
|
|
|
|
|
|
|
nsAutoPtr<EmbeddedObjCollector> mEmbeddedObjCollector;
|
|
|
|
PRInt32 mIndexOfEmbeddedChild;
|
|
|
|
friend class EmbeddedObjCollector;
|
|
|
|
|
2010-07-03 03:11:35 +00:00
|
|
|
nsAutoPtr<AccGroupInfo> mGroupInfo;
|
|
|
|
friend class AccGroupInfo;
|
|
|
|
|
2005-01-28 02:35:26 +00:00
|
|
|
nsRoleMapEntry *mRoleMapEntry; // Non-null indicates author-supplied role; possibly state & value as well
|
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
|
|
|
};
|
|
|
|
|
2008-10-10 12:26:55 +00:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsAccessible,
|
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.
|
|
|
|
*/
|
|
|
|
static const PRUint32 kShift = 1;
|
|
|
|
static const PRUint32 kControl = 2;
|
|
|
|
static const PRUint32 kAlt = 4;
|
|
|
|
static const PRUint32 kMeta = 8;
|
|
|
|
|
|
|
|
KeyBinding() : mKey(0), mModifierMask(0) {}
|
|
|
|
KeyBinding(PRUint32 aKey, PRUint32 aModifierMask) :
|
|
|
|
mKey(aKey), mModifierMask(aModifierMask) {};
|
|
|
|
|
|
|
|
inline bool IsEmpty() const { return !mKey; }
|
|
|
|
inline PRUint32 Key() const { return mKey; }
|
|
|
|
inline PRUint32 ModifierMask() const { return mModifierMask; }
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
PRUint32 mKey;
|
|
|
|
PRUint32 mModifierMask;
|
|
|
|
};
|
|
|
|
|
2010-07-16 14:15:03 +00:00
|
|
|
#endif
|