accessible/src/generic/BaseAccessibles.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef mozilla_a11y_BaseAccessibles_h__
michael@0 7 #define mozilla_a11y_BaseAccessibles_h__
michael@0 8
michael@0 9 #include "AccessibleWrap.h"
michael@0 10 #include "HyperTextAccessibleWrap.h"
michael@0 11
michael@0 12 class nsIContent;
michael@0 13
michael@0 14 /**
michael@0 15 * This file contains a number of classes that are used as base
michael@0 16 * classes for the different accessibility implementations of
michael@0 17 * the HTML and XUL widget sets. --jgaunt
michael@0 18 */
michael@0 19
michael@0 20 namespace mozilla {
michael@0 21 namespace a11y {
michael@0 22
michael@0 23 /**
michael@0 24 * Leaf version of DOM Accessible -- has no children
michael@0 25 */
michael@0 26 class LeafAccessible : public AccessibleWrap
michael@0 27 {
michael@0 28 public:
michael@0 29
michael@0 30 LeafAccessible(nsIContent* aContent, DocAccessible* aDoc);
michael@0 31
michael@0 32 // nsISupports
michael@0 33 NS_DECL_ISUPPORTS_INHERITED
michael@0 34
michael@0 35 // Accessible
michael@0 36 virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
michael@0 37 EWhichChildAtPoint aWhichChild);
michael@0 38 virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild) MOZ_OVERRIDE MOZ_FINAL;
michael@0 39 virtual bool RemoveChild(Accessible* aChild) MOZ_OVERRIDE MOZ_FINAL;
michael@0 40
michael@0 41 protected:
michael@0 42
michael@0 43 // Accessible
michael@0 44 virtual void CacheChildren();
michael@0 45 };
michael@0 46
michael@0 47 /**
michael@0 48 * Used for text or image accessible nodes contained by link accessibles or
michael@0 49 * accessibles for nodes with registered click event handler. It knows how to
michael@0 50 * report the state of the host link (traveled or not) and can activate (click)
michael@0 51 * the host accessible programmatically.
michael@0 52 */
michael@0 53 class LinkableAccessible : public AccessibleWrap
michael@0 54 {
michael@0 55 public:
michael@0 56 enum { eAction_Jump = 0 };
michael@0 57
michael@0 58 LinkableAccessible(nsIContent* aContent, DocAccessible* aDoc);
michael@0 59
michael@0 60 NS_DECL_ISUPPORTS_INHERITED
michael@0 61
michael@0 62 // nsIAccessible
michael@0 63 NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName);
michael@0 64 NS_IMETHOD DoAction(uint8_t index);
michael@0 65 NS_IMETHOD TakeFocus();
michael@0 66
michael@0 67 // Accessible
michael@0 68 virtual void Shutdown();
michael@0 69 virtual void Value(nsString& aValue);
michael@0 70 virtual uint64_t NativeLinkState() const;
michael@0 71
michael@0 72 // ActionAccessible
michael@0 73 virtual uint8_t ActionCount();
michael@0 74 virtual KeyBinding AccessKey() const;
michael@0 75
michael@0 76 // HyperLinkAccessible
michael@0 77 virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex);
michael@0 78
michael@0 79 protected:
michael@0 80 // Accessible
michael@0 81 virtual void BindToParent(Accessible* aParent, uint32_t aIndexInParent);
michael@0 82 virtual void UnbindFromParent();
michael@0 83
michael@0 84 /**
michael@0 85 * Parent accessible that provides an action for this linkable accessible.
michael@0 86 */
michael@0 87 Accessible* mActionAcc;
michael@0 88 bool mIsLink;
michael@0 89 bool mIsOnclick;
michael@0 90 };
michael@0 91
michael@0 92 /**
michael@0 93 * A simple accessible that gets its enumerated role passed into constructor.
michael@0 94 */
michael@0 95 class EnumRoleAccessible : public AccessibleWrap
michael@0 96 {
michael@0 97 public:
michael@0 98 EnumRoleAccessible(nsIContent* aContent, DocAccessible* aDoc,
michael@0 99 a11y::role aRole);
michael@0 100 virtual ~EnumRoleAccessible() { }
michael@0 101
michael@0 102 NS_DECL_ISUPPORTS_INHERITED
michael@0 103
michael@0 104 // Accessible
michael@0 105 virtual a11y::role NativeRole();
michael@0 106
michael@0 107 protected:
michael@0 108 a11y::role mRole;
michael@0 109 };
michael@0 110
michael@0 111
michael@0 112 /**
michael@0 113 * A wrapper accessible around native accessible to connect it with
michael@0 114 * crossplatform accessible tree.
michael@0 115 */
michael@0 116 class DummyAccessible : public AccessibleWrap
michael@0 117 {
michael@0 118 public:
michael@0 119 DummyAccessible() : AccessibleWrap(nullptr, nullptr) { }
michael@0 120 virtual ~DummyAccessible() { }
michael@0 121
michael@0 122 virtual uint64_t NativeState() MOZ_OVERRIDE MOZ_FINAL;
michael@0 123 virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE MOZ_FINAL;
michael@0 124 virtual uint64_t NativeLinkState() const MOZ_OVERRIDE MOZ_FINAL;
michael@0 125 virtual bool NativelyUnavailable() const MOZ_OVERRIDE MOZ_FINAL;
michael@0 126 virtual void ApplyARIAState(uint64_t* aState) const MOZ_OVERRIDE MOZ_FINAL;
michael@0 127 };
michael@0 128
michael@0 129 } // namespace a11y
michael@0 130 } // namespace mozilla
michael@0 131
michael@0 132 #endif

mercurial