From e7d291b1a29a659a8d3322212feb8f25e25329b5 Mon Sep 17 00:00:00 2001 From: Alexander Surkov Date: Tue, 28 Aug 2012 22:13:59 +0900 Subject: [PATCH] Bug 761853 - ARIA grid with rowgroup breaks table row/col counting and indices, r=tbsaunde --HG-- rename : accessible/src/base/filters.cpp => accessible/src/base/AccFilters.cpp rename : accessible/src/base/filters.h => accessible/src/base/AccFilters.h --- accessible/src/base/AccCollector.cpp | 9 ++- accessible/src/base/AccCollector.h | 17 +++-- accessible/src/base/AccFilters.cpp | 60 +++++++++++++++++ accessible/src/base/AccFilters.h | 55 ++++++++++++++++ accessible/src/base/AccIterator.cpp | 15 ++--- accessible/src/base/AccIterator.h | 39 ++++------- accessible/src/base/Makefile.in | 2 +- accessible/src/base/Relation.h | 18 ++--- accessible/src/base/filters.cpp | 44 ------------- accessible/src/base/filters.h | 27 -------- accessible/src/base/nsAccessNode.h | 2 +- .../src/generic/ARIAGridAccessible-inl.h | 53 +++++++++++++++ accessible/src/generic/ARIAGridAccessible.cpp | 65 +++---------------- accessible/src/generic/ARIAGridAccessible.h | 22 +++++++ accessible/src/generic/Accessible.cpp | 16 ++--- accessible/src/generic/Accessible.h | 6 +- accessible/src/generic/DocAccessible.h | 10 ++- .../table/test_indexes_ariagrid.html | 36 ++++++++++ 18 files changed, 306 insertions(+), 190 deletions(-) create mode 100644 accessible/src/base/AccFilters.cpp create mode 100644 accessible/src/base/AccFilters.h delete mode 100644 accessible/src/base/filters.cpp delete mode 100644 accessible/src/base/filters.h create mode 100644 accessible/src/generic/ARIAGridAccessible-inl.h diff --git a/accessible/src/base/AccCollector.cpp b/accessible/src/base/AccCollector.cpp index 63d05efcdf3..da97d918345 100644 --- a/accessible/src/base/AccCollector.cpp +++ b/accessible/src/base/AccCollector.cpp @@ -6,6 +6,8 @@ #include "Accessible.h" +using namespace mozilla::a11y; + //////////////////////////////////////////////////////////////////////////////// // nsAccCollector //////////////////////////////////////////////////////////////////////////////// @@ -56,7 +58,7 @@ AccCollector::EnsureNGetObject(uint32_t aIndex) uint32_t childCount = mRoot->ChildCount(); while (mRootChildIdx < childCount) { Accessible* child = mRoot->GetChildAt(mRootChildIdx++); - if (!mFilterFunc(child)) + if (!(mFilterFunc(child) & filters::eMatch)) continue; AppendObject(child); @@ -73,7 +75,7 @@ AccCollector::EnsureNGetIndex(Accessible* aAccessible) uint32_t childCount = mRoot->ChildCount(); while (mRootChildIdx < childCount) { Accessible* child = mRoot->GetChildAt(mRootChildIdx++); - if (!mFilterFunc(child)) + if (!(mFilterFunc(child) & filters::eMatch)) continue; AppendObject(child); @@ -103,7 +105,8 @@ EmbeddedObjCollector::GetIndexAt(Accessible* aAccessible) if (aAccessible->mIndexOfEmbeddedChild != -1) return aAccessible->mIndexOfEmbeddedChild; - return mFilterFunc(aAccessible) ? EnsureNGetIndex(aAccessible) : -1; + return mFilterFunc(aAccessible) & filters::eMatch ? + EnsureNGetIndex(aAccessible) : -1; } void diff --git a/accessible/src/base/AccCollector.h b/accessible/src/base/AccCollector.h index 860a94dcdce..fede67d3159 100644 --- a/accessible/src/base/AccCollector.h +++ b/accessible/src/base/AccCollector.h @@ -2,14 +2,18 @@ * 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/. */ -#ifndef AccCollector_h_ -#define AccCollector_h_ +#ifndef mozilla_a11y_AccCollector_h__ +#define mozilla_a11y_AccCollector_h__ -#include "filters.h" +#include "AccFilters.h" -#include "nscore.h" #include "nsTArray.h" +class Accessible; + +namespace mozilla { +namespace a11y { + /** * Collect accessible children complying with filter function. Provides quick * access to accessible by index. @@ -82,7 +86,10 @@ protected: virtual void AppendObject(Accessible* aAccessible); - friend class Accessible; + friend class ::Accessible; }; +} // namespace a11y +} // namespace mozilla + #endif diff --git a/accessible/src/base/AccFilters.cpp b/accessible/src/base/AccFilters.cpp new file mode 100644 index 00000000000..22fb1f98b1d --- /dev/null +++ b/accessible/src/base/AccFilters.cpp @@ -0,0 +1,60 @@ +/* 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/. */ + +#include "AccFilters.h" + +#include "Accessible-inl.h" +#include "nsAccUtils.h" +#include "Role.h" +#include "States.h" + +using namespace mozilla::a11y; +using namespace mozilla::a11y::filters; + +uint32_t +filters::GetSelected(Accessible* aAccessible) +{ + if (aAccessible->State() & states::SELECTED) + return eMatch | eSkipSubtree; + + return eSkip; +} + +uint32_t +filters::GetSelectable(Accessible* aAccessible) +{ + if (aAccessible->InteractiveState() & states::SELECTABLE) + return eMatch | eSkipSubtree; + + return eSkip; +} + +uint32_t +filters::GetRow(Accessible* aAccessible) +{ + a11y::role role = aAccessible->Role(); + if (role == roles::ROW) + return eMatch | eSkipSubtree; + + // Look for rows inside rowgroup. + if (role == roles::SECTION) + return eSkip; + + return eSkipSubtree; +} + +uint32_t +filters::GetCell(Accessible* aAccessible) +{ + a11y::role role = aAccessible->Role(); + return role == roles::GRID_CELL || role == roles::ROWHEADER || + role == roles::COLUMNHEADER ? eMatch : eSkipSubtree; +} + +uint32_t +filters::GetEmbeddedObject(Accessible* aAccessible) +{ + return nsAccUtils::IsEmbeddedObject(aAccessible) ? + eMatch | eSkipSubtree : eSkipSubtree; +} diff --git a/accessible/src/base/AccFilters.h b/accessible/src/base/AccFilters.h new file mode 100644 index 00000000000..2ab4f900ccc --- /dev/null +++ b/accessible/src/base/AccFilters.h @@ -0,0 +1,55 @@ +/* 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/. */ + +#ifndef mozilla_a11y_Filters_h__ +#define mozilla_a11y_Filters_h__ + +#include "mozilla/StandardInteger.h" + +class Accessible; + +/** + * Predefined filters used for nsAccIterator and nsAccCollector. + */ +namespace mozilla { +namespace a11y { +namespace filters { + +enum EResult { + eSkip = 0, + eMatch = 1, + eSkipSubtree = 2 +}; + +/** + * Return true if the traversed accessible complies with filter. + */ +typedef uint32_t (*FilterFuncPtr) (Accessible*); + +/** + * Matches selected/selectable accessibles in subtree. + */ +uint32_t GetSelected(Accessible* aAccessible); +uint32_t GetSelectable(Accessible* aAccessible); + +/** + * Matches row accessibles in subtree. + */ +uint32_t GetRow(Accessible* aAccessible); + +/** + * Matches cell accessibles in children. + */ +uint32_t GetCell(Accessible* aAccessible); + +/** + * Matches embedded objects in children. + */ +uint32_t GetEmbeddedObject(Accessible* aAccessible); + +} // namespace filters +} // namespace a11y +} // namespace mozilla + +#endif diff --git a/accessible/src/base/AccIterator.cpp b/accessible/src/base/AccIterator.cpp index ace63b038a8..97daed43145 100644 --- a/accessible/src/base/AccIterator.cpp +++ b/accessible/src/base/AccIterator.cpp @@ -18,9 +18,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// AccIterator::AccIterator(Accessible* aAccessible, - filters::FilterFuncPtr aFilterFunc, - IterationType aIterationType) : - mFilterFunc(aFilterFunc), mIsDeep(aIterationType != eFlatNav) + filters::FilterFuncPtr aFilterFunc) : + mFilterFunc(aFilterFunc) { mState = new IteratorState(aAccessible); } @@ -40,19 +39,19 @@ AccIterator::Next() while (mState) { Accessible* child = mState->mParent->GetChildAt(mState->mIndex++); if (!child) { - IteratorState *tmp = mState; + IteratorState* tmp = mState; mState = mState->mParentState; delete tmp; continue; } - bool isComplying = mFilterFunc(child); - if (isComplying) + uint32_t result = mFilterFunc(child); + if (result & filters::eMatch) return child; - if (mIsDeep) { - IteratorState *childState = new IteratorState(child, mState); + if (!(result & filters::eSkipSubtree)) { + IteratorState* childState = new IteratorState(child, mState); mState = childState; } } diff --git a/accessible/src/base/AccIterator.h b/accessible/src/base/AccIterator.h index 278a8e00290..e613f9a0ebe 100644 --- a/accessible/src/base/AccIterator.h +++ b/accessible/src/base/AccIterator.h @@ -4,13 +4,15 @@ * 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/. */ -#ifndef nsAccIterator_h_ -#define nsAccIterator_h_ +#ifndef mozilla_a11y_AccIterator_h__ +#define mozilla_a11y_AccIterator_h__ -#include "nsAccessibilityService.h" -#include "filters.h" -#include "nscore.h" #include "DocAccessible.h" +#include "AccFilters.h" +#include "nsAccessibilityService.h" + +namespace mozilla { +namespace a11y { /** * AccIterable is a basic interface for iterators over accessibles. @@ -33,24 +35,7 @@ private: class AccIterator : public AccIterable { public: - /** - * Used to define iteration type. - */ - enum IterationType { - /** - * Navigation happens through direct children. - */ - eFlatNav, - - /** - * Navigation through subtree excluding iterator root; if the accessible - * complies with filter, iterator ignores its children. - */ - eTreeNav - }; - - AccIterator(Accessible* aRoot, filters::FilterFuncPtr aFilterFunc, - IterationType aIterationType = eFlatNav); + AccIterator(Accessible* aRoot, filters::FilterFuncPtr aFilterFunc); virtual ~AccIterator(); /** @@ -70,12 +55,11 @@ private: Accessible* mParent; int32_t mIndex; - IteratorState *mParentState; + IteratorState* mParentState; }; filters::FilterFuncPtr mFilterFunc; - bool mIsDeep; - IteratorState *mState; + IteratorState* mState; }; @@ -282,4 +266,7 @@ private: nsRefPtr mAcc; }; +} // namespace a11y +} // namespace mozilla + #endif diff --git a/accessible/src/base/Makefile.in b/accessible/src/base/Makefile.in index f74d2b0029b..a0ce1dd2d5a 100644 --- a/accessible/src/base/Makefile.in +++ b/accessible/src/base/Makefile.in @@ -19,8 +19,8 @@ CPPSRCS = \ AccEvent.cpp \ AccGroupInfo.cpp \ AccIterator.cpp \ + AccFilters.cpp \ ARIAStateMap.cpp \ - filters.cpp \ FocusManager.cpp \ NotificationController.cpp \ nsAccDocManager.cpp \ diff --git a/accessible/src/base/Relation.h b/accessible/src/base/Relation.h index bea7d85e1ae..fc191518008 100644 --- a/accessible/src/base/Relation.h +++ b/accessible/src/base/Relation.h @@ -19,11 +19,12 @@ namespace a11y { */ struct RelationCopyHelper { - RelationCopyHelper(AccIterable* aFirstIter, AccIterable* aLastIter) : + RelationCopyHelper(mozilla::a11y::AccIterable* aFirstIter, + mozilla::a11y::AccIterable* aLastIter) : mFirstIter(aFirstIter), mLastIter(aLastIter) { } - AccIterable* mFirstIter; - AccIterable* mLastIter; + mozilla::a11y::AccIterable* mFirstIter; + mozilla::a11y::AccIterable* mLastIter; }; /** @@ -38,7 +39,8 @@ public: Relation(const RelationCopyHelper aRelation) : mFirstIter(aRelation.mFirstIter), mLastIter(aRelation.mLastIter) { } - Relation(AccIterable* aIter) : mFirstIter(aIter), mLastIter(aIter) { } + Relation(mozilla::a11y::AccIterable* aIter) : + mFirstIter(aIter), mLastIter(aIter) { } Relation(Accessible* aAcc) : mFirstIter(nullptr), mLastIter(nullptr) @@ -67,7 +69,7 @@ public: return RelationCopyHelper(mFirstIter.forget(), mLastIter); } - inline void AppendIter(AccIterable* aIter) + inline void AppendIter(mozilla::a11y::AccIterable* aIter) { if (mLastIter) mLastIter->mNextIter = aIter; @@ -83,7 +85,7 @@ public: inline void AppendTarget(Accessible* aAcc) { if (aAcc) - AppendIter(new SingleAccIterator(aAcc)); + AppendIter(new mozilla::a11y::SingleAccIterator(aAcc)); } /** @@ -116,8 +118,8 @@ public: private: Relation& operator = (const Relation&); - nsAutoPtr mFirstIter; - AccIterable* mLastIter; + nsAutoPtr mFirstIter; + mozilla::a11y::AccIterable* mLastIter; }; } // namespace a11y diff --git a/accessible/src/base/filters.cpp b/accessible/src/base/filters.cpp deleted file mode 100644 index 57adc76a271..00000000000 --- a/accessible/src/base/filters.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* 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/. */ - -#include "filters.h" - -#include "Accessible-inl.h" -#include "nsAccUtils.h" -#include "Role.h" -#include "States.h" - -using namespace mozilla::a11y; - -bool -filters::GetSelected(Accessible* aAccessible) -{ - return aAccessible->State() & states::SELECTED; -} - -bool -filters::GetSelectable(Accessible* aAccessible) -{ - return aAccessible->InteractiveState() & states::SELECTABLE; -} - -bool -filters::GetRow(Accessible* aAccessible) -{ - return aAccessible->Role() == roles::ROW; -} - -bool -filters::GetCell(Accessible* aAccessible) -{ - roles::Role role = aAccessible->Role(); - return role == roles::GRID_CELL || role == roles::ROWHEADER || - role == roles::COLUMNHEADER; -} - -bool -filters::GetEmbeddedObject(Accessible* aAccessible) -{ - return nsAccUtils::IsEmbeddedObject(aAccessible); -} diff --git a/accessible/src/base/filters.h b/accessible/src/base/filters.h deleted file mode 100644 index 4fd3a9c1bcc..00000000000 --- a/accessible/src/base/filters.h +++ /dev/null @@ -1,27 +0,0 @@ -/* 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/. */ - -#ifndef a11yFilters_h_ -#define a11yFilters_h_ - -class Accessible; - -/** - * Predefined filters used for nsAccIterator and nsAccCollector. - */ -namespace filters { - - /** - * Return true if the traversed accessible complies with filter. - */ - typedef bool (*FilterFuncPtr) (Accessible*); - - bool GetSelected(Accessible* aAccessible); - bool GetSelectable(Accessible* aAccessible); - bool GetRow(Accessible* aAccessible); - bool GetCell(Accessible* aAccessible); - bool GetEmbeddedObject(Accessible* aAccessible); -} - -#endif diff --git a/accessible/src/base/nsAccessNode.h b/accessible/src/base/nsAccessNode.h index 0447ad817a3..437401ba5e8 100644 --- a/accessible/src/base/nsAccessNode.h +++ b/accessible/src/base/nsAccessNode.h @@ -103,7 +103,7 @@ public: * these accessibles share the same DOM node. The primary accessible "owns" * that DOM node in terms it gets stored in the accessible to node map. */ - virtual bool IsPrimaryForNode() const; + virtual bool IsPrimaryForNode() const;//hello /** * Interface methods on nsIAccessible shared with ISimpleDOM. diff --git a/accessible/src/generic/ARIAGridAccessible-inl.h b/accessible/src/generic/ARIAGridAccessible-inl.h new file mode 100644 index 00000000000..66f6b966a82 --- /dev/null +++ b/accessible/src/generic/ARIAGridAccessible-inl.h @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* 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/. */ + +#ifndef mozilla_a11y_ARIAGridAccessible_inl_h__ +#define mozilla_a11y_ARIAGridAccessible_inl_h__ + +#include "ARIAGridAccessible.h" + +#include "AccIterator.h" + +inline Accessible* +mozilla::a11y::ARIAGridCellAccessible::TableFor(Accessible* aRow) const +{ + if (aRow) { + Accessible* table = aRow->Parent(); + if (table) { + roles::Role tableRole = table->Role(); + if (tableRole == roles::SECTION) { // if there's a rowgroup. + table = table->Parent(); + if (table) + tableRole = table->Role(); + } + + return tableRole == roles::TABLE || tableRole == roles::TREE_TABLE ? + table : nullptr; + } + } + + return nullptr; +} + +inline int32_t +mozilla::a11y::ARIAGridCellAccessible::RowIndexFor(Accessible* aRow) const +{ + Accessible* table = TableFor(aRow); + if (table) { + int32_t rowIdx = 0; + Accessible* row = nullptr; + AccIterator rowIter(table, filters::GetRow); + while ((row = rowIter.Next()) && row != aRow) + rowIdx++; + + if (row) + return rowIdx; + } + + return -1; +} + +#endif diff --git a/accessible/src/generic/ARIAGridAccessible.cpp b/accessible/src/generic/ARIAGridAccessible.cpp index 421307abe95..6d378fa4231 100644 --- a/accessible/src/generic/ARIAGridAccessible.cpp +++ b/accessible/src/generic/ARIAGridAccessible.cpp @@ -3,7 +3,7 @@ * 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/. */ -#include "ARIAGridAccessible.h" +#include "ARIAGridAccessible-inl.h" #include "Accessible-inl.h" #include "AccIterator.h" @@ -551,19 +551,10 @@ ARIAGridCellAccessible::GetTable(nsIAccessibleTable** aTable) NS_ENSURE_ARG_POINTER(aTable); *aTable = nullptr; - Accessible* thisRow = Parent(); - if (!thisRow || thisRow->Role() != roles::ROW) - return NS_OK; + Accessible* table = TableFor(Row()); + if (table) + CallQueryInterface(table, aTable); - Accessible* table = thisRow->Parent(); - if (!table) - return NS_OK; - - roles::Role tableRole = table->Role(); - if (tableRole != roles::TABLE && tableRole != roles::TREE_TABLE) - return NS_OK; - - CallQueryInterface(table, aTable); return NS_OK; } @@ -603,23 +594,7 @@ ARIAGridCellAccessible::GetRowIndex(int32_t* aRowIndex) if (IsDefunct()) return NS_ERROR_FAILURE; - Accessible* row = Parent(); - if (!row) - return NS_OK; - - Accessible* table = row->Parent(); - if (!table) - return NS_OK; - - *aRowIndex = 0; - - int32_t indexInTable = row->IndexInParent(); - for (int32_t idx = 0; idx < indexInTable; idx++) { - row = table->GetChildAt(idx); - if (row->Role() == roles::ROW) - (*aRowIndex)++; - } - + *aRowIndex = RowIndexFor(Row()); return NS_OK; } @@ -738,14 +713,13 @@ ARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttribut { if (IsDefunct()) return NS_ERROR_FAILURE; - + nsresult rv = HyperTextAccessibleWrap::GetAttributesInternal(aAttributes); NS_ENSURE_SUCCESS(rv, rv); // Expose "table-cell-index" attribute. - - Accessible* thisRow = Parent(); - if (!thisRow || thisRow->Role() != roles::ROW) + Accessible* thisRow = Row(); + if (!thisRow) return NS_OK; int32_t colIdx = 0, colCount = 0; @@ -761,29 +735,10 @@ ARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttribut colCount++; } - Accessible* table = thisRow->Parent(); - if (!table) - return NS_OK; - - roles::Role tableRole = table->Role(); - if (tableRole != roles::TABLE && tableRole != roles::TREE_TABLE) - return NS_OK; - - int32_t rowIdx = 0; - childCount = table->ChildCount(); - for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) { - Accessible* child = table->GetChildAt(childIdx); - if (child == thisRow) - break; - - if (child->Role() == roles::ROW) - rowIdx++; - } - - int32_t idx = rowIdx * colCount + colIdx; + int32_t rowIdx = RowIndexFor(thisRow); nsAutoString stringIdx; - stringIdx.AppendInt(idx); + stringIdx.AppendInt(rowIdx * colCount + colIdx); nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::tableCellIndex, stringIdx); diff --git a/accessible/src/generic/ARIAGridAccessible.h b/accessible/src/generic/ARIAGridAccessible.h index 501cde497ee..3dfdcf1cfff 100644 --- a/accessible/src/generic/ARIAGridAccessible.h +++ b/accessible/src/generic/ARIAGridAccessible.h @@ -60,6 +60,7 @@ public: virtual void UnselectRow(uint32_t aRowIdx); protected: + /** * Return true if the given row index is valid. */ @@ -114,6 +115,27 @@ public: virtual void Shutdown(); virtual void ApplyARIAState(uint64_t* aState) const; virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes); + +protected: + + /** + * Return a containing row. + */ + Accessible* Row() const + { + Accessible* row = Parent(); + return row && row->Role() == roles::ROW ? row : nullptr; + } + + /** + * Return a table for the given row. + */ + Accessible* TableFor(Accessible* aRow) const; + + /** + * Return index of the given row. + */ + int32_t RowIndexFor(Accessible* aRow) const; }; } // namespace a11y diff --git a/accessible/src/generic/Accessible.cpp b/accessible/src/generic/Accessible.cpp index e35eb999b79..16dc3859245 100644 --- a/accessible/src/generic/Accessible.cpp +++ b/accessible/src/generic/Accessible.cpp @@ -2728,7 +2728,7 @@ Accessible::SelectedItems() if (!selectedItems) return nullptr; - AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav); + AccIterator iter(this, filters::GetSelected); nsIAccessible* selected = nullptr; while ((selected = iter.Next())) selectedItems->AppendElement(selected, false); @@ -2742,7 +2742,7 @@ uint32_t Accessible::SelectedItemCount() { uint32_t count = 0; - AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav); + AccIterator iter(this, filters::GetSelected); Accessible* selected = nullptr; while ((selected = iter.Next())) ++count; @@ -2753,7 +2753,7 @@ Accessible::SelectedItemCount() Accessible* Accessible::GetSelectedItem(uint32_t aIndex) { - AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav); + AccIterator iter(this, filters::GetSelected); Accessible* selected = nullptr; uint32_t index = 0; @@ -2767,7 +2767,7 @@ bool Accessible::IsItemSelected(uint32_t aIndex) { uint32_t index = 0; - AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav); + AccIterator iter(this, filters::GetSelectable); Accessible* selected = nullptr; while ((selected = iter.Next()) && index < aIndex) index++; @@ -2780,7 +2780,7 @@ bool Accessible::AddItemToSelection(uint32_t aIndex) { uint32_t index = 0; - AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav); + AccIterator iter(this, filters::GetSelectable); Accessible* selected = nullptr; while ((selected = iter.Next()) && index < aIndex) index++; @@ -2795,7 +2795,7 @@ bool Accessible::RemoveItemFromSelection(uint32_t aIndex) { uint32_t index = 0; - AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav); + AccIterator iter(this, filters::GetSelectable); Accessible* selected = nullptr; while ((selected = iter.Next()) && index < aIndex) index++; @@ -2812,7 +2812,7 @@ Accessible::SelectAll() bool success = false; Accessible* selectable = nullptr; - AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav); + AccIterator iter(this, filters::GetSelectable); while((selectable = iter.Next())) { success = true; selectable->SetSelected(true); @@ -2826,7 +2826,7 @@ Accessible::UnselectAll() bool success = false; Accessible* selected = nullptr; - AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav); + AccIterator iter(this, filters::GetSelected); while ((selected = iter.Next())) { success = true; selected->SetSelected(false); diff --git a/accessible/src/generic/Accessible.h b/accessible/src/generic/Accessible.h index a8b8ce21d59..cd1d138d4f9 100644 --- a/accessible/src/generic/Accessible.h +++ b/accessible/src/generic/Accessible.h @@ -23,7 +23,6 @@ class AccEvent; class AccGroupInfo; -class EmbeddedObjCollector; class KeyBinding; class Accessible; class HyperTextAccessible; @@ -32,6 +31,7 @@ struct nsRoleMapEntry; namespace mozilla { namespace a11y { +class EmbeddedObjCollector; class HTMLImageMapAccessible; class HTMLLIAccessible; class ImageAccessible; @@ -875,9 +875,9 @@ protected: uint32_t mFlags; friend class DocAccessible; - nsAutoPtr mEmbeddedObjCollector; + nsAutoPtr mEmbeddedObjCollector; int32_t mIndexOfEmbeddedChild; - friend class EmbeddedObjCollector; + friend class mozilla::a11y::EmbeddedObjCollector; nsAutoPtr mGroupInfo; friend class AccGroupInfo; diff --git a/accessible/src/generic/DocAccessible.h b/accessible/src/generic/DocAccessible.h index 38a918d2136..0c48572bbdd 100644 --- a/accessible/src/generic/DocAccessible.h +++ b/accessible/src/generic/DocAccessible.h @@ -33,6 +33,14 @@ class nsAccessiblePivot; const uint32_t kDefaultCacheSize = 256; +namespace mozilla { +namespace a11y { + +class RelatedAccIterator; + +} // namespace a11y +} // namespace mozilla + class DocAccessible : public HyperTextAccessibleWrap, public nsIAccessibleDocument, public nsIDocumentObserver, @@ -567,7 +575,7 @@ protected: typedef nsTArray > AttrRelProviderArray; nsClassHashtable mDependentIDsHash; - friend class RelatedAccIterator; + friend class mozilla::a11y::RelatedAccIterator; /** * Used for our caching algorithm. We store the list of nodes that should be diff --git a/accessible/tests/mochitest/table/test_indexes_ariagrid.html b/accessible/tests/mochitest/table/test_indexes_ariagrid.html index f8b4b50d9b9..62ef0ed9d55 100644 --- a/accessible/tests/mochitest/table/test_indexes_ariagrid.html +++ b/accessible/tests/mochitest/table/test_indexes_ariagrid.html @@ -28,6 +28,14 @@ ]; testTableIndexes("grid", idxes); + idxes = [ + [0, 1, 2], + [3, 4, 5], + [6, 7, 8], + [9, 10, 11] + ]; + testTableIndexes("grid-rowgroups", idxes); + ////////////////////////////////////////////////////////////////////////// // a bit crazy ARIA grid idxes = [ @@ -51,6 +59,9 @@ Mozilla Bug 513848 + Mozilla Bug 761853

@@ -80,6 +91,31 @@ +
+
+ grid-rowgroups-col1 + grid-rowgroups-col2 + grid-rowgroups-col3 +
+
+
+ grid-rowgroups-row1 + grid-rowgroups-cell1 + grid-rowgroups-cell2 +
+
+ grid-rowgroups-row2 + grid-rowgroups-cell3 + grid-rowgroups-cell4 +
+
+
+ grid-rowgroups-row3 + grid-rowgroups-cell5 + grid-rowgroups-cell6 +
+
+