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