2012-08-28 17:13:59 +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/. */
|
|
|
|
|
2012-08-31 14:36:41 +04:00
|
|
|
#include "Filters.h"
|
2012-08-28 17:13:59 +04:00
|
|
|
|
2021-02-20 02:14:32 +03:00
|
|
|
#include "LocalAccessible-inl.h"
|
2012-08-28 17:13:59 +04:00
|
|
|
#include "nsAccUtils.h"
|
|
|
|
#include "Role.h"
|
|
|
|
#include "States.h"
|
|
|
|
|
|
|
|
using namespace mozilla::a11y;
|
|
|
|
using namespace mozilla::a11y::filters;
|
|
|
|
|
2021-02-20 02:14:32 +03:00
|
|
|
uint32_t filters::GetSelected(LocalAccessible* aAccessible) {
|
2012-08-28 17:13:59 +04:00
|
|
|
if (aAccessible->State() & states::SELECTED) return eMatch | eSkipSubtree;
|
|
|
|
|
|
|
|
return eSkip;
|
|
|
|
}
|
|
|
|
|
2021-02-20 02:14:32 +03:00
|
|
|
uint32_t filters::GetSelectable(LocalAccessible* aAccessible) {
|
2021-02-20 02:14:32 +03:00
|
|
|
if (aAccessible->InteractiveState() & states::SELECTABLE) {
|
2012-08-28 17:13:59 +04:00
|
|
|
return eMatch | eSkipSubtree;
|
2021-02-20 02:14:32 +03:00
|
|
|
}
|
2012-08-28 17:13:59 +04:00
|
|
|
|
|
|
|
return eSkip;
|
|
|
|
}
|
|
|
|
|
2021-02-20 02:14:32 +03:00
|
|
|
uint32_t filters::GetRow(LocalAccessible* aAccessible) {
|
2018-03-13 10:56:03 +03:00
|
|
|
if (aAccessible->IsTableRow()) return eMatch | eSkipSubtree;
|
2012-08-28 17:13:59 +04:00
|
|
|
|
2020-03-04 09:25:01 +03:00
|
|
|
// Look for rows inside rowgroup or wrapping text containers.
|
2018-03-13 10:56:03 +03:00
|
|
|
a11y::role role = aAccessible->Role();
|
2020-03-04 09:25:01 +03:00
|
|
|
const nsRoleMapEntry* roleMapEntry = aAccessible->ARIARoleMap();
|
|
|
|
if (role == roles::GROUPING ||
|
|
|
|
(aAccessible->IsGenericHyperText() && !roleMapEntry)) {
|
|
|
|
return eSkip;
|
|
|
|
}
|
2012-08-28 17:13:59 +04:00
|
|
|
|
|
|
|
return eSkipSubtree;
|
|
|
|
}
|
|
|
|
|
2021-02-20 02:14:32 +03:00
|
|
|
uint32_t filters::GetCell(LocalAccessible* aAccessible) {
|
2015-08-13 15:43:26 +03:00
|
|
|
return aAccessible->IsTableCell() ? eMatch : eSkipSubtree;
|
2012-08-28 17:13:59 +04:00
|
|
|
}
|