2020-09-02 01:12:55 +03:00
|
|
|
/* 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;
|
|
|
|
|
|
|
|
/**
|
2020-09-29 01:32:07 +03:00
|
|
|
* This rule matches all accessibles that satisfy the "boilerplate"
|
|
|
|
* pivot conditions and have a corresponding native accessible.
|
2020-09-02 01:12:55 +03:00
|
|
|
*/
|
2020-09-29 01:32:07 +03:00
|
|
|
class RotorRule : public PivotRule {
|
2020-09-15 23:48:45 +03:00
|
|
|
public:
|
2021-07-22 20:58:49 +03:00
|
|
|
explicit RotorRule(Accessible* aDirectDescendantsFrom);
|
2020-09-29 01:32:07 +03:00
|
|
|
explicit RotorRule();
|
2021-07-22 20:58:49 +03:00
|
|
|
uint16_t Match(Accessible* aAcc) override;
|
2020-09-15 23:48:45 +03:00
|
|
|
|
2020-09-29 01:32:07 +03:00
|
|
|
private:
|
2021-07-22 20:58:49 +03:00
|
|
|
Accessible* mDirectDescendantsFrom;
|
2020-09-28 22:18:32 +03:00
|
|
|
};
|
|
|
|
|
2020-09-29 01:32:07 +03:00
|
|
|
/**
|
|
|
|
* This rule matches all accessibles of a given role.
|
|
|
|
*/
|
2020-10-05 22:52:15 +03:00
|
|
|
class RotorRoleRule : public RotorRule {
|
2020-09-28 22:18:32 +03:00
|
|
|
public:
|
2021-07-22 20:58:49 +03:00
|
|
|
explicit RotorRoleRule(role aRole, Accessible* aDirectDescendantsFrom);
|
2020-09-29 01:32:07 +03:00
|
|
|
explicit RotorRoleRule(role aRole);
|
2021-07-22 20:58:49 +03:00
|
|
|
uint16_t Match(Accessible* aAcc) override;
|
2020-09-28 22:18:32 +03:00
|
|
|
|
2020-09-29 01:32:07 +03:00
|
|
|
private:
|
|
|
|
role mRole;
|
2020-09-28 22:18:32 +03:00
|
|
|
};
|
|
|
|
|
2020-10-06 21:50:31 +03:00
|
|
|
class RotorMacRoleRule : public RotorRule {
|
|
|
|
public:
|
|
|
|
explicit RotorMacRoleRule(NSString* aRole);
|
|
|
|
explicit RotorMacRoleRule(NSString* aRole,
|
2021-07-22 20:58:49 +03:00
|
|
|
Accessible* aDirectDescendantsFrom);
|
2020-10-06 21:50:31 +03:00
|
|
|
~RotorMacRoleRule();
|
2021-07-22 20:58:49 +03:00
|
|
|
virtual uint16_t Match(Accessible* aAcc) override;
|
2020-10-06 21:50:31 +03:00
|
|
|
|
2020-10-15 19:42:14 +03:00
|
|
|
protected:
|
2020-10-06 21:50:31 +03:00
|
|
|
NSString* mMacRole;
|
|
|
|
};
|
|
|
|
|
2020-09-29 01:32:07 +03:00
|
|
|
class RotorControlRule final : public RotorRule {
|
2020-09-15 19:42:34 +03:00
|
|
|
public:
|
2021-07-22 20:58:49 +03:00
|
|
|
explicit RotorControlRule(Accessible* aDirectDescendantsFrom);
|
2020-09-15 19:42:34 +03:00
|
|
|
explicit RotorControlRule();
|
|
|
|
|
2021-07-22 20:58:49 +03:00
|
|
|
virtual uint16_t Match(Accessible* aAcc) override;
|
2020-09-15 19:42:34 +03:00
|
|
|
};
|
|
|
|
|
2020-12-11 13:29:15 +03:00
|
|
|
class RotorTextEntryRule final : public RotorRule {
|
|
|
|
public:
|
2021-07-22 20:58:49 +03:00
|
|
|
explicit RotorTextEntryRule(Accessible* aDirectDescendantsFrom);
|
2020-12-11 13:29:15 +03:00
|
|
|
explicit RotorTextEntryRule();
|
|
|
|
|
2021-07-22 20:58:49 +03:00
|
|
|
virtual uint16_t Match(Accessible* aAcc) override;
|
2020-12-11 13:29:15 +03:00
|
|
|
};
|
|
|
|
|
2020-09-29 01:32:07 +03:00
|
|
|
class RotorLinkRule : public RotorRule {
|
2020-09-17 23:20:55 +03:00
|
|
|
public:
|
|
|
|
explicit RotorLinkRule();
|
2021-07-22 20:58:49 +03:00
|
|
|
explicit RotorLinkRule(Accessible* aDirectDescendantsFrom);
|
2020-09-17 23:20:55 +03:00
|
|
|
|
2021-07-22 20:58:49 +03:00
|
|
|
virtual uint16_t Match(Accessible* aAcc) override;
|
2020-09-17 23:20:55 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class RotorVisitedLinkRule final : public RotorLinkRule {
|
|
|
|
public:
|
|
|
|
explicit RotorVisitedLinkRule();
|
2021-07-22 20:58:49 +03:00
|
|
|
explicit RotorVisitedLinkRule(Accessible* aDirectDescendantsFrom);
|
2020-09-17 23:20:55 +03:00
|
|
|
|
2021-07-22 20:58:49 +03:00
|
|
|
virtual uint16_t Match(Accessible* aAcc) override;
|
2020-09-17 23:20:55 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class RotorUnvisitedLinkRule final : public RotorLinkRule {
|
|
|
|
public:
|
|
|
|
explicit RotorUnvisitedLinkRule();
|
2021-07-22 20:58:49 +03:00
|
|
|
explicit RotorUnvisitedLinkRule(Accessible* aDirectDescendantsFrom);
|
2020-09-17 23:20:55 +03:00
|
|
|
|
2021-07-22 20:58:49 +03:00
|
|
|
virtual uint16_t Match(Accessible* aAcc) override;
|
2020-09-17 23:20:55 +03:00
|
|
|
};
|
2020-09-30 02:39:49 +03:00
|
|
|
|
2020-10-15 19:42:14 +03:00
|
|
|
/**
|
|
|
|
* 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,
|
2021-07-22 20:58:49 +03:00
|
|
|
Accessible* aDirectDescendantsFrom);
|
2020-10-15 19:42:14 +03:00
|
|
|
explicit RotorNotMacRoleRule(NSString* aMacRole);
|
2021-07-22 20:58:49 +03:00
|
|
|
uint16_t Match(Accessible* aAcc) override;
|
2020-10-15 19:42:14 +03:00
|
|
|
};
|
|
|
|
|
2020-09-30 02:39:49 +03:00
|
|
|
class RotorStaticTextRule : public RotorRule {
|
|
|
|
public:
|
|
|
|
explicit RotorStaticTextRule();
|
2021-07-22 20:58:49 +03:00
|
|
|
explicit RotorStaticTextRule(Accessible* aDirectDescendantsFrom);
|
2020-09-30 02:39:49 +03:00
|
|
|
|
2021-07-22 20:58:49 +03:00
|
|
|
virtual uint16_t Match(Accessible* aAcc) override;
|
2020-09-30 02:39:49 +03:00
|
|
|
};
|
2020-10-05 22:52:15 +03:00
|
|
|
|
|
|
|
class RotorHeadingLevelRule : public RotorRoleRule {
|
|
|
|
public:
|
|
|
|
explicit RotorHeadingLevelRule(int32_t aLevel);
|
|
|
|
explicit RotorHeadingLevelRule(int32_t aLevel,
|
2021-07-22 20:58:49 +03:00
|
|
|
Accessible* aDirectDescendantsFrom);
|
2020-10-05 22:52:15 +03:00
|
|
|
|
2021-07-22 20:58:49 +03:00
|
|
|
virtual uint16_t Match(Accessible* aAcc) override;
|
2020-10-05 22:52:15 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
int32_t mLevel;
|
|
|
|
};
|
2020-11-12 09:16:58 +03:00
|
|
|
|
2020-11-16 23:16:44 +03:00
|
|
|
class RotorLiveRegionRule : public RotorRule {
|
|
|
|
public:
|
2021-07-22 20:58:49 +03:00
|
|
|
explicit RotorLiveRegionRule(Accessible* aDirectDescendantsFrom)
|
2020-11-16 23:16:44 +03:00
|
|
|
: RotorRule(aDirectDescendantsFrom) {}
|
|
|
|
explicit RotorLiveRegionRule() : RotorRule() {}
|
|
|
|
|
2021-07-22 20:58:49 +03:00
|
|
|
uint16_t Match(Accessible* aAcc) override;
|
2020-11-16 23:16:44 +03:00
|
|
|
};
|
|
|
|
|
2020-11-12 09:16:58 +03:00
|
|
|
/**
|
|
|
|
* This rule matches all accessibles with roles::OUTLINEITEM. If
|
|
|
|
* outlines are nested, it ignores the nested subtree and returns
|
|
|
|
* only items which are descendants of the primary outline.
|
|
|
|
*/
|
|
|
|
class OutlineRule : public RotorRule {
|
|
|
|
public:
|
|
|
|
explicit OutlineRule();
|
2021-07-22 20:58:49 +03:00
|
|
|
uint16_t Match(Accessible* aAcc) override;
|
2020-11-12 09:16:58 +03:00
|
|
|
};
|