2009-05-18 12:35:21 +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/. */
|
2009-05-18 12:35:21 +04:00
|
|
|
|
2012-04-09 14:18:03 +04:00
|
|
|
#ifndef MOZILLA_A11Y_ARIAGridAccessible_h_
|
|
|
|
#define MOZILLA_A11Y_ARIAGridAccessible_h_
|
2009-05-18 12:35:21 +04:00
|
|
|
|
2012-05-31 12:04:41 +04:00
|
|
|
#include "HyperTextAccessibleWrap.h"
|
2012-03-28 04:53:58 +04:00
|
|
|
#include "TableAccessible.h"
|
2012-07-24 19:58:25 +04:00
|
|
|
#include "TableCellAccessible.h"
|
2009-05-18 12:35:21 +04:00
|
|
|
|
2012-04-09 14:18:03 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
2009-05-18 12:35:21 +04:00
|
|
|
/**
|
|
|
|
* Accessible for ARIA grid and treegrid.
|
|
|
|
*/
|
2018-10-26 11:51:22 +03:00
|
|
|
class ARIAGridAccessible : public AccessibleWrap,
|
2012-04-09 14:18:03 +04:00
|
|
|
public TableAccessible
|
2009-05-18 12:35:21 +04:00
|
|
|
{
|
|
|
|
public:
|
2012-05-27 13:01:40 +04:00
|
|
|
ARIAGridAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2009-05-18 12:35:21 +04:00
|
|
|
|
2018-10-26 11:51:22 +03:00
|
|
|
NS_INLINE_DECL_REFCOUNTING_INHERITED(ARIAGridAccessible, AccessibleWrap)
|
2009-05-18 12:35:21 +04:00
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
// Accessible
|
2018-05-07 22:05:50 +03:00
|
|
|
virtual a11y::role NativeRole() const override;
|
2018-05-25 17:55:52 +03:00
|
|
|
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual TableAccessible* AsTable() override { return this; }
|
2009-05-18 12:35:21 +04:00
|
|
|
|
2012-04-20 01:32:11 +04:00
|
|
|
// TableAccessible
|
2018-05-05 18:55:29 +03:00
|
|
|
virtual uint32_t ColCount() const override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual uint32_t RowCount() override;
|
|
|
|
virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex) override;
|
|
|
|
virtual bool IsColSelected(uint32_t aColIdx) override;
|
|
|
|
virtual bool IsRowSelected(uint32_t aRowIdx) override;
|
|
|
|
virtual bool IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx) override;
|
|
|
|
virtual uint32_t SelectedCellCount() override;
|
|
|
|
virtual uint32_t SelectedColCount() override;
|
|
|
|
virtual uint32_t SelectedRowCount() override;
|
|
|
|
virtual void SelectedCells(nsTArray<Accessible*>* aCells) override;
|
|
|
|
virtual void SelectedCellIndices(nsTArray<uint32_t>* aCells) override;
|
|
|
|
virtual void SelectedColIndices(nsTArray<uint32_t>* aCols) override;
|
|
|
|
virtual void SelectedRowIndices(nsTArray<uint32_t>* aRows) override;
|
|
|
|
virtual void SelectCol(uint32_t aColIdx) override;
|
|
|
|
virtual void SelectRow(uint32_t aRowIdx) override;
|
|
|
|
virtual void UnselectCol(uint32_t aColIdx) override;
|
|
|
|
virtual void UnselectRow(uint32_t aRowIdx) override;
|
|
|
|
virtual Accessible* AsAccessible() override { return this; }
|
2012-04-20 01:32:11 +04:00
|
|
|
|
2009-05-18 12:35:21 +04:00
|
|
|
protected:
|
2014-07-09 01:23:18 +04:00
|
|
|
virtual ~ARIAGridAccessible() {}
|
2012-08-28 17:13:59 +04:00
|
|
|
|
2009-06-12 16:52:29 +04:00
|
|
|
/**
|
|
|
|
* Set aria-selected attribute value on DOM node of the given accessible.
|
|
|
|
*
|
|
|
|
* @param aAccessible [in] accessible
|
|
|
|
* @param aIsSelected [in] new value of aria-selected attribute
|
|
|
|
* @param aNotify [in, optional] specifies if DOM should be notified
|
|
|
|
* about attribute change (used internally).
|
|
|
|
*/
|
2012-05-29 05:18:45 +04:00
|
|
|
nsresult SetARIASelected(Accessible* aAccessible, bool aIsSelected,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aNotify = true);
|
2009-05-18 12:35:21 +04:00
|
|
|
};
|
|
|
|
|
2009-06-12 16:52:29 +04:00
|
|
|
|
2015-06-27 00:41:22 +03:00
|
|
|
/**
|
|
|
|
* Accessible for ARIA row.
|
|
|
|
*/
|
2018-10-26 11:51:22 +03:00
|
|
|
class ARIARowAccessible : public AccessibleWrap
|
2015-06-27 00:41:22 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
ARIARowAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
|
|
|
|
2018-10-26 11:51:22 +03:00
|
|
|
NS_INLINE_DECL_REFCOUNTING_INHERITED(ARIARowAccessible, AccessibleWrap)
|
2015-06-27 00:41:22 +03:00
|
|
|
|
|
|
|
// Accessible
|
2018-05-07 22:05:50 +03:00
|
|
|
virtual a11y::role NativeRole() const override;
|
2015-06-27 00:41:22 +03:00
|
|
|
virtual mozilla::a11y::GroupPos GroupPosition() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~ARIARowAccessible() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-05-18 12:35:21 +04:00
|
|
|
/**
|
|
|
|
* Accessible for ARIA gridcell and rowheader/columnheader.
|
|
|
|
*/
|
2012-05-31 12:04:41 +04:00
|
|
|
class ARIAGridCellAccessible : public HyperTextAccessibleWrap,
|
2014-10-22 04:49:28 +04:00
|
|
|
public TableCellAccessible
|
2009-05-18 12:35:21 +04:00
|
|
|
{
|
|
|
|
public:
|
2012-05-27 13:01:40 +04:00
|
|
|
ARIAGridCellAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2009-05-18 12:35:21 +04:00
|
|
|
|
2018-02-12 23:44:40 +03:00
|
|
|
NS_INLINE_DECL_REFCOUNTING_INHERITED(ARIAGridCellAccessible,
|
|
|
|
HyperTextAccessibleWrap)
|
2009-05-18 12:35:21 +04:00
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
// Accessible
|
2018-05-07 22:05:50 +03:00
|
|
|
virtual a11y::role NativeRole() const override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual TableCellAccessible* AsTableCell() override { return this; }
|
|
|
|
virtual void ApplyARIAState(uint64_t* aState) const override;
|
|
|
|
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
|
2015-06-27 00:41:22 +03:00
|
|
|
virtual mozilla::a11y::GroupPos GroupPosition() override;
|
2012-08-28 17:13:59 +04:00
|
|
|
|
|
|
|
protected:
|
2014-07-09 01:23:18 +04:00
|
|
|
virtual ~ARIAGridCellAccessible() {}
|
2012-08-28 17:13:59 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a containing row.
|
|
|
|
*/
|
|
|
|
Accessible* Row() const
|
|
|
|
{
|
|
|
|
Accessible* row = Parent();
|
2015-06-27 00:41:22 +03:00
|
|
|
return row && row->IsTableRow() ? row : nullptr;
|
2012-08-28 17:13:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return index of the given row.
|
|
|
|
*/
|
|
|
|
int32_t RowIndexFor(Accessible* aRow) const;
|
2012-08-09 10:24:31 +04:00
|
|
|
|
|
|
|
// TableCellAccessible
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual TableAccessible* Table() const override;
|
|
|
|
virtual uint32_t ColIdx() const override;
|
|
|
|
virtual uint32_t RowIdx() const override;
|
|
|
|
virtual bool Selected() override;
|
2009-05-18 12:35:21 +04:00
|
|
|
};
|
|
|
|
|
2012-04-09 14:18:03 +04:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2009-05-18 12:35:21 +04:00
|
|
|
#endif
|