|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #include "Filters.h" |
|
6 |
|
7 #include "Accessible-inl.h" |
|
8 #include "nsAccUtils.h" |
|
9 #include "Role.h" |
|
10 #include "States.h" |
|
11 |
|
12 using namespace mozilla::a11y; |
|
13 using namespace mozilla::a11y::filters; |
|
14 |
|
15 uint32_t |
|
16 filters::GetSelected(Accessible* aAccessible) |
|
17 { |
|
18 if (aAccessible->State() & states::SELECTED) |
|
19 return eMatch | eSkipSubtree; |
|
20 |
|
21 return eSkip; |
|
22 } |
|
23 |
|
24 uint32_t |
|
25 filters::GetSelectable(Accessible* aAccessible) |
|
26 { |
|
27 if (aAccessible->InteractiveState() & states::SELECTABLE) |
|
28 return eMatch | eSkipSubtree; |
|
29 |
|
30 return eSkip; |
|
31 } |
|
32 |
|
33 uint32_t |
|
34 filters::GetRow(Accessible* aAccessible) |
|
35 { |
|
36 a11y::role role = aAccessible->Role(); |
|
37 if (role == roles::ROW) |
|
38 return eMatch | eSkipSubtree; |
|
39 |
|
40 // Look for rows inside rowgroup. |
|
41 if (role == roles::GROUPING) |
|
42 return eSkip; |
|
43 |
|
44 return eSkipSubtree; |
|
45 } |
|
46 |
|
47 uint32_t |
|
48 filters::GetCell(Accessible* aAccessible) |
|
49 { |
|
50 a11y::role role = aAccessible->Role(); |
|
51 return role == roles::GRID_CELL || role == roles::ROWHEADER || |
|
52 role == roles::COLUMNHEADER ? eMatch : eSkipSubtree; |
|
53 } |
|
54 |
|
55 uint32_t |
|
56 filters::GetEmbeddedObject(Accessible* aAccessible) |
|
57 { |
|
58 return nsAccUtils::IsEmbeddedObject(aAccessible) ? |
|
59 eMatch | eSkipSubtree : eSkipSubtree; |
|
60 } |