2001-10-09 21:52:36 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-10-09 21:52:36 +00:00
|
|
|
|
2012-06-04 12:32:29 +00:00
|
|
|
#ifndef mozilla_a11y_BaseAccessibles_h__
|
|
|
|
#define mozilla_a11y_BaseAccessibles_h__
|
2001-10-09 21:52:36 +00:00
|
|
|
|
2012-05-29 01:18:45 +00:00
|
|
|
#include "AccessibleWrap.h"
|
2023-08-02 01:42:17 +00:00
|
|
|
#include "HyperTextAccessible.h"
|
2013-03-22 00:05:20 +00:00
|
|
|
|
|
|
|
class nsIContent;
|
2003-04-15 08:45:55 +00:00
|
|
|
|
2001-10-09 21:52:36 +00:00
|
|
|
/**
|
|
|
|
* This file contains a number of classes that are used as base
|
|
|
|
* classes for the different accessibility implementations of
|
|
|
|
* the HTML and XUL widget sets. --jgaunt
|
|
|
|
*/
|
2006-10-30 03:05:43 +00:00
|
|
|
|
2012-06-04 12:32:29 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
|
|
|
/**
|
2001-10-09 21:52:36 +00:00
|
|
|
* Leaf version of DOM Accessible -- has no children
|
|
|
|
*/
|
2012-06-04 12:32:29 +00:00
|
|
|
class LeafAccessible : public AccessibleWrap {
|
2001-11-07 00:12:16 +00:00
|
|
|
public:
|
2012-06-04 12:32:29 +00:00
|
|
|
LeafAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2009-05-11 10:57:28 +00:00
|
|
|
|
|
|
|
// nsISupports
|
2018-02-12 20:44:40 +00:00
|
|
|
NS_INLINE_DECL_REFCOUNTING_INHERITED(LeafAccessible, AccessibleWrap)
|
2009-05-11 10:57:28 +00:00
|
|
|
|
2021-02-19 23:14:32 +00:00
|
|
|
// LocalAccessible
|
2021-03-03 06:10:01 +00:00
|
|
|
virtual LocalAccessible* LocalChildAtPoint(
|
2021-02-19 23:14:32 +00:00
|
|
|
int32_t aX, int32_t aY, EWhichChildAtPoint aWhichChild) override;
|
|
|
|
bool InsertChildAt(uint32_t aIndex, LocalAccessible* aChild) final;
|
|
|
|
bool RemoveChild(LocalAccessible* aChild) final;
|
2009-10-28 10:42:36 +00:00
|
|
|
|
2016-02-25 15:42:52 +00:00
|
|
|
virtual bool IsAcceptableChild(nsIContent* aEl) const override;
|
|
|
|
|
2009-10-28 10:42:36 +00:00
|
|
|
protected:
|
2014-07-08 21:23:18 +00:00
|
|
|
virtual ~LeafAccessible() {}
|
2001-10-09 21:52:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2009-10-27 00:58:36 +00:00
|
|
|
* Used for text or image accessible nodes contained by link accessibles or
|
|
|
|
* accessibles for nodes with registered click event handler. It knows how to
|
2022-04-22 23:13:36 +00:00
|
|
|
* report the state of the host link (traveled or not) and can focus the host
|
|
|
|
* accessible programmatically.
|
2009-10-27 00:58:36 +00:00
|
|
|
*/
|
2012-06-04 12:32:29 +00:00
|
|
|
class LinkableAccessible : public AccessibleWrap {
|
2001-11-07 00:12:16 +00:00
|
|
|
public:
|
2015-08-05 03:33:54 +00:00
|
|
|
LinkableAccessible(nsIContent* aContent, DocAccessible* aDoc)
|
|
|
|
: AccessibleWrap(aContent, aDoc) {}
|
2008-03-18 11:37:12 +00:00
|
|
|
|
2018-02-12 20:44:40 +00:00
|
|
|
NS_INLINE_DECL_REFCOUNTING_INHERITED(LinkableAccessible, AccessibleWrap)
|
2008-03-18 11:37:12 +00:00
|
|
|
|
2021-02-19 23:14:32 +00:00
|
|
|
// LocalAccessible
|
2018-05-15 16:55:28 +00:00
|
|
|
virtual void Value(nsString& aValue) const override;
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual uint64_t NativeLinkState() const override;
|
2018-05-15 17:19:54 +00:00
|
|
|
virtual void TakeFocus() const override;
|
2008-11-04 03:37:46 +00:00
|
|
|
|
2011-07-19 08:30:24 +00:00
|
|
|
// ActionAccessible
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual KeyBinding AccessKey() const override;
|
2011-07-19 08:30:24 +00:00
|
|
|
|
2015-08-05 03:33:54 +00:00
|
|
|
// ActionAccessible helpers
|
2021-02-19 23:14:32 +00:00
|
|
|
const LocalAccessible* ActionWalk(bool* aIsLink = nullptr,
|
2022-02-15 23:20:11 +00:00
|
|
|
bool* aIsOnclick = nullptr) const;
|
2010-09-01 03:26:13 +00:00
|
|
|
|
2001-11-07 00:12:16 +00:00
|
|
|
protected:
|
2014-07-08 21:23:18 +00:00
|
|
|
virtual ~LinkableAccessible() {}
|
2001-10-09 21:52:36 +00:00
|
|
|
};
|
|
|
|
|
2005-09-30 02:16:13 +00:00
|
|
|
/**
|
2015-03-04 23:45:17 +00:00
|
|
|
* A simple accessible that gets its enumerated role.
|
2012-06-04 12:32:29 +00:00
|
|
|
*/
|
2015-03-04 23:45:17 +00:00
|
|
|
template <a11y::role R>
|
2015-03-05 00:04:46 +00:00
|
|
|
class EnumRoleAccessible : public AccessibleWrap {
|
2005-09-30 02:16:13 +00:00
|
|
|
public:
|
2015-03-05 00:04:46 +00:00
|
|
|
EnumRoleAccessible(nsIContent* aContent, DocAccessible* aDoc)
|
2015-03-04 23:45:17 +00:00
|
|
|
: AccessibleWrap(aContent, aDoc) {}
|
2018-11-30 10:46:48 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aPtr) override {
|
2021-02-19 23:14:32 +00:00
|
|
|
return LocalAccessible::QueryInterface(aIID, aPtr);
|
2015-03-04 23:45:17 +00:00
|
|
|
}
|
2009-03-07 15:38:58 +00:00
|
|
|
|
2021-02-19 23:14:32 +00:00
|
|
|
// LocalAccessible
|
2018-05-07 19:05:50 +00:00
|
|
|
virtual a11y::role NativeRole() const override { return R; }
|
2005-09-30 02:16:13 +00:00
|
|
|
|
|
|
|
protected:
|
2015-03-05 00:04:46 +00:00
|
|
|
virtual ~EnumRoleAccessible() {}
|
2005-09-30 02:16:13 +00:00
|
|
|
};
|
|
|
|
|
2022-12-15 02:21:24 +00:00
|
|
|
/**
|
|
|
|
* Like EnumRoleAccessible, but with text support.
|
|
|
|
*/
|
|
|
|
template <a11y::role R>
|
2023-08-02 01:42:17 +00:00
|
|
|
class EnumRoleHyperTextAccessible : public HyperTextAccessible {
|
2022-12-15 02:21:24 +00:00
|
|
|
public:
|
|
|
|
EnumRoleHyperTextAccessible(nsIContent* aContent, DocAccessible* aDoc)
|
2023-08-02 01:42:17 +00:00
|
|
|
: HyperTextAccessible(aContent, aDoc) {}
|
2022-12-15 02:21:24 +00:00
|
|
|
|
|
|
|
// LocalAccessible
|
|
|
|
virtual a11y::role NativeRole() const override { return R; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~EnumRoleHyperTextAccessible() {}
|
|
|
|
};
|
|
|
|
|
2012-10-13 06:34:21 +00:00
|
|
|
/**
|
|
|
|
* A wrapper accessible around native accessible to connect it with
|
|
|
|
* crossplatform accessible tree.
|
|
|
|
*/
|
|
|
|
class DummyAccessible : public AccessibleWrap {
|
|
|
|
public:
|
2014-10-10 21:28:35 +00:00
|
|
|
explicit DummyAccessible(DocAccessible* aDocument = nullptr)
|
2020-08-03 17:31:40 +00:00
|
|
|
: AccessibleWrap(nullptr, aDocument) {
|
|
|
|
// IsDefunct() asserts if mContent is null, which is always true for
|
|
|
|
// DummyAccessible. We can prevent this by setting eSharedNode.
|
|
|
|
mStateFlags |= eSharedNode;
|
|
|
|
}
|
2012-10-13 06:34:21 +00:00
|
|
|
|
2018-05-15 18:04:50 +00:00
|
|
|
uint64_t NativeState() const final;
|
2018-02-09 05:22:43 +00:00
|
|
|
uint64_t NativeInteractiveState() const final;
|
|
|
|
uint64_t NativeLinkState() const final;
|
|
|
|
bool NativelyUnavailable() const final;
|
|
|
|
void ApplyARIAState(uint64_t* aState) const final;
|
2014-10-22 00:49:28 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~DummyAccessible() {}
|
2012-10-13 06:34:21 +00:00
|
|
|
};
|
|
|
|
|
2012-06-04 12:32:29 +00:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|