1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/src/base/Filters.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,60 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "Filters.h" 1.9 + 1.10 +#include "Accessible-inl.h" 1.11 +#include "nsAccUtils.h" 1.12 +#include "Role.h" 1.13 +#include "States.h" 1.14 + 1.15 +using namespace mozilla::a11y; 1.16 +using namespace mozilla::a11y::filters; 1.17 + 1.18 +uint32_t 1.19 +filters::GetSelected(Accessible* aAccessible) 1.20 +{ 1.21 + if (aAccessible->State() & states::SELECTED) 1.22 + return eMatch | eSkipSubtree; 1.23 + 1.24 + return eSkip; 1.25 +} 1.26 + 1.27 +uint32_t 1.28 +filters::GetSelectable(Accessible* aAccessible) 1.29 +{ 1.30 + if (aAccessible->InteractiveState() & states::SELECTABLE) 1.31 + return eMatch | eSkipSubtree; 1.32 + 1.33 + return eSkip; 1.34 +} 1.35 + 1.36 +uint32_t 1.37 +filters::GetRow(Accessible* aAccessible) 1.38 +{ 1.39 + a11y::role role = aAccessible->Role(); 1.40 + if (role == roles::ROW) 1.41 + return eMatch | eSkipSubtree; 1.42 + 1.43 + // Look for rows inside rowgroup. 1.44 + if (role == roles::GROUPING) 1.45 + return eSkip; 1.46 + 1.47 + return eSkipSubtree; 1.48 +} 1.49 + 1.50 +uint32_t 1.51 +filters::GetCell(Accessible* aAccessible) 1.52 +{ 1.53 + a11y::role role = aAccessible->Role(); 1.54 + return role == roles::GRID_CELL || role == roles::ROWHEADER || 1.55 + role == roles::COLUMNHEADER ? eMatch : eSkipSubtree; 1.56 +} 1.57 + 1.58 +uint32_t 1.59 +filters::GetEmbeddedObject(Accessible* aAccessible) 1.60 +{ 1.61 + return nsAccUtils::IsEmbeddedObject(aAccessible) ? 1.62 + eMatch | eSkipSubtree : eSkipSubtree; 1.63 +}