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