1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_a11y_XULElementAccessibles_h__
7 #define mozilla_a11y_XULElementAccessibles_h__
9 #include "HyperTextAccessibleWrap.h"
10 #include "TextLeafAccessible.h"
15 class XULLabelTextLeafAccessible
;
18 * Used for XUL description and label elements.
20 class XULLabelAccessible
: public HyperTextAccessibleWrap
{
22 XULLabelAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
25 virtual void Shutdown() override
;
26 virtual a11y::role
NativeRole() const override
;
27 virtual uint64_t NativeState() const override
;
28 virtual Relation
RelationByType(RelationType aType
) const override
;
30 void UpdateLabelValue(const nsString
& aValue
);
34 virtual ENameValueFlag
NativeName(nsString
& aName
) const override
;
35 virtual void DispatchClickEvent(nsIContent
* aContent
,
36 uint32_t aActionIndex
) const override
;
39 RefPtr
<XULLabelTextLeafAccessible
> mValueTextLeaf
;
42 inline XULLabelAccessible
* LocalAccessible::AsXULLabel() {
43 return IsXULLabel() ? static_cast<XULLabelAccessible
*>(this) : nullptr;
47 * Used to implement text interface on XUL label accessible in case when text
48 * is provided by @value attribute (no underlying text frame).
50 class XULLabelTextLeafAccessible final
: public TextLeafAccessible
{
52 XULLabelTextLeafAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
)
53 : TextLeafAccessible(aContent
, aDoc
) {
54 mStateFlags
|= eSharedNode
;
57 virtual ~XULLabelTextLeafAccessible() {}
60 virtual a11y::role
NativeRole() const override
;
61 virtual uint64_t NativeState() const override
;
65 * Used for XUL tooltip element.
67 class XULTooltipAccessible
: public LeafAccessible
{
69 XULTooltipAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
72 virtual a11y::role
NativeRole() const override
;
73 virtual uint64_t NativeState() const override
;
76 class XULLinkAccessible
: public XULLabelAccessible
{
78 XULLinkAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
81 virtual void Value(nsString
& aValue
) const override
;
82 virtual a11y::role
NativeRole() const override
;
83 virtual uint64_t NativeLinkState() const override
;
86 virtual bool HasPrimaryAction() const override
;
87 virtual void ActionNameAt(uint8_t aIndex
, nsAString
& aName
) override
;
89 // HyperLinkAccessible
90 virtual bool IsLink() const override
;
91 virtual uint32_t StartOffset() override
;
92 virtual uint32_t EndOffset() override
;
93 virtual already_AddRefed
<nsIURI
> AnchorURIAt(
94 uint32_t aAnchorIndex
) const override
;
97 virtual ~XULLinkAccessible();
100 virtual ENameValueFlag
NativeName(nsString
& aName
) const override
;
102 enum { eAction_Jump
= 0 };
106 } // namespace mozilla