2001-09-25 04:48:50 +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-04-18 03:06:38 +04:00
|
|
|
|
2012-04-12 15:11:40 +04:00
|
|
|
#ifndef MOZILLA_A11Y_HTMLFormControlAccessible_H_
|
|
|
|
#define MOZILLA_A11Y_HTMLFormControlAccessible_H_
|
2001-04-18 03:06:38 +04:00
|
|
|
|
2012-04-12 15:11:40 +04:00
|
|
|
#include "FormControlAccessible.h"
|
2012-05-31 12:04:41 +04:00
|
|
|
#include "HyperTextAccessibleWrap.h"
|
2001-04-18 03:06:38 +04:00
|
|
|
|
2012-04-12 15:11:40 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
2011-05-12 06:55:12 +04:00
|
|
|
/**
|
|
|
|
* Accessible for HTML progress element.
|
|
|
|
*/
|
|
|
|
typedef ProgressMeterAccessible<1> HTMLProgressMeterAccessible;
|
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
/**
|
|
|
|
* Accessible for HTML input@type="checkbox".
|
|
|
|
*/
|
2012-06-04 16:32:29 +04:00
|
|
|
class HTMLCheckboxAccessible : public LeafAccessible
|
2001-04-18 03:06:38 +04:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2006-10-02 23:33:49 +04:00
|
|
|
enum { eAction_Click = 0 };
|
|
|
|
|
2013-08-02 20:42:36 +04:00
|
|
|
HTMLCheckboxAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
|
|
|
LeafAccessible(aContent, aDoc)
|
|
|
|
{
|
|
|
|
// Ignore "CheckboxStateChange" DOM event in lieu of document observer
|
|
|
|
// state change notification.
|
|
|
|
mStateFlags |= eIgnoreDOMUIEvent;
|
|
|
|
}
|
2008-11-04 06:37:46 +03:00
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
// Accessible
|
2014-09-16 21:30:23 +04:00
|
|
|
virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
|
2015-01-02 09:11:21 +03:00
|
|
|
virtual uint64_t NativeState() MOZ_OVERRIDE;
|
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-09-29 07:13:08 +04:00
|
|
|
|
|
|
|
// Widgets
|
2015-01-02 09:11:21 +03:00
|
|
|
virtual bool IsWidget() const MOZ_OVERRIDE;
|
2001-04-18 03:06:38 +04:00
|
|
|
};
|
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Accessible for HTML input@type="radio" element.
|
|
|
|
*/
|
2012-04-12 15:11:40 +04:00
|
|
|
class HTMLRadioButtonAccessible : public RadioButtonAccessible
|
2001-04-18 03:06:38 +04:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2013-08-02 20:42:36 +04:00
|
|
|
HTMLRadioButtonAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
|
|
|
RadioButtonAccessible(aContent, aDoc)
|
|
|
|
{
|
|
|
|
// Ignore "RadioStateChange" DOM event in lieu of document observer
|
|
|
|
// state change notification.
|
|
|
|
mStateFlags |= eIgnoreDOMUIEvent;
|
|
|
|
}
|
2007-03-27 16:17:11 +04:00
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
// Accessible
|
2014-09-16 21:30:23 +04:00
|
|
|
virtual uint64_t NativeState() MOZ_OVERRIDE;
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual void GetPositionAndSizeInternal(int32_t *aPosInSet,
|
2015-01-02 09:11:21 +03:00
|
|
|
int32_t *aSetSize) MOZ_OVERRIDE;
|
2001-04-18 03:06:38 +04:00
|
|
|
};
|
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Accessible for HTML input@type="button", @type="submit", @type="image"
|
2012-02-22 15:33:37 +04:00
|
|
|
* and HTML button elements.
|
2010-06-11 12:23:18 +04:00
|
|
|
*/
|
2012-05-31 12:04:41 +04:00
|
|
|
class HTMLButtonAccessible : public HyperTextAccessibleWrap
|
2001-04-18 03:06:38 +04:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2006-10-02 23:33:49 +04:00
|
|
|
enum { eAction_Click = 0 };
|
|
|
|
|
2012-05-27 13:01:40 +04:00
|
|
|
HTMLButtonAccessible(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 mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
|
|
|
|
virtual uint64_t State() MOZ_OVERRIDE;
|
|
|
|
virtual uint64_t NativeState() MOZ_OVERRIDE;
|
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-09-29 07:13:08 +04:00
|
|
|
|
|
|
|
// Widgets
|
2015-01-02 09:11:21 +03:00
|
|
|
virtual bool IsWidget() const MOZ_OVERRIDE;
|
2012-10-14 08:18:39 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// Accessible
|
|
|
|
virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
|
2001-05-12 01:11:38 +04:00
|
|
|
};
|
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
|
|
|
|
/**
|
2013-05-23 07:57:04 +04:00
|
|
|
* Accessible for HTML input@type="text", input@type="password", textarea and
|
|
|
|
* other HTML text controls.
|
2010-06-11 12:23:18 +04:00
|
|
|
*/
|
2014-08-05 21:33:55 +04:00
|
|
|
class HTMLTextFieldAccessible MOZ_FINAL : public HyperTextAccessibleWrap
|
2001-05-12 01:11:38 +04:00
|
|
|
{
|
2003-04-15 12:45:55 +04:00
|
|
|
|
2001-05-12 01:11:38 +04:00
|
|
|
public:
|
2006-07-31 08:31:13 +04:00
|
|
|
enum { eAction_Click = 0 };
|
|
|
|
|
2012-05-27 13:01:40 +04:00
|
|
|
HTMLTextFieldAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2003-03-25 12:12:39 +03:00
|
|
|
|
2007-11-09 22:27:07 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2012-05-31 12:04:41 +04:00
|
|
|
// HyperTextAccessible
|
2015-01-02 09:11:21 +03:00
|
|
|
virtual already_AddRefed<nsIEditor> GetEditor() const MOZ_OVERRIDE;
|
2008-10-14 12:27:02 +04: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;
|
|
|
|
virtual void ApplyARIAState(uint64_t* aState) const MOZ_OVERRIDE;
|
2014-09-16 21:30:23 +04:00
|
|
|
virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
|
|
|
|
virtual uint64_t NativeState() MOZ_OVERRIDE;
|
2013-10-25 07:21:24 +04:00
|
|
|
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
|
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-09-28 05:46:11 +04:00
|
|
|
|
|
|
|
// Widgets
|
2015-01-02 09:11:21 +03:00
|
|
|
virtual bool IsWidget() const MOZ_OVERRIDE;
|
|
|
|
virtual Accessible* ContainerWidget() const MOZ_OVERRIDE;
|
2012-10-14 08:18:39 +04:00
|
|
|
|
|
|
|
protected:
|
2014-07-09 01:23:18 +04:00
|
|
|
virtual ~HTMLTextFieldAccessible() {}
|
|
|
|
|
2012-10-14 08:18:39 +04:00
|
|
|
// Accessible
|
|
|
|
virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
|
2013-12-08 01:37:04 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a XUL widget element this input is part of.
|
|
|
|
*/
|
|
|
|
nsIContent* XULWidgetElm() const { return mContent->GetBindingParent(); }
|
2001-04-18 03:06:38 +04:00
|
|
|
};
|
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
|
2011-11-30 16:36:20 +04:00
|
|
|
/**
|
|
|
|
* Accessible for input@type="file" element.
|
|
|
|
*/
|
2012-05-31 12:04:41 +04:00
|
|
|
class HTMLFileInputAccessible : public HyperTextAccessibleWrap
|
2011-11-30 16:36:20 +04:00
|
|
|
{
|
|
|
|
public:
|
2012-05-27 13:01:40 +04:00
|
|
|
HTMLFileInputAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2011-11-30 16:36:20 +04:00
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
// Accessible
|
2014-09-16 21:30:23 +04:00
|
|
|
virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
|
2015-01-02 09:11:21 +03:00
|
|
|
virtual nsresult HandleAccEvent(AccEvent* aAccEvent) MOZ_OVERRIDE;
|
2011-11-30 16:36:20 +04:00
|
|
|
};
|
|
|
|
|
2013-04-28 04:54:54 +04:00
|
|
|
|
2013-12-11 07:19:26 +04:00
|
|
|
/**
|
|
|
|
* Used for HTML input@type="number".
|
|
|
|
*/
|
|
|
|
class HTMLSpinnerAccessible : public AccessibleWrap
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
HTMLSpinnerAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
|
|
|
AccessibleWrap(aContent, aDoc)
|
|
|
|
{
|
|
|
|
mStateFlags |= eHasNumericValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Accessible
|
|
|
|
virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
|
|
|
|
virtual void Value(nsString& aValue) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual double MaxValue() const MOZ_OVERRIDE;
|
|
|
|
virtual double MinValue() const MOZ_OVERRIDE;
|
|
|
|
virtual double CurValue() const MOZ_OVERRIDE;
|
|
|
|
virtual double Step() const MOZ_OVERRIDE;
|
|
|
|
virtual bool SetCurValue(double aValue) MOZ_OVERRIDE;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-04-28 04:54:54 +04:00
|
|
|
/**
|
|
|
|
* Used for input@type="range" element.
|
|
|
|
*/
|
|
|
|
class HTMLRangeAccessible : public LeafAccessible
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
HTMLRangeAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
|
|
|
LeafAccessible(aContent, aDoc)
|
|
|
|
{
|
|
|
|
mStateFlags |= eHasNumericValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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 mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
|
2013-04-28 04:54:54 +04:00
|
|
|
|
2013-11-20 01:01:15 +04:00
|
|
|
// Value
|
|
|
|
virtual double MaxValue() const MOZ_OVERRIDE;
|
|
|
|
virtual double MinValue() const MOZ_OVERRIDE;
|
|
|
|
virtual double CurValue() const MOZ_OVERRIDE;
|
|
|
|
virtual double Step() const MOZ_OVERRIDE;
|
|
|
|
virtual bool SetCurValue(double aValue) MOZ_OVERRIDE;
|
|
|
|
|
2013-04-28 04:54:54 +04:00
|
|
|
// Widgets
|
2015-01-02 09:11:21 +03:00
|
|
|
virtual bool IsWidget() const MOZ_OVERRIDE;
|
2013-04-28 04:54:54 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
/**
|
|
|
|
* Accessible for HTML fieldset element.
|
|
|
|
*/
|
2012-05-31 12:04:41 +04:00
|
|
|
class HTMLGroupboxAccessible : public HyperTextAccessibleWrap
|
2002-02-16 04:34:42 +03:00
|
|
|
{
|
|
|
|
public:
|
2012-05-27 13:01:40 +04:00
|
|
|
HTMLGroupboxAccessible(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 mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
|
2013-10-19 22:19:50 +04:00
|
|
|
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
|
2008-10-10 16:26:55 +04:00
|
|
|
|
2007-07-01 00:06:13 +04:00
|
|
|
protected:
|
2012-10-14 08:18:39 +04:00
|
|
|
// Accessible
|
|
|
|
virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
// HTMLGroupboxAccessible
|
2014-09-16 21:30:23 +04:00
|
|
|
nsIContent* GetLegend() const;
|
2007-07-01 00:06:13 +04:00
|
|
|
};
|
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Accessible for HTML legend element.
|
|
|
|
*/
|
2012-05-31 12:04:41 +04:00
|
|
|
class HTMLLegendAccessible : public HyperTextAccessibleWrap
|
2007-07-01 00:06:13 +04:00
|
|
|
{
|
|
|
|
public:
|
2012-05-27 13:01:40 +04:00
|
|
|
HTMLLegendAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2009-02-10 13:03:30 +03:00
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
// Accessible
|
2014-09-16 21:30:23 +04:00
|
|
|
virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
|
2013-10-19 22:19:50 +04:00
|
|
|
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
|
2002-02-16 04:34:42 +03:00
|
|
|
};
|
|
|
|
|
2011-12-05 10:04:06 +04:00
|
|
|
/**
|
|
|
|
* Accessible for HTML5 figure element.
|
|
|
|
*/
|
2012-05-31 12:04:41 +04:00
|
|
|
class HTMLFigureAccessible : public HyperTextAccessibleWrap
|
2011-12-05 10:04:06 +04:00
|
|
|
{
|
|
|
|
public:
|
2012-05-27 13:01:40 +04:00
|
|
|
HTMLFigureAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2011-12-05 10:04:06 +04:00
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
// Accessible
|
2012-10-19 11:15:23 +04:00
|
|
|
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
|
2014-09-16 21:30:23 +04:00
|
|
|
virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
|
2013-10-19 22:19:50 +04:00
|
|
|
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
|
2011-12-05 10:04:06 +04:00
|
|
|
|
|
|
|
protected:
|
2012-10-14 08:18:39 +04:00
|
|
|
// Accessible
|
|
|
|
virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
// HTMLLegendAccessible
|
2011-12-05 10:04:06 +04:00
|
|
|
nsIContent* Caption() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Accessible for HTML5 figcaption element.
|
|
|
|
*/
|
2012-05-31 12:04:41 +04:00
|
|
|
class HTMLFigcaptionAccessible : public HyperTextAccessibleWrap
|
2011-12-05 10:04:06 +04:00
|
|
|
{
|
|
|
|
public:
|
2012-05-27 13:01:40 +04:00
|
|
|
HTMLFigcaptionAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2011-12-05 10:04:06 +04:00
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
// Accessible
|
2014-09-16 21:30:23 +04:00
|
|
|
virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
|
2013-10-19 22:19:50 +04:00
|
|
|
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
|
2011-12-05 10:04:06 +04:00
|
|
|
};
|
|
|
|
|
2012-04-12 15:11:40 +04:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2011-12-05 10:04:06 +04:00
|
|
|
#endif
|