diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /accessible/mac/RotorRules.h | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'accessible/mac/RotorRules.h')
-rw-r--r-- | accessible/mac/RotorRules.h | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/accessible/mac/RotorRules.h b/accessible/mac/RotorRules.h new file mode 100644 index 0000000000..7ccb191cb1 --- /dev/null +++ b/accessible/mac/RotorRules.h @@ -0,0 +1,144 @@ +/* clang-format off */ +/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* clang-format on */ +/* 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/. */ + +#import "mozAccessible.h" +#include "Pivot.h" + +using namespace mozilla::a11y; + +/** + * This rule matches all accessibles that satisfy the "boilerplate" + * pivot conditions and have a corresponding native accessible. + */ +class RotorRule : public PivotRule { + public: + explicit RotorRule(Accessible* aDirectDescendantsFrom, + const nsString& aSearchText); + explicit RotorRule(const nsString& aSearchText); + uint16_t Match(Accessible* aAcc) override; + + private: + Accessible* mDirectDescendantsFrom; + const nsString& mSearchText; +}; + +/** + * This rule matches all accessibles of a given role. + */ +class RotorRoleRule : public RotorRule { + public: + explicit RotorRoleRule(role aRole, Accessible* aDirectDescendantsFrom, + const nsString& aSearchText); + explicit RotorRoleRule(role aRole, const nsString& aSearchText); + uint16_t Match(Accessible* aAcc) override; + + private: + role mRole; +}; + +class RotorMacRoleRule : public RotorRule { + public: + explicit RotorMacRoleRule(NSString* aRole, const nsString& aSearchText); + explicit RotorMacRoleRule(NSString* aRole, Accessible* aDirectDescendantsFrom, + const nsString& aSearchText); + ~RotorMacRoleRule(); + virtual uint16_t Match(Accessible* aAcc) override; + + protected: + NSString* mMacRole; +}; + +class RotorControlRule final : public RotorRule { + public: + explicit RotorControlRule(Accessible* aDirectDescendantsFrom, + const nsString& aSearchText); + explicit RotorControlRule(const nsString& aSearchText); + + virtual uint16_t Match(Accessible* aAcc) override; +}; + +class RotorTextEntryRule final : public RotorRule { + public: + explicit RotorTextEntryRule(Accessible* aDirectDescendantsFrom, + const nsString& aSearchText); + explicit RotorTextEntryRule(const nsString& aSearchText); + + virtual uint16_t Match(Accessible* aAcc) override; +}; + +class RotorLinkRule : public RotorRule { + public: + explicit RotorLinkRule(const nsString& aSearchText); + explicit RotorLinkRule(Accessible* aDirectDescendantsFrom, + const nsString& aSearchText); + + virtual uint16_t Match(Accessible* aAcc) override; +}; + +class RotorVisitedLinkRule final : public RotorLinkRule { + public: + explicit RotorVisitedLinkRule(const nsString& aSearchText); + explicit RotorVisitedLinkRule(Accessible* aDirectDescendantsFrom, + const nsString& aSearchText); + + virtual uint16_t Match(Accessible* aAcc) override; +}; + +class RotorUnvisitedLinkRule final : public RotorLinkRule { + public: + explicit RotorUnvisitedLinkRule(const nsString& aSearchText); + explicit RotorUnvisitedLinkRule(Accessible* aDirectDescendantsFrom, + const nsString& aSearchText); + + virtual uint16_t Match(Accessible* aAcc) override; +}; + +/** + * This rule matches all accessibles that satisfy the "boilerplate" + * pivot conditions and have a corresponding native accessible. + */ +class RotorNotMacRoleRule : public RotorMacRoleRule { + public: + explicit RotorNotMacRoleRule(NSString* aMacRole, + Accessible* aDirectDescendantsFrom, + const nsString& aSearchText); + explicit RotorNotMacRoleRule(NSString* aMacRole, const nsString& aSearchText); + uint16_t Match(Accessible* aAcc) override; +}; + +class RotorStaticTextRule : public RotorRule { + public: + explicit RotorStaticTextRule(const nsString& aSearchText); + explicit RotorStaticTextRule(Accessible* aDirectDescendantsFrom, + const nsString& aSearchText); + + virtual uint16_t Match(Accessible* aAcc) override; +}; + +class RotorHeadingLevelRule : public RotorRoleRule { + public: + explicit RotorHeadingLevelRule(int32_t aLevel, const nsString& aSearchText); + explicit RotorHeadingLevelRule(int32_t aLevel, + Accessible* aDirectDescendantsFrom, + const nsString& aSearchText); + + virtual uint16_t Match(Accessible* aAcc) override; + + private: + int32_t mLevel; +}; + +class RotorLiveRegionRule : public RotorRule { + public: + explicit RotorLiveRegionRule(Accessible* aDirectDescendantsFrom, + const nsString& aSearchText) + : RotorRule(aDirectDescendantsFrom, aSearchText) {} + explicit RotorLiveRegionRule(const nsString& aSearchText) + : RotorRule(aSearchText) {} + + uint16_t Match(Accessible* aAcc) override; +}; |