2001-10-10 01:52:36 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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-10 01:52:36 +04:00
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
#ifndef mozilla_a11y_XULElementAccessibles_h__
|
|
|
|
#define mozilla_a11y_XULElementAccessibles_h__
|
2001-10-10 01:52:36 +04:00
|
|
|
|
2012-05-31 12:04:41 +04:00
|
|
|
#include "HyperTextAccessibleWrap.h"
|
2013-03-01 08:06:16 +04:00
|
|
|
#include "TextLeafAccessibleWrap.h"
|
2001-10-10 01:52:36 +04:00
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
2013-03-01 08:06:16 +04:00
|
|
|
class XULLabelTextLeafAccessible;
|
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
/**
|
|
|
|
* Used for XUL description and label elements.
|
|
|
|
*/
|
2012-06-11 03:44:50 +04:00
|
|
|
class XULLabelAccessible : public HyperTextAccessibleWrap
|
2001-10-10 01:52:36 +04:00
|
|
|
{
|
|
|
|
public:
|
2012-06-11 03:44:50 +04:00
|
|
|
XULLabelAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2008-10-10 16:26:55 +04:00
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
// Accessible
|
2015-01-02 09:11:21 +03:00
|
|
|
virtual void Shutdown() MOZ_OVERRIDE;
|
2014-09-16 21:30:23 +04:00
|
|
|
virtual a11y::role NativeRole() MOZ_OVERRIDE;
|
|
|
|
virtual uint64_t NativeState() MOZ_OVERRIDE;
|
2013-10-19 22:19:50 +04:00
|
|
|
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
|
2012-10-14 08:18:39 +04:00
|
|
|
|
2013-03-01 08:06:16 +04:00
|
|
|
void UpdateLabelValue(const nsString& aValue);
|
|
|
|
|
2012-10-14 08:18:39 +04:00
|
|
|
protected:
|
|
|
|
// Accessible
|
|
|
|
virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
|
2013-03-01 08:06:16 +04:00
|
|
|
virtual void CacheChildren() MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsRefPtr<XULLabelTextLeafAccessible> mValueTextLeaf;
|
|
|
|
};
|
|
|
|
|
|
|
|
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).
|
|
|
|
*/
|
|
|
|
class XULLabelTextLeafAccessible MOZ_FINAL : public TextLeafAccessibleWrap
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
XULLabelTextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
|
|
|
TextLeafAccessibleWrap(aContent, aDoc)
|
|
|
|
{ mStateFlags |= eSharedNode; }
|
|
|
|
|
|
|
|
virtual ~XULLabelTextLeafAccessible() { }
|
|
|
|
|
|
|
|
// Accessible
|
|
|
|
virtual a11y::role NativeRole() MOZ_OVERRIDE;
|
|
|
|
virtual uint64_t NativeState() MOZ_OVERRIDE;
|
2001-10-10 01:52:36 +04:00
|
|
|
};
|
|
|
|
|
2013-03-01 08:06:16 +04:00
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
/**
|
|
|
|
* Used for XUL tooltip element.
|
|
|
|
*/
|
2012-06-11 03:44:50 +04:00
|
|
|
class XULTooltipAccessible : public LeafAccessible
|
2002-11-06 04:29:58 +03:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2012-06-11 03:44:50 +04:00
|
|
|
XULTooltipAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2008-10-10 16:26:55 +04:00
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
// Accessible
|
2014-09-16 21:30:23 +04:00
|
|
|
virtual a11y::role NativeRole() MOZ_OVERRIDE;
|
|
|
|
virtual uint64_t NativeState() MOZ_OVERRIDE;
|
2002-11-06 04:29:58 +03:00
|
|
|
};
|
|
|
|
|
2013-08-21 00:42:26 +04:00
|
|
|
class XULLinkAccessible : public XULLabelAccessible
|
2005-07-14 19:12:12 +04:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2012-06-11 03:44:50 +04:00
|
|
|
XULLinkAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2008-03-18 14:37:12 +03:00
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
// Accessible
|
2015-01-02 09:11:21 +03:00
|
|
|
virtual void Value(nsString& aValue) MOZ_OVERRIDE;
|
2014-09-16 21:30:23 +04:00
|
|
|
virtual a11y::role NativeRole() MOZ_OVERRIDE;
|
|
|
|
virtual uint64_t NativeLinkState() const MOZ_OVERRIDE;
|
2008-10-10 16:26:55 +04:00
|
|
|
|
2011-06-05 23:35:43 +04:00
|
|
|
// ActionAccessible
|
2014-09-16 21:30:23 +04:00
|
|
|
virtual uint8_t ActionCount() MOZ_OVERRIDE;
|
|
|
|
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
|
|
|
|
virtual bool DoAction(uint8_t aIndex) MOZ_OVERRIDE;
|
2011-06-05 23:35:43 +04:00
|
|
|
|
2010-09-01 07:26:13 +04:00
|
|
|
// HyperLinkAccessible
|
2015-01-02 09:11:21 +03:00
|
|
|
virtual bool IsLink() MOZ_OVERRIDE;
|
|
|
|
virtual uint32_t StartOffset() MOZ_OVERRIDE;
|
|
|
|
virtual uint32_t EndOffset() MOZ_OVERRIDE;
|
|
|
|
virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex) MOZ_OVERRIDE;
|
2010-09-01 07:26:13 +04:00
|
|
|
|
2005-07-14 19:12:12 +04:00
|
|
|
protected:
|
2014-07-09 01:23:18 +04:00
|
|
|
virtual ~XULLinkAccessible();
|
|
|
|
|
2012-10-14 08:18:39 +04:00
|
|
|
// Accessible
|
|
|
|
virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
|
|
|
|
|
2008-03-18 14:37:12 +03:00
|
|
|
enum { eAction_Jump = 0 };
|
|
|
|
|
2005-07-14 19:12:12 +04:00
|
|
|
};
|
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|