ARIAGridAccessible-inl.h 923 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_a11y_ARIAGridAccessible_inl_h__
  6. #define mozilla_a11y_ARIAGridAccessible_inl_h__
  7. #include "ARIAGridAccessible.h"
  8. #include "AccIterator.h"
  9. #include "nsAccUtils.h"
  10. namespace mozilla {
  11. namespace a11y {
  12. inline int32_t
  13. ARIAGridCellAccessible::RowIndexFor(Accessible* aRow) const
  14. {
  15. Accessible* table = nsAccUtils::TableFor(aRow);
  16. if (table) {
  17. int32_t rowIdx = 0;
  18. Accessible* row = nullptr;
  19. AccIterator rowIter(table, filters::GetRow);
  20. while ((row = rowIter.Next()) && row != aRow)
  21. rowIdx++;
  22. if (row)
  23. return rowIdx;
  24. }
  25. return -1;
  26. }
  27. } // namespace a11y
  28. } // namespace mozilla
  29. #endif