2007-11-12 04:05:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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 23:51:33 +03:00
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
#ifndef _Accessible_H_
|
|
|
|
#define _Accessible_H_
|
2001-02-14 23:51:33 +03:00
|
|
|
|
2012-12-18 09:22:26 +04:00
|
|
|
#include "mozilla/a11y/AccTypes.h"
|
2013-10-19 22:19:50 +04:00
|
|
|
#include "mozilla/a11y/RelationType.h"
|
2012-01-12 07:07:35 +04:00
|
|
|
#include "mozilla/a11y/Role.h"
|
2011-07-27 16:43:01 +04:00
|
|
|
#include "mozilla/a11y/States.h"
|
2007-05-20 06:41:33 +04:00
|
|
|
|
2020-07-15 16:46:02 +03:00
|
|
|
#include "mozilla/dom/Element.h"
|
|
|
|
|
2016-06-29 13:57:00 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
|
|
|
|
2013-03-22 04:05:20 +04:00
|
|
|
#include "nsIContent.h"
|
2009-01-18 23:14:14 +03:00
|
|
|
#include "nsTArray.h"
|
2010-06-21 17:08:27 +04:00
|
|
|
#include "nsRefPtrHashtable.h"
|
2015-04-21 18:04:57 +03:00
|
|
|
#include "nsRect.h"
|
2010-04-27 10:52:03 +04:00
|
|
|
|
2012-04-13 18:17:03 +04:00
|
|
|
struct nsRoleMapEntry;
|
2012-05-01 07:08:31 +04:00
|
|
|
|
2012-11-18 06:01:44 +04:00
|
|
|
class nsIFrame;
|
2014-10-22 04:49:28 +04:00
|
|
|
class nsIPersistentProperties;
|
2012-11-18 06:01:44 +04:00
|
|
|
|
2012-03-28 04:53:58 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
2012-05-08 09:16:40 +04:00
|
|
|
|
2012-11-18 06:01:44 +04:00
|
|
|
class Accessible;
|
|
|
|
class AccEvent;
|
|
|
|
class AccGroupInfo;
|
2014-10-22 04:49:28 +04:00
|
|
|
class ApplicationAccessible;
|
2013-10-29 07:30:55 +04:00
|
|
|
class DocAccessible;
|
2012-08-28 17:13:59 +04:00
|
|
|
class EmbeddedObjCollector;
|
2016-04-07 16:30:22 +03:00
|
|
|
class EventTree;
|
2012-06-04 16:32:34 +04:00
|
|
|
class HTMLImageMapAccessible;
|
2012-05-08 09:16:40 +04:00
|
|
|
class HTMLLIAccessible;
|
2020-04-24 17:34:09 +03:00
|
|
|
class HTMLLinkAccessible;
|
2012-11-18 06:01:44 +04:00
|
|
|
class HyperTextAccessible;
|
2012-06-02 15:30:34 +04:00
|
|
|
class ImageAccessible;
|
2012-11-18 06:01:44 +04:00
|
|
|
class KeyBinding;
|
2015-06-02 23:30:28 +03:00
|
|
|
class OuterDocAccessible;
|
2015-01-20 00:34:14 +03:00
|
|
|
class ProxyAccessible;
|
2012-06-11 02:18:31 +04:00
|
|
|
class Relation;
|
2013-10-29 07:30:55 +04:00
|
|
|
class RootAccessible;
|
2012-03-28 04:53:58 +04:00
|
|
|
class TableAccessible;
|
2012-08-09 10:24:31 +04:00
|
|
|
class TableCellAccessible;
|
2012-05-23 22:05:57 +04:00
|
|
|
class TextLeafAccessible;
|
2013-03-01 08:06:16 +04:00
|
|
|
class XULLabelAccessible;
|
2012-06-08 14:28:27 +04:00
|
|
|
class XULTreeAccessible;
|
2012-05-01 07:08:31 +04:00
|
|
|
|
2016-06-20 18:35:38 +03:00
|
|
|
#ifdef A11Y_LOG
|
|
|
|
namespace logging {
|
|
|
|
typedef const char* (*GetTreePrefix)(void* aData, Accessible*);
|
2016-08-19 19:10:58 +03:00
|
|
|
void Tree(const char* aTitle, const char* aMsgText, Accessible* aRoot,
|
2016-06-20 18:35:38 +03:00
|
|
|
GetTreePrefix aPrefixFunc, void* GetTreePrefixData);
|
|
|
|
}; // namespace logging
|
|
|
|
#endif
|
|
|
|
|
2012-05-01 07:08:31 +04: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 08:18:39 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Name was left empty by the author on purpose:
|
|
|
|
* name.IsEmpty() && !name.IsVoid().
|
|
|
|
*/
|
|
|
|
eNoNameOnPurpose,
|
|
|
|
|
2012-10-17 10:38:16 +04:00
|
|
|
/**
|
|
|
|
* Name was computed from the subtree.
|
|
|
|
*/
|
|
|
|
eNameFromSubtree,
|
|
|
|
|
2012-10-14 08:18:39 +04:00
|
|
|
/**
|
|
|
|
* Tooltip was used as a name.
|
|
|
|
*/
|
|
|
|
eNameFromTooltip
|
2012-05-01 07:08:31 +04:00
|
|
|
};
|
|
|
|
|
2012-05-30 04:51:00 +04:00
|
|
|
/**
|
|
|
|
* Group position (level, position in set and set size).
|
|
|
|
*/
|
|
|
|
struct GroupPos {
|
|
|
|
GroupPos() : level(0), posInSet(0), setSize(0) {}
|
2015-06-27 00:41:22 +03:00
|
|
|
GroupPos(int32_t aLevel, int32_t aPosInSet, int32_t aSetSize)
|
|
|
|
: level(aLevel), posInSet(aPosInSet), setSize(aSetSize) {}
|
2012-05-30 04:51:00 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t level;
|
|
|
|
int32_t posInSet;
|
|
|
|
int32_t setSize;
|
2012-05-30 04:51:00 +04:00
|
|
|
};
|
|
|
|
|
2014-05-17 03:16:34 +04:00
|
|
|
/**
|
|
|
|
* An index type. Assert if out of range value was attempted to be used.
|
|
|
|
*/
|
|
|
|
class index_t {
|
|
|
|
public:
|
2014-08-06 01:57:52 +04:00
|
|
|
MOZ_IMPLICIT index_t(int32_t aVal) : mVal(aVal) {}
|
2014-05-17 03:16:34 +04:00
|
|
|
|
|
|
|
operator uint32_t() const {
|
|
|
|
MOZ_ASSERT(mVal >= 0, "Attempt to use wrong index!");
|
|
|
|
return mVal;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsValid() const { return mVal >= 0; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int32_t mVal;
|
|
|
|
};
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
typedef nsRefPtrHashtable<nsPtrHashKey<const void>, Accessible>
|
|
|
|
AccessibleHashtable;
|
2010-04-27 10:52:03 +04:00
|
|
|
|
|
|
|
#define NS_ACCESSIBLE_IMPL_IID \
|
2010-01-19 07:23:44 +03:00
|
|
|
{ /* 133c8bf4-4913-4355-bd50-426bd1d6e1ad */ \
|
|
|
|
0x133c8bf4, 0x4913, 0x4355, { \
|
|
|
|
0xbd, 0x50, 0x42, 0x6b, 0xd1, 0xd6, 0xe1, 0xad \
|
2018-11-30 13:46:48 +03:00
|
|
|
} \
|
|
|
|
}
|
2007-03-08 18:25:35 +03:00
|
|
|
|
2014-10-22 04:49:28 +04:00
|
|
|
class Accessible : public nsISupports {
|
2001-06-30 04:25:09 +04:00
|
|
|
public:
|
2012-05-29 05:18:45 +04:00
|
|
|
Accessible(nsIContent* aContent, DocAccessible* 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 05:05:26 +03:00
|
|
|
|
2013-10-29 07:30:55 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2014-10-22 04:49:28 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS(Accessible)
|
2008-08-06 16:19:56 +04:00
|
|
|
|
2010-04-27 10:52:03 +04:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ACCESSIBLE_IMPL_IID)
|
2003-04-02 00:02:51 +04:00
|
|
|
|
2008-11-01 06:58:07 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2013-10-29 07:30:55 +04:00
|
|
|
// Public methods
|
2008-11-01 06:58:07 +03:00
|
|
|
|
2013-10-29 07:30:55 +04:00
|
|
|
/**
|
|
|
|
* Return the document accessible for this accessible.
|
|
|
|
*/
|
|
|
|
DocAccessible* Document() const { return mDoc; }
|
2003-05-01 14:25:45 +04:00
|
|
|
|
2013-10-29 07:30:55 +04:00
|
|
|
/**
|
|
|
|
* Return the root document accessible for this accessible.
|
|
|
|
*/
|
|
|
|
a11y::RootAccessible* RootAccessible() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return frame for this accessible.
|
|
|
|
*/
|
|
|
|
virtual nsIFrame* GetFrame() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return DOM node associated with the accessible.
|
|
|
|
*/
|
|
|
|
virtual nsINode* GetNode() const;
|
2018-03-22 18:52:14 +03:00
|
|
|
|
2013-10-29 07:30:55 +04:00
|
|
|
nsIContent* GetContent() const { return mContent; }
|
2018-05-30 17:56:24 +03:00
|
|
|
dom::Element* Elm() const { return dom::Element::FromNodeOrNull(mContent); }
|
2013-10-29 07:30:55 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return node type information of DOM node associated with the accessible.
|
|
|
|
*/
|
2017-10-25 18:19:11 +03:00
|
|
|
bool IsContent() const { return GetNode() && GetNode()->IsContent(); }
|
2013-10-29 07:30:55 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the unique identifier of the accessible.
|
|
|
|
*/
|
2020-02-27 20:39:15 +03:00
|
|
|
void* UniqueID() { return static_cast<void*>(this); }
|
2013-10-29 07:30:55 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return language associated with the accessible.
|
|
|
|
*/
|
|
|
|
void Language(nsAString& aLocale);
|
2008-10-10 16:26:55 +04:00
|
|
|
|
2011-04-23 17:14:05 +04:00
|
|
|
/**
|
2012-04-09 13:48:41 +04:00
|
|
|
* Get the description of this accessible.
|
2011-04-23 17:14:05 +04:00
|
|
|
*/
|
|
|
|
virtual void Description(nsString& aDescription);
|
|
|
|
|
2012-04-09 13:48:41 +04:00
|
|
|
/**
|
|
|
|
* Get the value of this accessible.
|
|
|
|
*/
|
2018-05-15 19:55:28 +03:00
|
|
|
virtual void Value(nsString& aValue) const;
|
2012-04-09 13:48:41 +04:00
|
|
|
|
2014-10-22 04:49:28 +04:00
|
|
|
/**
|
|
|
|
* Get help string for the accessible.
|
|
|
|
*/
|
|
|
|
void Help(nsString& aHelp) const { aHelp.Truncate(); }
|
|
|
|
|
2012-05-01 07:08:31 +04:00
|
|
|
/**
|
|
|
|
* Get the name of this accessible.
|
2012-10-14 08:18:39 +04: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 07:08:31 +04:00
|
|
|
*/
|
2018-05-15 19:13:02 +03:00
|
|
|
virtual ENameValueFlag Name(nsString& aName) const;
|
2012-05-01 07:08:31 +04:00
|
|
|
|
2009-06-18 11:37:38 +04: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 19:56:38 +04:00
|
|
|
virtual void ApplyARIAState(uint64_t* aState) const;
|
2009-06-18 11:37:38 +04:00
|
|
|
|
2010-09-06 07:33:29 +04:00
|
|
|
/**
|
2012-01-12 07:07:35 +04:00
|
|
|
* Return enumerated accessible role (see constants in Role.h).
|
2010-09-06 07:33:29 +04:00
|
|
|
*/
|
2018-05-15 15:50:38 +03:00
|
|
|
mozilla::a11y::role Role() const;
|
2010-12-01 11:53:17 +03:00
|
|
|
|
2012-01-20 19:22:31 +04:00
|
|
|
/**
|
|
|
|
* Return true if ARIA role is specified on the element.
|
|
|
|
*/
|
2016-07-18 19:40:53 +03:00
|
|
|
bool HasARIARole() const;
|
2017-10-03 01:05:19 +03:00
|
|
|
bool IsARIARole(nsAtom* aARIARole) const;
|
2014-08-16 00:49:02 +04:00
|
|
|
bool HasStrongARIARole() const;
|
2012-11-30 11:33:01 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrun ARIA role map if any.
|
|
|
|
*/
|
2016-07-18 19:40:53 +03:00
|
|
|
const nsRoleMapEntry* ARIARoleMap() const;
|
2012-01-20 19:22:31 +04:00
|
|
|
|
2010-12-01 11:53:17 +03:00
|
|
|
/**
|
|
|
|
* Return accessible role specified by ARIA (see constants in
|
2012-01-12 07:07:35 +04:00
|
|
|
* roles).
|
2010-12-01 11:53:17 +03:00
|
|
|
*/
|
2012-04-13 18:17:03 +04:00
|
|
|
mozilla::a11y::role ARIARole();
|
2010-09-06 07:33:29 +04:00
|
|
|
|
2015-03-01 01:25:06 +03:00
|
|
|
/**
|
|
|
|
* Return a landmark role if applied.
|
|
|
|
*/
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsAtom* LandmarkRole() const;
|
2015-03-01 01:25:06 +03:00
|
|
|
|
2009-03-07 18:38:58 +03:00
|
|
|
/**
|
|
|
|
* Returns enumerated accessible role from native markup (see constants in
|
2012-01-12 07:07:35 +04:00
|
|
|
* Role.h). Doesn't take into account ARIA roles.
|
2009-03-07 18:38:58 +03:00
|
|
|
*/
|
2018-05-07 22:05:50 +03:00
|
|
|
virtual mozilla::a11y::role NativeRole() const;
|
2009-03-07 18:38:58 +03:00
|
|
|
|
2007-04-02 19:56:24 +04:00
|
|
|
/**
|
2011-04-10 03:38:06 +04:00
|
|
|
* Return all states of accessible (including ARIA states).
|
2007-04-02 19:56:24 +04:00
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual uint64_t State();
|
2011-04-10 03:38:06 +04:00
|
|
|
|
2012-06-04 09:41:06 +04:00
|
|
|
/**
|
|
|
|
* Return interactive states present on the accessible
|
|
|
|
* (@see NativeInteractiveState).
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
uint64_t InteractiveState() const {
|
|
|
|
uint64_t state = NativeInteractiveState();
|
2012-06-04 09:41:06 +04:00
|
|
|
ApplyARIAState(&state);
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2012-05-17 13:37:37 +04:00
|
|
|
/**
|
|
|
|
* Return link states present on the accessible.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
uint64_t LinkState() const {
|
|
|
|
uint64_t state = NativeLinkState();
|
2012-05-17 13:37:37 +04:00
|
|
|
ApplyARIAState(&state);
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2011-04-10 03:38:06 +04:00
|
|
|
/**
|
|
|
|
* Return the states of accessible, not taking into account ARIA states.
|
|
|
|
* Use State() to get complete set of states.
|
|
|
|
*/
|
2018-05-15 21:04:50 +03:00
|
|
|
virtual uint64_t NativeState() const;
|
2007-04-02 19:56:24 +04:00
|
|
|
|
2012-06-04 09:41:06 +04:00
|
|
|
/**
|
|
|
|
* Return native interactice state (unavailable, focusable or selectable).
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual uint64_t NativeInteractiveState() const;
|
2012-06-04 09:41:06 +04:00
|
|
|
|
2012-05-17 13:37:37 +04:00
|
|
|
/**
|
|
|
|
* Return native link states present on the accessible.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual uint64_t NativeLinkState() const;
|
2012-05-17 13:37:37 +04:00
|
|
|
|
2012-03-08 07:28:38 +04:00
|
|
|
/**
|
|
|
|
* Return bit set of invisible and offscreen states.
|
|
|
|
*/
|
2018-05-07 22:05:50 +03:00
|
|
|
uint64_t VisibilityState() const;
|
2012-03-08 07:28:38 +04:00
|
|
|
|
2012-06-04 09:41:06 +04:00
|
|
|
/**
|
|
|
|
* Return true if native unavailable state present.
|
|
|
|
*/
|
|
|
|
virtual bool NativelyUnavailable() const;
|
|
|
|
|
2007-04-07 13:07:24 +04:00
|
|
|
/**
|
2012-10-19 11:15:23 +04:00
|
|
|
* Return object attributes for the accessible.
|
2007-04-07 13:07:24 +04:00
|
|
|
*/
|
2012-10-19 11:15:23 +04:00
|
|
|
virtual already_AddRefed<nsIPersistentProperties> Attributes();
|
2007-04-07 13:07:24 +04:00
|
|
|
|
2012-05-30 04:51:00 +04:00
|
|
|
/**
|
|
|
|
* Return group position (level, position in set and set size).
|
|
|
|
*/
|
|
|
|
virtual mozilla::a11y::GroupPos GroupPosition();
|
|
|
|
|
2011-03-29 08:44:20 +04:00
|
|
|
/**
|
2011-06-14 02:20:54 +04:00
|
|
|
* Used by ChildAtPoint() method to get direct or deepest child at point.
|
2011-03-29 08:44:20 +04:00
|
|
|
*/
|
|
|
|
enum EWhichChildAtPoint { eDirectChild, eDeepestChild };
|
|
|
|
|
2009-05-11 14:57:28 +04:00
|
|
|
/**
|
|
|
|
* Return direct or deepest child at the given point.
|
|
|
|
*
|
2011-03-29 08:44:20 +04: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 14:57:28 +04:00
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
|
2012-05-29 05:18:45 +04:00
|
|
|
EWhichChildAtPoint aWhichChild);
|
2009-05-11 14:57:28 +04:00
|
|
|
|
2011-07-16 02:58:49 +04:00
|
|
|
/**
|
|
|
|
* Return the focused child if any.
|
|
|
|
*/
|
2012-05-29 05:18:45 +04:00
|
|
|
virtual Accessible* FocusedChild();
|
2011-07-16 02:58:49 +04:00
|
|
|
|
2010-01-06 13:36:50 +03:00
|
|
|
/**
|
|
|
|
* Return calculated group level based on accessible hierarchy.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual int32_t GetLevelInternal();
|
2010-01-06 13:36:50 +03: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 19:56:38 +04:00
|
|
|
virtual void GetPositionAndSizeInternal(int32_t* aPosInSet,
|
|
|
|
int32_t* aSetSize);
|
2010-01-06 13:36:50 +03:00
|
|
|
|
2011-08-10 05:44:00 +04:00
|
|
|
/**
|
|
|
|
* Get the relation of the given type.
|
|
|
|
*/
|
2018-05-15 16:47:10 +03:00
|
|
|
virtual Relation RelationByType(RelationType aType) const;
|
2011-08-10 05:44:00 +04:00
|
|
|
|
2008-10-10 16:26:55 +04:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-12-10 22:12:19 +03:00
|
|
|
// Initializing methods
|
|
|
|
|
2013-10-29 07:30:55 +04:00
|
|
|
/**
|
|
|
|
* Shutdown this accessible object.
|
|
|
|
*/
|
|
|
|
virtual void Shutdown();
|
|
|
|
|
2009-12-10 22:12:19 +03:00
|
|
|
/**
|
|
|
|
* Set the ARIA role map entry for a new accessible.
|
|
|
|
*/
|
2016-07-18 19:40:53 +03:00
|
|
|
void SetRoleMapEntry(const nsRoleMapEntry* aRoleMapEntry);
|
2009-06-18 11:37:38 +04:00
|
|
|
|
2010-06-08 20:39:58 +04:00
|
|
|
/**
|
2010-07-02 05:22:41 +04:00
|
|
|
* Append/insert/remove a child. Return true if operation was successful.
|
2010-06-08 20:39:58 +04:00
|
|
|
*/
|
2013-03-14 08:53:28 +04:00
|
|
|
bool AppendChild(Accessible* aChild) {
|
|
|
|
return InsertChildAt(mChildren.Length(), aChild);
|
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild);
|
2016-03-28 20:40:21 +03:00
|
|
|
|
2016-07-13 06:15:22 +03:00
|
|
|
/**
|
|
|
|
* Inserts a child after given sibling. If the child cannot be inserted,
|
|
|
|
* then the child is unbound from the document, and false is returned. Make
|
|
|
|
* sure to null out any references on the child object as it may be destroyed.
|
|
|
|
*/
|
|
|
|
bool InsertAfter(Accessible* aNewChild, Accessible* aRefChild);
|
2016-03-28 20:40:21 +03:00
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
virtual bool RemoveChild(Accessible* aChild);
|
2010-06-08 20:39:58 +04:00
|
|
|
|
2016-02-19 21:11:33 +03:00
|
|
|
/**
|
2019-09-12 04:00:15 +03:00
|
|
|
* Reallocates the child within its parent.
|
2016-02-19 21:11:33 +03:00
|
|
|
*/
|
2019-09-12 04:00:15 +03:00
|
|
|
virtual void RelocateChild(uint32_t aNewIndex, Accessible* aChild);
|
2016-02-19 21:11:33 +03:00
|
|
|
|
2009-12-10 22:12:19 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Accessible tree traverse methods
|
2009-06-18 11:37:38 +04:00
|
|
|
|
|
|
|
/**
|
2009-12-10 22:12:19 +03:00
|
|
|
* Return parent accessible.
|
2009-06-18 11:37:38 +04:00
|
|
|
*/
|
2012-05-29 05:18:45 +04:00
|
|
|
Accessible* Parent() const { return mParent; }
|
2009-06-18 11:37:38 +04:00
|
|
|
|
|
|
|
/**
|
2009-12-10 22:12:19 +03:00
|
|
|
* Return child accessible at the given index.
|
2009-11-19 17:44:59 +03:00
|
|
|
*/
|
2014-01-25 07:08:17 +04:00
|
|
|
virtual Accessible* GetChildAt(uint32_t aIndex) const;
|
2009-11-19 17:44:59 +03:00
|
|
|
|
|
|
|
/**
|
2009-12-10 22:12:19 +03:00
|
|
|
* Return child accessible count.
|
2009-11-19 17:44:59 +03:00
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual uint32_t ChildCount() const;
|
2009-12-10 22:12:19 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return index of the given child accessible.
|
|
|
|
*/
|
2014-01-25 18:07:37 +04:00
|
|
|
int32_t GetIndexOf(const Accessible* aChild) const {
|
|
|
|
return (aChild->mParent != this) ? -1 : aChild->IndexInParent();
|
|
|
|
}
|
2009-12-10 22:12:19 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return index in parent accessible.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual int32_t IndexInParent() const;
|
2009-06-18 11:37:38 +04:00
|
|
|
|
2010-05-21 15:27:00 +04:00
|
|
|
/**
|
|
|
|
* Return true if accessible has children;
|
|
|
|
*/
|
2018-05-13 13:14:55 +03:00
|
|
|
bool HasChildren() const { return !!GetChildAt(0); }
|
2010-05-21 15:27:00 +04:00
|
|
|
|
2011-06-07 06:23:13 +04:00
|
|
|
/**
|
2011-07-23 12:38:33 +04:00
|
|
|
* Return first/last/next/previous sibling of the accessible.
|
2011-06-07 06:23:13 +04:00
|
|
|
*/
|
2012-05-29 05:18:45 +04:00
|
|
|
inline Accessible* NextSibling() const { return GetSiblingAtOffset(1); }
|
|
|
|
inline Accessible* PrevSibling() const { return GetSiblingAtOffset(-1); }
|
2018-05-04 16:06:49 +03:00
|
|
|
inline Accessible* FirstChild() const { return GetChildAt(0); }
|
|
|
|
inline Accessible* LastChild() const {
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t childCount = ChildCount();
|
2012-07-30 18:20:58 +04:00
|
|
|
return childCount != 0 ? GetChildAt(childCount - 1) : nullptr;
|
2011-07-23 12:38:33 +04:00
|
|
|
}
|
|
|
|
|
2010-08-15 15:28:49 +04:00
|
|
|
/**
|
|
|
|
* Return embedded accessible children count.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t EmbeddedChildCount();
|
2010-08-15 15:28:49 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return embedded accessible child at the given index.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
Accessible* GetEmbeddedChildAt(uint32_t aIndex);
|
2010-08-15 15:28:49 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return index of the given embedded accessible child.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t GetIndexOfEmbeddedChild(Accessible* aChild);
|
2010-08-15 15:28:49 +04:00
|
|
|
|
2011-06-07 06:24:01 +04: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 19:56:38 +04:00
|
|
|
uint32_t ContentChildCount() const { return mChildren.Length(); }
|
|
|
|
Accessible* ContentChildAt(uint32_t aIndex) const {
|
2011-06-07 06:24:01 +04:00
|
|
|
return mChildren.ElementAt(aIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the accessible is attached to tree.
|
|
|
|
*/
|
2011-01-28 07:38:02 +03:00
|
|
|
bool IsBoundToParent() const { return !!mParent; }
|
2009-06-18 11:37:38 +04:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-12-10 22:12:19 +03:00
|
|
|
// Miscellaneous methods
|
2009-06-18 11:37:38 +04:00
|
|
|
|
|
|
|
/**
|
2010-01-19 07:23:44 +03:00
|
|
|
* Handle accessible event, i.e. process it, notifies observers and fires
|
|
|
|
* platform specific event.
|
2009-06-18 11:37:38 +04:00
|
|
|
*/
|
2010-08-25 06:08:28 +04:00
|
|
|
virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
|
2009-06-18 11:37:38 +04:00
|
|
|
|
2013-09-06 23:27:07 +04:00
|
|
|
/**
|
|
|
|
* Return true if the accessible is an acceptable child.
|
|
|
|
*/
|
2016-02-24 16:01:21 +03:00
|
|
|
virtual bool IsAcceptableChild(nsIContent* aEl) const {
|
2017-09-13 21:04:00 +03:00
|
|
|
return aEl &&
|
|
|
|
!aEl->IsAnyOfHTMLElements(nsGkAtoms::option, nsGkAtoms::optgroup);
|
|
|
|
}
|
2013-09-06 23:27:07 +04:00
|
|
|
|
2009-06-18 11:37:38 +04:00
|
|
|
/**
|
|
|
|
* Returns text of accessible if accessible has text role otherwise empty
|
|
|
|
* string.
|
|
|
|
*
|
2011-02-01 06:00:24 +03: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 11:37:38 +04:00
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0,
|
2012-09-28 10:57:33 +04:00
|
|
|
uint32_t aLength = UINT32_MAX);
|
2009-06-18 11:37:38 +04:00
|
|
|
|
2018-04-24 22:07:03 +03:00
|
|
|
/**
|
|
|
|
* Return boundaries in screen coordinates in app units.
|
|
|
|
*/
|
|
|
|
virtual nsRect BoundsInAppUnits() const;
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
/**
|
|
|
|
* Return boundaries in screen coordinates.
|
|
|
|
*/
|
2018-04-30 22:02:12 +03:00
|
|
|
virtual nsIntRect Bounds() const;
|
2018-04-24 22:07:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return boundaries in screen coordinates in CSS pixels.
|
|
|
|
*/
|
|
|
|
virtual nsIntRect BoundsInCSSPixels() const;
|
2014-09-16 21:30:23 +04:00
|
|
|
|
2012-05-08 04:00:36 +04:00
|
|
|
/**
|
|
|
|
* Return boundaries rect relative the bounding frame.
|
|
|
|
*/
|
2014-09-16 21:30:23 +04:00
|
|
|
virtual nsRect RelativeBounds(nsIFrame** aRelativeFrame) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Selects the accessible within its container if applicable.
|
|
|
|
*/
|
|
|
|
virtual void SetSelected(bool aSelect);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Select the accessible within its container.
|
|
|
|
*/
|
|
|
|
void TakeSelection();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Focus the accessible.
|
|
|
|
*/
|
2018-05-15 20:19:54 +03:00
|
|
|
virtual void TakeFocus() const;
|
2014-09-16 21:30:23 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Scroll the accessible into view.
|
|
|
|
*/
|
2019-04-13 15:13:13 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2018-10-11 19:22:11 +03:00
|
|
|
virtual void ScrollTo(uint32_t aHow) const;
|
2014-09-16 21:30:23 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Scroll the accessible to the given point.
|
|
|
|
*/
|
|
|
|
void ScrollToPoint(uint32_t aCoordinateType, int32_t aX, int32_t aY);
|
2012-05-08 04:00:36 +04:00
|
|
|
|
2014-10-22 04:49:28 +04:00
|
|
|
/**
|
|
|
|
* Get a pointer to accessibility interface for this node, which is specific
|
|
|
|
* to the OS/accessibility toolkit we're running on.
|
|
|
|
*/
|
|
|
|
virtual void GetNativeInterface(void** aNativeAccessible);
|
|
|
|
|
2011-01-28 08:15:13 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2011-09-28 05:46:11 +04:00
|
|
|
// Downcasting and types
|
2011-01-28 08:15:13 +03:00
|
|
|
|
2011-11-24 15:31:34 +04:00
|
|
|
inline bool IsAbbreviation() const {
|
2015-03-03 14:08:59 +03:00
|
|
|
return mContent->IsAnyOfHTMLElements(nsGkAtoms::abbr, nsGkAtoms::acronym);
|
2011-11-24 15:31:34 +04:00
|
|
|
}
|
|
|
|
|
2016-02-29 18:08:40 +03:00
|
|
|
bool IsAlert() const { return HasGenericType(eAlert); }
|
|
|
|
|
2012-12-18 09:22:26 +04:00
|
|
|
bool IsApplication() const { return mType == eApplicationType; }
|
2014-10-22 04:49:28 +04:00
|
|
|
ApplicationAccessible* AsApplication();
|
2011-02-22 16:54:46 +03:00
|
|
|
|
2012-12-21 07:16:44 +04:00
|
|
|
bool IsAutoComplete() const { return HasGenericType(eAutoComplete); }
|
2011-09-28 05:46:11 +04:00
|
|
|
|
2012-12-18 09:22:26 +04:00
|
|
|
bool IsAutoCompletePopup() const {
|
2012-12-21 07:16:44 +04:00
|
|
|
return HasGenericType(eAutoCompletePopup);
|
|
|
|
}
|
2011-09-28 05:46:11 +04:00
|
|
|
|
2014-04-04 12:01:19 +04:00
|
|
|
bool IsButton() const { return HasGenericType(eButton); }
|
|
|
|
|
2012-12-21 07:16:44 +04:00
|
|
|
bool IsCombobox() const { return HasGenericType(eCombobox); }
|
2011-09-28 05:46:11 +04:00
|
|
|
|
2012-12-21 07:16:44 +04:00
|
|
|
bool IsDoc() const { return HasGenericType(eDocument); }
|
2012-05-27 13:01:40 +04:00
|
|
|
DocAccessible* AsDoc();
|
2011-05-20 09:17:47 +04:00
|
|
|
|
2015-02-14 04:09:51 +03:00
|
|
|
bool IsGenericHyperText() const { return mType == eHyperTextType; }
|
2012-12-21 07:16:44 +04:00
|
|
|
bool IsHyperText() const { return HasGenericType(eHyperText); }
|
2012-05-31 12:04:41 +04:00
|
|
|
HyperTextAccessible* AsHyperText();
|
2011-01-28 08:15:13 +03:00
|
|
|
|
2013-09-11 20:56:01 +04:00
|
|
|
bool IsHTMLBr() const { return mType == eHTMLBRType; }
|
2016-03-01 18:54:49 +03:00
|
|
|
bool IsHTMLCaption() const { return mType == eHTMLCaptionType; }
|
2014-12-30 23:43:49 +03:00
|
|
|
bool IsHTMLCombobox() const { return mType == eHTMLComboboxType; }
|
2012-12-18 09:22:26 +04:00
|
|
|
bool IsHTMLFileInput() const { return mType == eHTMLFileInputType; }
|
2011-11-30 16:36:20 +04:00
|
|
|
|
2012-12-18 09:22:26 +04:00
|
|
|
bool IsHTMLListItem() const { return mType == eHTMLLiType; }
|
|
|
|
HTMLLIAccessible* AsHTMLListItem();
|
2012-03-16 00:16:02 +04:00
|
|
|
|
2020-04-24 17:34:09 +03:00
|
|
|
bool IsHTMLLink() const { return mType == eHTMLLinkType; }
|
|
|
|
HTMLLinkAccessible* AsHTMLLink();
|
|
|
|
|
2012-11-10 13:41:40 +04:00
|
|
|
bool IsHTMLOptGroup() const { return mType == eHTMLOptGroupType; }
|
|
|
|
|
2013-02-16 09:42:00 +04:00
|
|
|
bool IsHTMLTable() const { return mType == eHTMLTableType; }
|
2012-12-18 09:22:26 +04:00
|
|
|
bool IsHTMLTableRow() const { return mType == eHTMLTableRowType; }
|
2011-03-28 17:59:54 +04:00
|
|
|
|
2012-12-18 09:22:26 +04:00
|
|
|
bool IsImage() const { return mType == eImageType; }
|
|
|
|
ImageAccessible* AsImage();
|
2012-03-16 00:16:02 +04:00
|
|
|
|
2012-12-18 09:22:26 +04:00
|
|
|
bool IsImageMap() const { return mType == eImageMapType; }
|
|
|
|
HTMLImageMapAccessible* AsImageMap();
|
2012-04-03 13:54:01 +04:00
|
|
|
|
2012-12-21 07:16:44 +04:00
|
|
|
bool IsList() const { return HasGenericType(eList); }
|
2012-06-29 03:04:50 +04:00
|
|
|
|
2012-12-21 07:16:44 +04:00
|
|
|
bool IsListControl() const { return HasGenericType(eListControl); }
|
2011-09-28 05:46:11 +04:00
|
|
|
|
2012-12-21 07:16:44 +04:00
|
|
|
bool IsMenuButton() const { return HasGenericType(eMenuButton); }
|
2011-09-28 05:46:11 +04:00
|
|
|
|
2012-12-18 09:22:26 +04:00
|
|
|
bool IsMenuPopup() const { return mType == eMenuPopupType; }
|
2011-09-28 05:46:11 +04:00
|
|
|
|
2015-01-20 00:34:14 +03:00
|
|
|
bool IsProxy() const { return mType == eProxyType; }
|
2015-01-22 02:31:27 +03:00
|
|
|
ProxyAccessible* Proxy() const {
|
|
|
|
MOZ_ASSERT(IsProxy());
|
|
|
|
return mBits.proxy;
|
|
|
|
}
|
2015-10-08 21:40:31 +03:00
|
|
|
uint32_t ProxyInterfaces() const {
|
|
|
|
MOZ_ASSERT(IsProxy());
|
|
|
|
return mInt.mProxyInterfaces;
|
|
|
|
}
|
|
|
|
void SetProxyInterfaces(uint32_t aInterfaces) {
|
|
|
|
MOZ_ASSERT(IsProxy());
|
|
|
|
mInt.mProxyInterfaces = aInterfaces;
|
|
|
|
}
|
2015-01-20 00:34:14 +03:00
|
|
|
|
2015-06-02 23:30:28 +03:00
|
|
|
bool IsOuterDoc() const { return mType == eOuterDocType; }
|
|
|
|
OuterDocAccessible* AsOuterDoc();
|
|
|
|
|
2012-12-18 09:22:26 +04:00
|
|
|
bool IsProgress() const { return mType == eProgressType; }
|
2012-10-16 07:05:20 +04:00
|
|
|
|
2012-12-18 09:22:26 +04:00
|
|
|
bool IsRoot() const { return mType == eRootType; }
|
|
|
|
a11y::RootAccessible* AsRoot();
|
2011-03-02 08:16:28 +03:00
|
|
|
|
2015-03-01 01:25:06 +03:00
|
|
|
bool IsSearchbox() const;
|
|
|
|
|
2012-12-21 07:16:44 +04:00
|
|
|
bool IsSelect() const { return HasGenericType(eSelect); }
|
2012-03-28 04:53:58 +04:00
|
|
|
|
2012-12-21 07:16:44 +04:00
|
|
|
bool IsTable() const { return HasGenericType(eTable); }
|
2012-12-18 09:22:26 +04:00
|
|
|
virtual TableAccessible* AsTable() { return nullptr; }
|
2012-08-09 10:24:31 +04:00
|
|
|
|
2018-11-08 13:54:09 +03:00
|
|
|
/**
|
|
|
|
* Note: The eTable* types defined in the ARIA map are used in
|
|
|
|
* nsAccessibilityService::CreateAccessible to determine which ARIAGrid*
|
|
|
|
* classes to use for accessible object creation. However, an invalid table
|
|
|
|
* structure might cause these classes not to be used after all.
|
|
|
|
*
|
|
|
|
* To make sure we're really dealing with a table cell, only check the
|
|
|
|
* generic type defined by the class, not the type defined in the ARIA map.
|
|
|
|
*/
|
|
|
|
bool IsTableCell() const { return mGenericTypes & eTableCell; }
|
2012-12-18 09:22:26 +04:00
|
|
|
virtual TableCellAccessible* AsTableCell() { return nullptr; }
|
2013-02-14 14:57:35 +04:00
|
|
|
const TableCellAccessible* AsTableCell() const {
|
|
|
|
return const_cast<Accessible*>(this)->AsTableCell();
|
|
|
|
}
|
2012-12-18 09:22:26 +04:00
|
|
|
|
2012-12-21 07:16:44 +04:00
|
|
|
bool IsTableRow() const { return HasGenericType(eTableRow); }
|
2012-12-18 09:22:26 +04:00
|
|
|
|
2018-03-16 14:02:00 +03:00
|
|
|
bool IsTextField() const {
|
|
|
|
return mType == eHTMLTextFieldType || mType == eHTMLTextPasswordFieldType;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsPassword() const { return mType == eHTMLTextPasswordFieldType; }
|
2013-04-05 12:15:26 +04:00
|
|
|
|
2016-04-08 15:35:11 +03:00
|
|
|
bool IsText() const { return mGenericTypes & eText; }
|
|
|
|
|
2012-12-18 09:22:26 +04:00
|
|
|
bool IsTextLeaf() const { return mType == eTextLeafType; }
|
|
|
|
TextLeafAccessible* AsTextLeaf();
|
|
|
|
|
2013-03-01 08:06:16 +04:00
|
|
|
bool IsXULLabel() const { return mType == eXULLabelType; }
|
|
|
|
XULLabelAccessible* AsXULLabel();
|
|
|
|
|
2014-03-31 18:30:46 +04:00
|
|
|
bool IsXULListItem() const { return mType == eXULListItemType; }
|
|
|
|
|
2012-12-28 12:15:02 +04:00
|
|
|
bool IsXULTabpanels() const { return mType == eXULTabpanelsType; }
|
2012-12-18 09:22:26 +04:00
|
|
|
|
2020-03-03 04:42:46 +03:00
|
|
|
bool IsXULTooltip() const { return mType == eXULTooltipType; }
|
|
|
|
|
2012-12-18 09:22:26 +04:00
|
|
|
bool IsXULTree() const { return mType == eXULTreeType; }
|
|
|
|
XULTreeAccessible* AsXULTree();
|
2011-01-31 07:04:32 +03:00
|
|
|
|
2012-12-21 07:16:44 +04:00
|
|
|
/**
|
|
|
|
* Return true if the accessible belongs to the given accessible type.
|
|
|
|
*/
|
|
|
|
bool HasGenericType(AccGenericType aType) const;
|
|
|
|
|
2011-07-19 12:30:24 +04:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// ActionAccessible
|
|
|
|
|
2011-06-05 23:35:43 +04:00
|
|
|
/**
|
|
|
|
* Return the number of actions that can be performed on this accessible.
|
|
|
|
*/
|
2018-05-15 20:40:22 +03:00
|
|
|
virtual uint8_t ActionCount() const;
|
2011-06-05 23:35:43 +04:00
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
/**
|
|
|
|
* Return action name at given index.
|
|
|
|
*/
|
|
|
|
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Default to localized action name.
|
|
|
|
*/
|
|
|
|
void ActionDescriptionAt(uint8_t aIndex, nsAString& aDescription) {
|
|
|
|
nsAutoString name;
|
|
|
|
ActionNameAt(aIndex, name);
|
|
|
|
TranslateString(name, aDescription);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoke the accessible action.
|
|
|
|
*/
|
2018-05-15 20:40:22 +03:00
|
|
|
virtual bool DoAction(uint8_t aIndex) const;
|
2014-09-16 21:30:23 +04:00
|
|
|
|
2011-07-19 12:30:24 +04: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 07:26:13 +04:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2014-09-16 21:30:23 +04:00
|
|
|
// HyperLinkAccessible (any embedded object in text can implement HyperLink,
|
|
|
|
// which helps determine where it is located within containing text).
|
2010-09-01 07:26:13 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the accessible is hyper link accessible.
|
|
|
|
*/
|
2018-05-04 15:48:34 +03:00
|
|
|
virtual bool IsLink() const;
|
2010-09-01 07:26:13 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the start offset of the link within the parent accessible.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual uint32_t StartOffset();
|
2010-09-01 07:26:13 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the end offset of the link within the parent accessible.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual uint32_t EndOffset();
|
2010-09-01 07:26:13 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the link is valid (e. g. points to a valid URL).
|
|
|
|
*/
|
2011-06-22 09:43:25 +04:00
|
|
|
inline bool IsLinkValid() {
|
2018-04-28 22:50:58 +03:00
|
|
|
MOZ_ASSERT(IsLink(), "IsLinkValid is called on not hyper link!");
|
2011-06-22 09:43:25 +04: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 16:43:01 +04:00
|
|
|
return (0 == (State() & mozilla::a11y::states::INVALID));
|
2011-06-22 09:43:25 +04:00
|
|
|
}
|
2010-09-01 07:26:13 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the number of anchors within the link.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual uint32_t AnchorCount();
|
2010-09-01 07:26:13 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an anchor accessible at the given index.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual Accessible* AnchorAt(uint32_t aAnchorIndex);
|
2010-09-01 07:26:13 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an anchor URI at the given index.
|
|
|
|
*/
|
2018-05-15 20:19:54 +03:00
|
|
|
virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex) const;
|
2010-09-01 07:26:13 +04:00
|
|
|
|
2016-01-20 20:53:03 +03:00
|
|
|
/**
|
|
|
|
* Returns a text point for the accessible element.
|
|
|
|
*/
|
|
|
|
void ToTextPoint(HyperTextAccessible** aContainer, int32_t* aOffset,
|
|
|
|
bool aIsBefore = true) const;
|
|
|
|
|
2010-09-02 04:46:59 +04:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// SelectAccessible
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return an array of selected items.
|
|
|
|
*/
|
2014-10-22 04:49:28 +04:00
|
|
|
virtual void SelectedItems(nsTArray<Accessible*>* aItems);
|
2010-09-02 04:46:59 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the number of selected items.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual uint32_t SelectedItemCount();
|
2010-09-02 04:46:59 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return selected item at the given index.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual Accessible* GetSelectedItem(uint32_t aIndex);
|
2010-09-02 04:46:59 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine if item at the given index is selected.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual bool IsItemSelected(uint32_t aIndex);
|
2010-09-02 04:46:59 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add item at the given index the selection. Return true if success.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual bool AddItemToSelection(uint32_t aIndex);
|
2010-09-02 04:46:59 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove item at the given index from the selection. Return if success.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual bool RemoveItemFromSelection(uint32_t aIndex);
|
2010-09-02 04:46:59 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Select all items. Return true if success.
|
|
|
|
*/
|
|
|
|
virtual bool SelectAll();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unselect all items. Return true if success.
|
|
|
|
*/
|
|
|
|
virtual bool UnselectAll();
|
|
|
|
|
2013-11-20 01:01:15 +04:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Value (numeric value interface)
|
|
|
|
|
|
|
|
virtual double MaxValue() const;
|
|
|
|
virtual double MinValue() const;
|
|
|
|
virtual double CurValue() const;
|
|
|
|
virtual double Step() const;
|
|
|
|
virtual bool SetCurValue(double aValue);
|
|
|
|
|
2011-09-28 05:46:11 +04: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.
|
|
|
|
*/
|
2018-05-13 12:26:02 +03:00
|
|
|
virtual Accessible* CurrentItem() const;
|
2011-09-28 05:46:11 +04:00
|
|
|
|
2011-12-08 16:20:15 +04:00
|
|
|
/**
|
|
|
|
* Set the current item of the widget.
|
|
|
|
*/
|
2018-05-13 13:14:55 +03:00
|
|
|
virtual void SetCurrentItem(const Accessible* aItem);
|
2011-12-08 16:20:15 +04:00
|
|
|
|
2011-09-28 05:46:11 +04:00
|
|
|
/**
|
|
|
|
* Return container widget this accessible belongs to.
|
|
|
|
*/
|
2012-05-29 05:18:45 +04:00
|
|
|
virtual Accessible* ContainerWidget() const;
|
2011-09-28 05:46:11 +04:00
|
|
|
|
2012-01-27 10:14:09 +04:00
|
|
|
/**
|
|
|
|
* Return the localized string for the given key.
|
|
|
|
*/
|
2012-05-10 17:43:04 +04:00
|
|
|
static void TranslateString(const nsString& aKey, nsAString& aStringOut);
|
2012-01-27 10:14:09 +04:00
|
|
|
|
2012-03-28 19:59:01 +04:00
|
|
|
/**
|
|
|
|
* Return true if the accessible is defunct.
|
|
|
|
*/
|
2018-02-28 00:34:12 +03:00
|
|
|
bool IsDefunct() const;
|
2012-03-28 19:59:01 +04:00
|
|
|
|
2012-06-12 18:30:59 +04:00
|
|
|
/**
|
2015-12-14 20:02:23 +03:00
|
|
|
* Return false if the accessible is no longer in the document.
|
2012-06-12 18:30:59 +04:00
|
|
|
*/
|
2012-12-11 07:31:42 +04:00
|
|
|
bool IsInDocument() const { return !(mStateFlags & eIsNotInDocument); }
|
2012-06-12 18:30:59 +04:00
|
|
|
|
2012-09-04 10:06:10 +04:00
|
|
|
/**
|
2012-10-13 10:34:21 +04:00
|
|
|
* Return true if the accessible should be contained by document node map.
|
|
|
|
*/
|
|
|
|
bool IsNodeMapEntry() const {
|
2012-12-11 07:31:42 +04:00
|
|
|
return HasOwnContent() && !(mStateFlags & eNotNodeMapEntry);
|
|
|
|
}
|
2012-10-13 10:34:21 +04:00
|
|
|
|
2014-03-28 18:01:06 +04:00
|
|
|
/**
|
|
|
|
* Return true if the accessible's group info needs to be updated.
|
|
|
|
*/
|
|
|
|
inline bool HasDirtyGroupInfo() const {
|
|
|
|
return mStateFlags & eGroupInfoDirty;
|
|
|
|
}
|
|
|
|
|
2012-10-13 10:34:21 +04:00
|
|
|
/**
|
|
|
|
* Return true if the accessible has associated DOM content.
|
|
|
|
*/
|
2012-12-11 07:31:42 +04:00
|
|
|
bool HasOwnContent() const {
|
|
|
|
return mContent && !(mStateFlags & eSharedNode);
|
|
|
|
}
|
2012-09-04 10:06:10 +04:00
|
|
|
|
2019-08-29 09:39:28 +03:00
|
|
|
/**
|
|
|
|
* Return true if native markup has a numeric value.
|
|
|
|
*/
|
|
|
|
bool NativeHasNumericValue() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if ARIA specifies support for a numeric value.
|
|
|
|
*/
|
|
|
|
bool ARIAHasNumericValue() const;
|
|
|
|
|
2012-10-04 18:34:56 +04:00
|
|
|
/**
|
|
|
|
* Return true if the accessible has a numeric value.
|
|
|
|
*/
|
|
|
|
bool HasNumericValue() const;
|
|
|
|
|
2013-08-02 20:42:36 +04:00
|
|
|
/**
|
|
|
|
* Return true if the accessible state change is processed by handling proper
|
2018-08-29 10:42:31 +03:00
|
|
|
* DOM UI event, if otherwise then false. For example, CheckboxAccessible
|
|
|
|
* created for HTML:input@type="checkbox" will process
|
|
|
|
* nsIDocumentObserver::ContentStateChanged instead of 'CheckboxStateChange'
|
|
|
|
* event.
|
2013-08-02 20:42:36 +04:00
|
|
|
*/
|
|
|
|
bool NeedsDOMUIEvent() const { return !(mStateFlags & eIgnoreDOMUIEvent); }
|
|
|
|
|
2015-09-15 19:01:51 +03:00
|
|
|
/**
|
|
|
|
* Get/set repositioned bit indicating that the accessible was moved in
|
|
|
|
* the accessible tree, i.e. the accessible tree structure differs from DOM.
|
|
|
|
*/
|
2015-10-30 01:08:48 +03:00
|
|
|
bool IsRelocated() const { return mStateFlags & eRelocated; }
|
|
|
|
void SetRelocated(bool aRelocated) {
|
|
|
|
if (aRelocated)
|
|
|
|
mStateFlags |= eRelocated;
|
2015-09-15 19:01:51 +03:00
|
|
|
else
|
2015-10-30 01:08:48 +03:00
|
|
|
mStateFlags &= ~eRelocated;
|
2015-09-15 19:01:51 +03:00
|
|
|
}
|
|
|
|
|
2016-04-01 04:40:56 +03:00
|
|
|
/**
|
|
|
|
* Return true if the accessible allows accessible children from subtree of
|
|
|
|
* a DOM element of this accessible.
|
|
|
|
*/
|
|
|
|
bool KidsFromDOM() const { return !(mStateFlags & eNoKidsFromDOM); }
|
2016-02-22 20:32:03 +03:00
|
|
|
|
2014-03-31 18:30:46 +04:00
|
|
|
/**
|
|
|
|
* Return true if this accessible has a parent whose name depends on this
|
|
|
|
* accessible.
|
|
|
|
*/
|
|
|
|
bool HasNameDependentParent() const {
|
|
|
|
return mContextFlags & eHasNameDependentParent;
|
|
|
|
}
|
|
|
|
|
2016-02-29 18:08:40 +03:00
|
|
|
/**
|
|
|
|
* Return true if the element is inside an alert.
|
|
|
|
*/
|
|
|
|
bool IsInsideAlert() const { return mContextFlags & eInsideAlert; }
|
|
|
|
|
2016-09-06 05:53:08 +03:00
|
|
|
/**
|
|
|
|
* Return true if there is a pending reorder event for this accessible.
|
|
|
|
*/
|
|
|
|
bool ReorderEventTarget() const { return mReorderEventTarget; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if there is a pending show event for this accessible.
|
|
|
|
*/
|
|
|
|
bool ShowEventTarget() const { return mShowEventTarget; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if there is a pending hide event for this accessible.
|
|
|
|
*/
|
|
|
|
bool HideEventTarget() const { return mHideEventTarget; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set if there is a pending reorder event for this accessible.
|
|
|
|
*/
|
|
|
|
void SetReorderEventTarget(bool aTarget) { mReorderEventTarget = aTarget; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set if this accessible is a show event target.
|
|
|
|
*/
|
|
|
|
void SetShowEventTarget(bool aTarget) { mShowEventTarget = aTarget; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set if this accessible is a hide event target.
|
|
|
|
*/
|
|
|
|
void SetHideEventTarget(bool aTarget) { mHideEventTarget = aTarget; }
|
|
|
|
|
2019-02-14 20:42:45 +03:00
|
|
|
void Announce(const nsAString& aAnnouncement, uint16_t aPriority);
|
|
|
|
|
2020-04-16 01:33:48 +03:00
|
|
|
/**
|
|
|
|
* Fire a focusable state change event if the previous state
|
|
|
|
* was different.
|
|
|
|
*/
|
|
|
|
void MaybeFireFocusableStateChange(bool aPreviouslyFocusable);
|
|
|
|
|
2009-12-10 22:12:19 +03:00
|
|
|
protected:
|
2014-06-23 23:56:09 +04:00
|
|
|
virtual ~Accessible();
|
|
|
|
|
2012-10-19 11:15:23 +04:00
|
|
|
/**
|
|
|
|
* Return the accessible name provided by native markup. It doesn't take
|
|
|
|
* into account ARIA markup used to specify the name.
|
|
|
|
*/
|
2018-05-15 19:13:02 +03:00
|
|
|
virtual mozilla::a11y::ENameValueFlag NativeName(nsString& aName) const;
|
2012-10-19 11:15:23 +04:00
|
|
|
|
2016-05-23 01:12:54 +03:00
|
|
|
/**
|
|
|
|
* Return the accessible description provided by native markup. It doesn't
|
|
|
|
* take into account ARIA markup used to specify the description.
|
|
|
|
*/
|
|
|
|
virtual void NativeDescription(nsString& aDescription);
|
|
|
|
|
2012-10-19 11:15:23 +04:00
|
|
|
/**
|
|
|
|
* Return object attributes provided by native markup. It doesn't take into
|
|
|
|
* account ARIA.
|
|
|
|
*/
|
|
|
|
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes();
|
|
|
|
|
2009-06-18 11:37:38 +04:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-12-10 22:12:19 +03:00
|
|
|
// Initializing, cache and tree traverse methods
|
|
|
|
|
2013-10-29 07:30:55 +04:00
|
|
|
/**
|
|
|
|
* Destroy the object.
|
|
|
|
*/
|
|
|
|
void LastRelease();
|
|
|
|
|
2010-07-02 05:22:41 +04:00
|
|
|
/**
|
|
|
|
* Set accessible parent and index in parent.
|
|
|
|
*/
|
2015-08-05 06:33:54 +03:00
|
|
|
void BindToParent(Accessible* aParent, uint32_t aIndexInParent);
|
|
|
|
void UnbindFromParent();
|
2010-07-02 05:22:41 +04:00
|
|
|
|
2009-12-10 22:12:19 +03:00
|
|
|
/**
|
|
|
|
* Return sibling accessible at the given offset.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
|
2012-07-30 18:20:58 +04:00
|
|
|
nsresult* aError = nullptr) const;
|
2009-12-10 22:12:19 +03:00
|
|
|
|
2011-01-28 08:15:13 +03:00
|
|
|
/**
|
2012-03-28 19:59:01 +04:00
|
|
|
* Flags used to describe the state of this accessible.
|
2011-01-28 08:15:13 +03:00
|
|
|
*/
|
2012-03-28 19:59:01 +04:00
|
|
|
enum StateFlags {
|
2012-12-11 07:31:42 +04: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 09:22:26 +04:00
|
|
|
eHasNumericValue = 1 << 4, // accessible has a numeric value
|
2014-03-28 18:01:06 +04:00
|
|
|
eGroupInfoDirty = 1 << 5, // accessible needs to update group info
|
2016-04-01 17:53:52 +03:00
|
|
|
eKidsMutating = 1 << 6, // subtree is being mutated
|
2014-09-02 22:54:04 +04:00
|
|
|
eIgnoreDOMUIEvent = 1 << 7, // don't process DOM UI events for a11y events
|
2017-08-24 17:22:55 +03:00
|
|
|
eRelocated = 1 << 8, // accessible was moved in tree
|
2019-08-15 03:58:28 +03:00
|
|
|
eNoKidsFromDOM = 1 << 9, // accessible doesn't allow children from DOM
|
|
|
|
eHasTextKids = 1 << 10, // accessible have a text leaf in children
|
2012-03-28 19:59:01 +04:00
|
|
|
|
2019-08-15 03:58:28 +03:00
|
|
|
eLastStateFlag = eHasTextKids
|
2011-01-28 08:15:13 +03:00
|
|
|
};
|
|
|
|
|
2014-03-31 18:30:46 +04:00
|
|
|
/**
|
|
|
|
* Flags used for contextual information about the accessible.
|
|
|
|
*/
|
|
|
|
enum ContextFlags {
|
|
|
|
eHasNameDependentParent =
|
|
|
|
1 << 0, // Parent's name depends on this accessible.
|
2018-07-04 17:18:43 +03:00
|
|
|
eInsideAlert = 1 << 1,
|
2014-03-31 18:30:46 +04:00
|
|
|
|
2016-02-29 18:08:40 +03:00
|
|
|
eLastContextFlag = eInsideAlert
|
2014-03-31 18:30:46 +04:00
|
|
|
};
|
|
|
|
|
2012-11-11 06:16:17 +04:00
|
|
|
protected:
|
2009-12-10 22:12:19 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Miscellaneous helpers
|
2007-11-12 04:05:37 +03:00
|
|
|
|
2010-12-01 11:53:17 +03:00
|
|
|
/**
|
|
|
|
* Return ARIA role (helper method).
|
|
|
|
*/
|
2018-05-15 15:50:38 +03:00
|
|
|
mozilla::a11y::role ARIATransformRole(mozilla::a11y::role aRole) const;
|
2010-12-01 11:53:17 +03:00
|
|
|
|
2008-12-03 10:18:41 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-12-10 22:12:19 +03:00
|
|
|
// Name helpers
|
2008-12-03 10:18:41 +03:00
|
|
|
|
|
|
|
/**
|
2012-10-14 08:18:39 +04:00
|
|
|
* Returns the accessible name specified by ARIA.
|
2008-12-03 10:18:41 +03:00
|
|
|
*/
|
2018-05-15 19:13:02 +03:00
|
|
|
void ARIAName(nsString& aName) const;
|
2008-12-03 10:18:41 +03:00
|
|
|
|
2020-03-02 13:59:22 +03:00
|
|
|
/**
|
|
|
|
* Returns the accessible description specified by ARIA.
|
|
|
|
*/
|
|
|
|
void ARIADescription(nsString& aDescription) const;
|
|
|
|
|
2019-11-28 09:36:04 +03:00
|
|
|
/**
|
|
|
|
* Returns the accessible name specified for this control using XUL
|
|
|
|
* <label control="id" ...>.
|
|
|
|
*/
|
|
|
|
static void NameFromAssociatedXULLabel(DocAccessible* aDocument,
|
|
|
|
nsIContent* aElm, nsString& aName);
|
|
|
|
|
2008-12-03 10:18:41 +03:00
|
|
|
/**
|
2013-12-08 01:37:04 +04:00
|
|
|
* Return the name for XUL element.
|
2008-12-03 10:18:41 +03:00
|
|
|
*/
|
2013-12-08 01:37:04 +04:00
|
|
|
static void XULElmName(DocAccessible* aDocument, nsIContent* aElm,
|
|
|
|
nsString& aName);
|
2008-12-03 10:18:41 +03: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 05:05:26 +03:00
|
|
|
// helper method to verify frames
|
2002-05-09 00:43:49 +04:00
|
|
|
static nsresult GetFullKeyName(const nsAString& aModifierName,
|
|
|
|
const nsAString& aKeyName,
|
|
|
|
nsAString& aStringOut);
|
2001-09-26 02:32:32 +04:00
|
|
|
|
2009-08-20 10:45:19 +04: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
|
|
|
|
*/
|
2018-05-06 20:11:06 +03:00
|
|
|
void DoCommand(nsIContent* aContent = nullptr,
|
|
|
|
uint32_t aActionIndex = 0) const;
|
2009-08-20 10:45:19 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatch click event.
|
|
|
|
*/
|
2019-04-13 15:13:13 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2018-05-06 20:11:06 +03:00
|
|
|
virtual void DispatchClickEvent(nsIContent* aContent,
|
|
|
|
uint32_t aActionIndex) const;
|
2009-08-20 10:45:19 +04:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Helpers
|
2005-02-01 12:40:36 +03:00
|
|
|
|
2007-09-19 01:40:04 +04:00
|
|
|
/**
|
2007-12-12 05:10:26 +03:00
|
|
|
* Get the container node for an atomic region, defined by aria-atomic="true"
|
2007-09-19 01:40:04 +04:00
|
|
|
* @return the container node
|
|
|
|
*/
|
2011-08-10 05:44:00 +04:00
|
|
|
nsIContent* GetAtomicRegion() const;
|
2007-09-19 01:40:04 +04:00
|
|
|
|
2007-08-04 09:27:27 +04:00
|
|
|
/**
|
2013-11-20 01:01:15 +04:00
|
|
|
* Return numeric value of the given ARIA attribute, NaN if not applicable.
|
2007-08-04 09:27:27 +04:00
|
|
|
*
|
2013-11-20 01:01:15 +04:00
|
|
|
* @param aARIAProperty [in] the ARIA property we're using
|
|
|
|
* @return a numeric value
|
2007-08-04 09:27:27 +04:00
|
|
|
*/
|
2017-10-03 01:05:19 +03:00
|
|
|
double AttrNumericValue(nsAtom* aARIAAttr) const;
|
2007-08-04 09:27:27 +04:00
|
|
|
|
2008-10-08 16:54:58 +04:00
|
|
|
/**
|
|
|
|
* Return the action rule based on ARIA enum constants EActionRule
|
2014-09-16 21:30:23 +04:00
|
|
|
* (see ARIAMap.h). Used by ActionCount() and ActionNameAt().
|
2008-10-08 16:54:58 +04:00
|
|
|
*/
|
2014-09-16 21:30:23 +04:00
|
|
|
uint32_t GetActionRule() const;
|
2008-10-08 16:54:58 +04:00
|
|
|
|
2010-07-03 07:11:35 +04:00
|
|
|
/**
|
|
|
|
* Return group info.
|
|
|
|
*/
|
2018-05-15 16:47:10 +03:00
|
|
|
AccGroupInfo* GetGroupInfo() const;
|
2010-07-03 07:11:35 +04:00
|
|
|
|
2001-05-12 01:11:38 +04:00
|
|
|
// Data Members
|
2013-10-29 07:30:55 +04:00
|
|
|
nsCOMPtr<nsIContent> mContent;
|
2017-01-07 02:03:30 +03:00
|
|
|
RefPtr<DocAccessible> mDoc;
|
2013-10-29 07:30:55 +04:00
|
|
|
|
2016-04-12 18:20:56 +03:00
|
|
|
Accessible* mParent;
|
|
|
|
nsTArray<Accessible*> mChildren;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mIndexInParent;
|
2008-08-06 16:19:56 +04:00
|
|
|
|
2019-08-15 03:58:28 +03:00
|
|
|
static const uint8_t kStateFlagsBits = 11;
|
2018-07-04 17:18:43 +03:00
|
|
|
static const uint8_t kContextFlagsBits = 2;
|
2013-03-01 08:06:16 +04:00
|
|
|
static const uint8_t kTypeBits = 6;
|
2016-04-08 15:35:11 +03:00
|
|
|
static const uint8_t kGenericTypesBits = 16;
|
2012-12-18 09:22:26 +04:00
|
|
|
|
2016-07-18 19:40:53 +03:00
|
|
|
/**
|
|
|
|
* Non-NO_ROLE_MAP_ENTRY_INDEX indicates author-supplied role;
|
|
|
|
* possibly state & value as well
|
|
|
|
*/
|
|
|
|
uint8_t mRoleMapEntryIndex;
|
|
|
|
|
2012-12-11 07:31:42 +04:00
|
|
|
/**
|
2016-04-06 00:34:00 +03:00
|
|
|
* Keep in sync with StateFlags, ContextFlags, and AccTypes.
|
2012-12-11 07:31:42 +04:00
|
|
|
*/
|
2018-05-15 16:47:10 +03:00
|
|
|
mutable uint32_t mStateFlags : kStateFlagsBits;
|
2014-03-31 18:30:46 +04:00
|
|
|
uint32_t mContextFlags : kContextFlagsBits;
|
2012-12-18 09:22:26 +04:00
|
|
|
uint32_t mType : kTypeBits;
|
|
|
|
uint32_t mGenericTypes : kGenericTypesBits;
|
2016-09-06 05:53:08 +03:00
|
|
|
uint32_t mReorderEventTarget : 1;
|
|
|
|
uint32_t mShowEventTarget : 1;
|
|
|
|
uint32_t mHideEventTarget : 1;
|
2012-12-18 09:22:26 +04:00
|
|
|
|
|
|
|
void StaticAsserts() const;
|
2011-01-28 08:15:04 +03:00
|
|
|
|
2016-06-20 18:35:38 +03:00
|
|
|
#ifdef A11Y_LOG
|
|
|
|
friend void logging::Tree(const char* aTitle, const char* aMsgText,
|
2016-08-19 19:10:58 +03:00
|
|
|
Accessible* aRoot,
|
2016-06-20 18:35:38 +03:00
|
|
|
logging::GetTreePrefix aPrefixFunc,
|
|
|
|
void* aGetTreePrefixData);
|
|
|
|
#endif
|
2012-06-12 18:30:59 +04:00
|
|
|
friend class DocAccessible;
|
2014-09-16 21:30:23 +04:00
|
|
|
friend class xpcAccessible;
|
2016-04-07 16:30:22 +03:00
|
|
|
friend class TreeMutation;
|
2010-08-15 15:28:49 +04:00
|
|
|
|
2016-06-29 13:57:00 +03:00
|
|
|
UniquePtr<mozilla::a11y::EmbeddedObjCollector> mEmbeddedObjCollector;
|
2015-10-08 21:40:31 +03:00
|
|
|
union {
|
|
|
|
int32_t mIndexOfEmbeddedChild;
|
|
|
|
uint32_t mProxyInterfaces;
|
|
|
|
} mInt;
|
|
|
|
|
2012-11-18 06:01:44 +04:00
|
|
|
friend class EmbeddedObjCollector;
|
2010-08-15 15:28:49 +04:00
|
|
|
|
2015-01-20 00:34:14 +03:00
|
|
|
union {
|
|
|
|
AccGroupInfo* groupInfo;
|
|
|
|
ProxyAccessible* proxy;
|
2018-05-15 16:47:10 +03:00
|
|
|
} mutable mBits;
|
2010-07-03 07:11:35 +04:00
|
|
|
friend class AccGroupInfo;
|
2012-06-04 16:32:34 +04:00
|
|
|
|
2013-10-29 07:30:55 +04:00
|
|
|
private:
|
2015-01-07 02:35:02 +03:00
|
|
|
Accessible() = delete;
|
|
|
|
Accessible(const Accessible&) = delete;
|
|
|
|
Accessible& operator=(const Accessible&) = delete;
|
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 05:05:26 +03:00
|
|
|
};
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(Accessible, NS_ACCESSIBLE_IMPL_IID)
|
2011-07-19 12:30:24 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Represent key binding associated with accessible (such as access key and
|
|
|
|
* global keyboard shortcuts).
|
|
|
|
*/
|
|
|
|
class KeyBinding {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Modifier mask values.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04: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 12:30:24 +04:00
|
|
|
|
2014-05-22 08:06:05 +04:00
|
|
|
static uint32_t AccelModifier();
|
|
|
|
|
2011-07-19 12:30:24 +04:00
|
|
|
KeyBinding() : mKey(0), mModifierMask(0) {}
|
2012-08-22 19:56:38 +04:00
|
|
|
KeyBinding(uint32_t aKey, uint32_t aModifierMask)
|
2012-12-09 21:23:19 +04:00
|
|
|
: mKey(aKey), mModifierMask(aModifierMask) {}
|
2011-07-19 12:30:24 +04:00
|
|
|
|
|
|
|
inline bool IsEmpty() const { return !mKey; }
|
2012-08-22 19:56:38 +04:00
|
|
|
inline uint32_t Key() const { return mKey; }
|
|
|
|
inline uint32_t ModifierMask() const { return mModifierMask; }
|
2011-07-19 12:30:24 +04: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 19:56:38 +04:00
|
|
|
uint32_t mKey;
|
|
|
|
uint32_t mModifierMask;
|
2011-07-19 12:30:24 +04:00
|
|
|
};
|
|
|
|
|
2012-11-18 06:01:44 +04:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2010-07-16 18:15:03 +04:00
|
|
|
#endif
|