mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-07 12:15:51 +00:00
138 lines
3.7 KiB
C++
138 lines
3.7 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* 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/. */
|
|
|
|
#ifndef mozilla_a11y_BaseAccessibles_h__
|
|
#define mozilla_a11y_BaseAccessibles_h__
|
|
|
|
#include "AccessibleWrap.h"
|
|
#include "HyperTextAccessibleWrap.h"
|
|
|
|
class nsIContent;
|
|
|
|
/**
|
|
* 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
|
|
*/
|
|
|
|
namespace mozilla {
|
|
namespace a11y {
|
|
|
|
/**
|
|
* Leaf version of DOM Accessible -- has no children
|
|
*/
|
|
class LeafAccessible : public AccessibleWrap
|
|
{
|
|
public:
|
|
|
|
LeafAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
|
|
|
// nsISupports
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
// Accessible
|
|
virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
|
|
EWhichChildAtPoint aWhichChild);
|
|
virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild) MOZ_OVERRIDE MOZ_FINAL;
|
|
virtual bool RemoveChild(Accessible* aChild) MOZ_OVERRIDE MOZ_FINAL;
|
|
|
|
protected:
|
|
virtual ~LeafAccessible() {}
|
|
|
|
// Accessible
|
|
virtual void CacheChildren();
|
|
};
|
|
|
|
/**
|
|
* Used for text or image accessible nodes contained by link accessibles or
|
|
* accessibles for nodes with registered click event handler. It knows how to
|
|
* report the state of the host link (traveled or not) and can activate (click)
|
|
* the host accessible programmatically.
|
|
*/
|
|
class LinkableAccessible : public AccessibleWrap
|
|
{
|
|
public:
|
|
enum { eAction_Jump = 0 };
|
|
|
|
LinkableAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
// Accessible
|
|
virtual void Shutdown() MOZ_OVERRIDE;
|
|
virtual void Value(nsString& aValue) MOZ_OVERRIDE;
|
|
virtual uint64_t NativeLinkState() const MOZ_OVERRIDE;
|
|
virtual void TakeFocus() MOZ_OVERRIDE;
|
|
|
|
// ActionAccessible
|
|
virtual uint8_t ActionCount() MOZ_OVERRIDE;
|
|
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
|
|
virtual bool DoAction(uint8_t index) MOZ_OVERRIDE;
|
|
virtual KeyBinding AccessKey() const;
|
|
|
|
// HyperLinkAccessible
|
|
virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex);
|
|
|
|
protected:
|
|
virtual ~LinkableAccessible() {}
|
|
|
|
// Accessible
|
|
virtual void BindToParent(Accessible* aParent, uint32_t aIndexInParent);
|
|
virtual void UnbindFromParent();
|
|
|
|
/**
|
|
* Parent accessible that provides an action for this linkable accessible.
|
|
*/
|
|
Accessible* mActionAcc;
|
|
bool mIsLink;
|
|
bool mIsOnclick;
|
|
};
|
|
|
|
/**
|
|
* A simple accessible that gets its enumerated role passed into constructor.
|
|
*/
|
|
class EnumRoleAccessible : public AccessibleWrap
|
|
{
|
|
public:
|
|
EnumRoleAccessible(nsIContent* aContent, DocAccessible* aDoc,
|
|
a11y::role aRole);
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
// Accessible
|
|
virtual a11y::role NativeRole() MOZ_OVERRIDE;
|
|
|
|
protected:
|
|
virtual ~EnumRoleAccessible() { }
|
|
|
|
a11y::role mRole;
|
|
};
|
|
|
|
|
|
/**
|
|
* A wrapper accessible around native accessible to connect it with
|
|
* crossplatform accessible tree.
|
|
*/
|
|
class DummyAccessible : public AccessibleWrap
|
|
{
|
|
public:
|
|
explicit DummyAccessible(DocAccessible* aDocument = nullptr) :
|
|
AccessibleWrap(nullptr, aDocument) { }
|
|
|
|
virtual uint64_t NativeState() MOZ_OVERRIDE MOZ_FINAL;
|
|
virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE MOZ_FINAL;
|
|
virtual uint64_t NativeLinkState() const MOZ_OVERRIDE MOZ_FINAL;
|
|
virtual bool NativelyUnavailable() const MOZ_OVERRIDE MOZ_FINAL;
|
|
virtual void ApplyARIAState(uint64_t* aState) const MOZ_OVERRIDE MOZ_FINAL;
|
|
|
|
protected:
|
|
virtual ~DummyAccessible() { }
|
|
};
|
|
|
|
} // namespace a11y
|
|
} // namespace mozilla
|
|
|
|
#endif
|