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