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-10 23:44:50 +00:00
|
|
|
#ifndef mozilla_a11y_XULElementAccessibles_h__
|
|
|
|
#define mozilla_a11y_XULElementAccessibles_h__
|
2001-10-09 21:52:36 +00:00
|
|
|
|
2012-05-31 08:04:41 +00:00
|
|
|
#include "HyperTextAccessibleWrap.h"
|
2013-03-01 04:06:16 +00:00
|
|
|
#include "TextLeafAccessibleWrap.h"
|
2001-10-09 21:52:36 +00:00
|
|
|
|
2012-06-10 23:44:50 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
2013-03-01 04:06:16 +00:00
|
|
|
class XULLabelTextLeafAccessible;
|
|
|
|
|
2010-06-11 08:23:18 +00:00
|
|
|
/**
|
|
|
|
* Used for XUL description and label elements.
|
|
|
|
*/
|
2012-06-10 23:44:50 +00:00
|
|
|
class XULLabelAccessible : public HyperTextAccessibleWrap {
|
2001-10-09 21:52:36 +00:00
|
|
|
public:
|
2012-06-10 23:44:50 +00:00
|
|
|
XULLabelAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2008-10-10 12:26:55 +00:00
|
|
|
|
2012-05-29 01:18:45 +00:00
|
|
|
// Accessible
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void Shutdown() override;
|
2018-05-07 19:05:50 +00:00
|
|
|
virtual a11y::role NativeRole() const override;
|
2018-05-15 18:04:50 +00:00
|
|
|
virtual uint64_t NativeState() const override;
|
2018-05-15 13:47:10 +00:00
|
|
|
virtual Relation RelationByType(RelationType aType) const override;
|
2012-10-14 04:18:39 +00:00
|
|
|
|
2013-03-01 04:06:16 +00:00
|
|
|
void UpdateLabelValue(const nsString& aValue);
|
|
|
|
|
2012-10-14 04:18:39 +00:00
|
|
|
protected:
|
|
|
|
// Accessible
|
2018-05-15 16:13:02 +00:00
|
|
|
virtual ENameValueFlag NativeName(nsString& aName) const override;
|
2019-09-03 19:11:35 +00:00
|
|
|
virtual void DispatchClickEvent(nsIContent* aContent,
|
|
|
|
uint32_t aActionIndex) const override;
|
2013-03-01 04:06:16 +00:00
|
|
|
|
|
|
|
private:
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<XULLabelTextLeafAccessible> mValueTextLeaf;
|
2013-03-01 04:06:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
inline XULLabelAccessible* Accessible::AsXULLabel() {
|
|
|
|
return IsXULLabel() ? static_cast<XULLabelAccessible*>(this) : nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used to implement text interface on XUL label accessible in case when text
|
|
|
|
* is provided by @value attribute (no underlying text frame).
|
|
|
|
*/
|
2015-03-21 16:28:04 +00:00
|
|
|
class XULLabelTextLeafAccessible final : public TextLeafAccessibleWrap {
|
2013-03-01 04:06:16 +00:00
|
|
|
public:
|
|
|
|
XULLabelTextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc)
|
|
|
|
: TextLeafAccessibleWrap(aContent, aDoc) {
|
|
|
|
mStateFlags |= eSharedNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~XULLabelTextLeafAccessible() {}
|
|
|
|
|
|
|
|
// Accessible
|
2018-05-07 19:05:50 +00:00
|
|
|
virtual a11y::role NativeRole() const override;
|
2018-05-15 18:04:50 +00:00
|
|
|
virtual uint64_t NativeState() const override;
|
2001-10-09 21:52:36 +00:00
|
|
|
};
|
|
|
|
|
2010-06-11 08:23:18 +00:00
|
|
|
/**
|
|
|
|
* Used for XUL tooltip element.
|
|
|
|
*/
|
2012-06-10 23:44:50 +00:00
|
|
|
class XULTooltipAccessible : public LeafAccessible {
|
2002-11-06 01:29:58 +00:00
|
|
|
public:
|
2012-06-10 23:44:50 +00:00
|
|
|
XULTooltipAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2008-10-10 12:26:55 +00:00
|
|
|
|
2012-05-29 01:18:45 +00:00
|
|
|
// Accessible
|
2018-05-07 19:05:50 +00:00
|
|
|
virtual a11y::role NativeRole() const override;
|
2018-05-15 18:04:50 +00:00
|
|
|
virtual uint64_t NativeState() const override;
|
2002-11-06 01:29:58 +00:00
|
|
|
};
|
|
|
|
|
2013-08-20 20:42:26 +00:00
|
|
|
class XULLinkAccessible : public XULLabelAccessible {
|
2005-07-14 15:12:12 +00:00
|
|
|
public:
|
2012-06-10 23:44:50 +00:00
|
|
|
XULLinkAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2008-03-18 11:37:12 +00:00
|
|
|
|
2012-05-29 01:18:45 +00:00
|
|
|
// Accessible
|
2018-05-15 16:55:28 +00:00
|
|
|
virtual void Value(nsString& aValue) const override;
|
2018-05-07 19:05:50 +00:00
|
|
|
virtual a11y::role NativeRole() const override;
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual uint64_t NativeLinkState() const override;
|
2008-10-10 12:26:55 +00:00
|
|
|
|
2011-06-05 19:35:43 +00:00
|
|
|
// ActionAccessible
|
2018-05-15 17:40:22 +00:00
|
|
|
virtual uint8_t ActionCount() const override;
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
2018-05-15 17:40:22 +00:00
|
|
|
virtual bool DoAction(uint8_t aIndex) const override;
|
2011-06-05 19:35:43 +00:00
|
|
|
|
2010-09-01 03:26:13 +00:00
|
|
|
// HyperLinkAccessible
|
2018-05-04 12:48:34 +00:00
|
|
|
virtual bool IsLink() const override;
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual uint32_t StartOffset() override;
|
|
|
|
virtual uint32_t EndOffset() override;
|
2018-05-15 17:19:54 +00:00
|
|
|
virtual already_AddRefed<nsIURI> AnchorURIAt(
|
|
|
|
uint32_t aAnchorIndex) const override;
|
2010-09-01 03:26:13 +00:00
|
|
|
|
2005-07-14 15:12:12 +00:00
|
|
|
protected:
|
2014-07-08 21:23:18 +00:00
|
|
|
virtual ~XULLinkAccessible();
|
|
|
|
|
2012-10-14 04:18:39 +00:00
|
|
|
// Accessible
|
2018-05-15 16:13:02 +00:00
|
|
|
virtual ENameValueFlag NativeName(nsString& aName) const override;
|
2012-10-14 04:18:39 +00:00
|
|
|
|
2008-03-18 11:37:12 +00:00
|
|
|
enum { eAction_Jump = 0 };
|
2005-07-14 15:12:12 +00:00
|
|
|
};
|
|
|
|
|
2012-06-10 23:44:50 +00:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|