accessible/src/generic/ARIAGridAccessible-inl.h

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* vim: set ts=2 et sw=2 tw=80: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef mozilla_a11y_ARIAGridAccessible_inl_h__
     8 #define mozilla_a11y_ARIAGridAccessible_inl_h__
    10 #include "ARIAGridAccessible.h"
    12 #include "AccIterator.h"
    14 namespace mozilla {
    15 namespace a11y {
    17 inline Accessible*
    18 ARIAGridCellAccessible::TableFor(Accessible* aRow) const
    19 {
    20   if (aRow) {
    21     Accessible* table = aRow->Parent();
    22     if (table) {
    23       roles::Role tableRole = table->Role();
    24       if (tableRole == roles::GROUPING) { // if there's a rowgroup.
    25         table = table->Parent();
    26         if (table)
    27           tableRole = table->Role();
    28       }
    30       return tableRole == roles::TABLE || tableRole == roles::TREE_TABLE ?
    31         table : nullptr;
    32     }
    33   }
    35   return nullptr;
    36 }
    38 inline int32_t
    39 ARIAGridCellAccessible::RowIndexFor(Accessible* aRow) const
    40 {
    41   Accessible* table = TableFor(aRow);
    42   if (table) {
    43     int32_t rowIdx = 0;
    44     Accessible* row = nullptr;
    45     AccIterator rowIter(table, filters::GetRow);
    46     while ((row = rowIter.Next()) && row != aRow)
    47       rowIdx++;
    49     if (row)
    50       return rowIdx;
    51   }
    53   return -1;
    54 }
    56 } // namespace a11y
    57 } // namespace mozilla
    59 #endif

mercurial