зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1752380 - P1: Introduce HasPrimaryAction and remove redundant DoAction/ActionCount implementation. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D137200
This commit is contained in:
Родитель
33c038ec0d
Коммит
c61f9c123e
|
@ -390,6 +390,15 @@ class Accessible {
|
|||
*/
|
||||
virtual void GetPositionAndSetSize(int32_t* aPosInSet, int32_t* aSetSize);
|
||||
|
||||
/**
|
||||
* Return true if accessible has a primary action directly related to it, like
|
||||
* "click", "activate", "press", "jump", "open", "close", etc. A non-primary
|
||||
* action would be a complementary one like "showlongdesc".
|
||||
* If an accessible has an action that is associated with an ancestor, it is
|
||||
* not a primary action either.
|
||||
*/
|
||||
virtual bool HasPrimaryAction() const = 0;
|
||||
|
||||
private:
|
||||
static const uint8_t kTypeBits = 6;
|
||||
static const uint8_t kGenericTypesBits = 18;
|
||||
|
|
|
@ -19,8 +19,6 @@ using namespace mozilla::a11y;
|
|||
|
||||
role CheckboxAccessible::NativeRole() const { return roles::CHECKBUTTON; }
|
||||
|
||||
uint8_t CheckboxAccessible::ActionCount() const { return 1; }
|
||||
|
||||
void CheckboxAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
if (aIndex == eAction_Click) {
|
||||
uint64_t state = NativeState();
|
||||
|
@ -34,13 +32,7 @@ void CheckboxAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
|||
}
|
||||
}
|
||||
|
||||
bool CheckboxAccessible::DoAction(uint8_t aIndex) const {
|
||||
if (aIndex != eAction_Click) {
|
||||
return false;
|
||||
}
|
||||
DoCommand();
|
||||
return true;
|
||||
}
|
||||
bool CheckboxAccessible::HasPrimaryAction() const { return true; }
|
||||
|
||||
uint64_t CheckboxAccessible::NativeState() const {
|
||||
uint64_t state = LeafAccessible::NativeState();
|
||||
|
@ -78,19 +70,12 @@ RadioButtonAccessible::RadioButtonAccessible(nsIContent* aContent,
|
|||
DocAccessible* aDoc)
|
||||
: LeafAccessible(aContent, aDoc) {}
|
||||
|
||||
uint8_t RadioButtonAccessible::ActionCount() const { return 1; }
|
||||
bool RadioButtonAccessible::HasPrimaryAction() const { return true; }
|
||||
|
||||
void RadioButtonAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
if (aIndex == eAction_Click) aName.AssignLiteral("select");
|
||||
}
|
||||
|
||||
bool RadioButtonAccessible::DoAction(uint8_t aIndex) const {
|
||||
if (aIndex != eAction_Click) return false;
|
||||
|
||||
DoCommand();
|
||||
return true;
|
||||
}
|
||||
|
||||
role RadioButtonAccessible::NativeRole() const { return roles::RADIOBUTTON; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -32,9 +32,8 @@ class CheckboxAccessible : public LeafAccessible {
|
|||
virtual uint64_t NativeState() const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const override;
|
||||
|
@ -51,9 +50,8 @@ class RadioButtonAccessible : public LeafAccessible {
|
|||
virtual mozilla::a11y::role NativeRole() const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
|
||||
enum { eAction_Click = 0 };
|
||||
|
||||
|
|
|
@ -1812,7 +1812,7 @@ nsAtom* LocalAccessible::LandmarkRole() const {
|
|||
role LocalAccessible::NativeRole() const { return roles::NOTHING; }
|
||||
|
||||
uint8_t LocalAccessible::ActionCount() const {
|
||||
return GetActionRule() == eNoAction ? 0 : 1;
|
||||
return HasPrimaryAction() ? 1 : 0;
|
||||
}
|
||||
|
||||
void LocalAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
|
@ -1884,7 +1884,7 @@ void LocalAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
|||
bool LocalAccessible::DoAction(uint8_t aIndex) const {
|
||||
if (aIndex != 0) return false;
|
||||
|
||||
if (GetActionRule() != eNoAction) {
|
||||
if (HasPrimaryAction()) {
|
||||
DoCommand();
|
||||
return true;
|
||||
}
|
||||
|
@ -1892,6 +1892,10 @@ bool LocalAccessible::DoAction(uint8_t aIndex) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool LocalAccessible::HasPrimaryAction() const {
|
||||
return GetActionRule() != eNoAction;
|
||||
}
|
||||
|
||||
nsIContent* LocalAccessible::GetAtomicRegion() const {
|
||||
nsIContent* loopContent = mContent;
|
||||
nsAutoString atomic;
|
||||
|
|
|
@ -972,6 +972,8 @@ class LocalAccessible : public nsISupports, public Accessible {
|
|||
|
||||
virtual AccGroupInfo* GetOrCreateGroupInfo() override;
|
||||
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
|
||||
virtual void ARIAGroupPosition(int32_t* aLevel, int32_t* aSetSize,
|
||||
int32_t* aPosInSet) const override;
|
||||
|
||||
|
|
|
@ -70,25 +70,18 @@ void HTMLLabelAccessible::DOMAttributeChanged(int32_t aNameSpaceID,
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t HTMLLabelAccessible::ActionCount() const {
|
||||
return nsCoreUtils::IsLabelWithControl(mContent) ? 1 : 0;
|
||||
bool HTMLLabelAccessible::HasPrimaryAction() const {
|
||||
return nsCoreUtils::IsLabelWithControl(mContent);
|
||||
}
|
||||
|
||||
void HTMLLabelAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
if (aIndex == 0) {
|
||||
if (nsCoreUtils::IsLabelWithControl(mContent)) aName.AssignLiteral("click");
|
||||
if (HasPrimaryAction()) {
|
||||
aName.AssignLiteral("click");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool HTMLLabelAccessible::DoAction(uint8_t aIndex) const {
|
||||
if (aIndex == 0 && ActionCount()) {
|
||||
DoCommand();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLOuputAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -112,7 +105,7 @@ HTMLSummaryAccessible::HTMLSummaryAccessible(nsIContent* aContent,
|
|||
mGenericTypes |= eButton;
|
||||
}
|
||||
|
||||
uint8_t HTMLSummaryAccessible::ActionCount() const { return 1; }
|
||||
bool HTMLSummaryAccessible::HasPrimaryAction() const { return true; }
|
||||
|
||||
void HTMLSummaryAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
if (aIndex != eAction_Click) {
|
||||
|
@ -137,13 +130,6 @@ void HTMLSummaryAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
|||
}
|
||||
}
|
||||
|
||||
bool HTMLSummaryAccessible::DoAction(uint8_t aIndex) const {
|
||||
if (aIndex != eAction_Click) return false;
|
||||
|
||||
DoCommand();
|
||||
return true;
|
||||
}
|
||||
|
||||
uint64_t HTMLSummaryAccessible::NativeState() const {
|
||||
uint64_t state = HyperTextAccessibleWrap::NativeState();
|
||||
|
||||
|
|
|
@ -58,9 +58,8 @@ class HTMLLabelAccessible : public HyperTextAccessibleWrap {
|
|||
virtual Relation RelationByType(RelationType aType) const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
|
||||
protected:
|
||||
virtual ~HTMLLabelAccessible() {}
|
||||
|
@ -107,9 +106,8 @@ class HTMLSummaryAccessible : public HyperTextAccessibleWrap {
|
|||
virtual uint64_t NativeState() const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const override;
|
||||
|
|
|
@ -168,19 +168,12 @@ HTMLButtonAccessible::HTMLButtonAccessible(nsIContent* aContent,
|
|||
mGenericTypes |= eButton;
|
||||
}
|
||||
|
||||
uint8_t HTMLButtonAccessible::ActionCount() const { return 1; }
|
||||
bool HTMLButtonAccessible::HasPrimaryAction() const { return true; }
|
||||
|
||||
void HTMLButtonAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
if (aIndex == eAction_Click) aName.AssignLiteral("press");
|
||||
}
|
||||
|
||||
bool HTMLButtonAccessible::DoAction(uint8_t aIndex) const {
|
||||
if (aIndex != eAction_Click) return false;
|
||||
|
||||
DoCommand();
|
||||
return true;
|
||||
}
|
||||
|
||||
uint64_t HTMLButtonAccessible::State() {
|
||||
uint64_t state = HyperTextAccessibleWrap::State();
|
||||
if (state == states::DEFUNCT) return state;
|
||||
|
@ -420,7 +413,7 @@ uint64_t HTMLTextFieldAccessible::NativeState() const {
|
|||
return state;
|
||||
}
|
||||
|
||||
uint8_t HTMLTextFieldAccessible::ActionCount() const { return 1; }
|
||||
bool HTMLTextFieldAccessible::HasPrimaryAction() const { return true; }
|
||||
|
||||
void HTMLTextFieldAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
if (aIndex == eAction_Click) aName.AssignLiteral("activate");
|
||||
|
|
|
@ -57,9 +57,8 @@ class HTMLButtonAccessible : public HyperTextAccessibleWrap {
|
|||
virtual uint64_t NativeState() const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const override;
|
||||
|
@ -100,7 +99,7 @@ class HTMLTextFieldAccessible : public HyperTextAccessibleWrap {
|
|||
virtual bool AttributeChangesState(nsAtom* aAttribute) override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
|
||||
|
|
|
@ -74,8 +74,9 @@ void HTMLLinkAccessible::Value(nsString& aValue) const {
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t HTMLLinkAccessible::ActionCount() const {
|
||||
return IsLinked() ? 1 : HyperTextAccessible::ActionCount();
|
||||
bool HTMLLinkAccessible::HasPrimaryAction() const {
|
||||
return IsLinked() || HyperTextAccessible::HasPrimaryAction();
|
||||
;
|
||||
}
|
||||
|
||||
void HTMLLinkAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
|
@ -90,16 +91,6 @@ void HTMLLinkAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
|||
if (aIndex == eAction_Jump) aName.AssignLiteral("jump");
|
||||
}
|
||||
|
||||
bool HTMLLinkAccessible::DoAction(uint8_t aIndex) const {
|
||||
if (!IsLinked()) return HyperTextAccessible::DoAction(aIndex);
|
||||
|
||||
// Action 0 (default action): Jump to link
|
||||
if (aIndex != eAction_Jump) return false;
|
||||
|
||||
DoCommand();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HTMLLinkAccessible::AttributeChangesState(nsAtom* aAttribute) {
|
||||
return aAttribute == nsGkAtoms::href ||
|
||||
HyperTextAccessibleWrap::AttributeChangesState(aAttribute);
|
||||
|
|
|
@ -26,9 +26,8 @@ class HTMLLinkAccessible : public HyperTextAccessibleWrap {
|
|||
virtual uint64_t NativeInteractiveState() const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
|
||||
// HyperLinkAccessible
|
||||
virtual bool IsLink() const override;
|
||||
|
|
|
@ -243,14 +243,7 @@ void HTMLSelectOptionAccessible::ActionNameAt(uint8_t aIndex,
|
|||
if (aIndex == eAction_Select) aName.AssignLiteral("select");
|
||||
}
|
||||
|
||||
uint8_t HTMLSelectOptionAccessible::ActionCount() const { return 1; }
|
||||
|
||||
bool HTMLSelectOptionAccessible::DoAction(uint8_t aIndex) const {
|
||||
if (aIndex != eAction_Select) return false;
|
||||
|
||||
DoCommand();
|
||||
return true;
|
||||
}
|
||||
bool HTMLSelectOptionAccessible::HasPrimaryAction() const { return true; }
|
||||
|
||||
void HTMLSelectOptionAccessible::SetSelected(bool aSelect) {
|
||||
HTMLOptionElement* option = HTMLOptionElement::FromNode(mContent);
|
||||
|
@ -285,16 +278,7 @@ bool HTMLSelectOptGroupAccessible::IsAcceptableChild(nsIContent* aEl) const {
|
|||
return aEl->IsCharacterData() || aEl->IsHTMLElement(nsGkAtoms::option);
|
||||
}
|
||||
|
||||
uint8_t HTMLSelectOptGroupAccessible::ActionCount() const { return 0; }
|
||||
|
||||
void HTMLSelectOptGroupAccessible::ActionNameAt(uint8_t aIndex,
|
||||
nsAString& aName) {
|
||||
aName.Truncate();
|
||||
}
|
||||
|
||||
bool HTMLSelectOptGroupAccessible::DoAction(uint8_t aIndex) const {
|
||||
return false;
|
||||
}
|
||||
bool HTMLSelectOptGroupAccessible::HasPrimaryAction() const { return false; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// HTMLComboboxAccessible
|
||||
|
@ -373,14 +357,7 @@ void HTMLComboboxAccessible::Value(nsString& aValue) const {
|
|||
if (option) option->Name(aValue);
|
||||
}
|
||||
|
||||
uint8_t HTMLComboboxAccessible::ActionCount() const { return 1; }
|
||||
|
||||
bool HTMLComboboxAccessible::DoAction(uint8_t aIndex) const {
|
||||
if (aIndex != eAction_Click) return false;
|
||||
|
||||
DoCommand();
|
||||
return true;
|
||||
}
|
||||
bool HTMLComboboxAccessible::HasPrimaryAction() const { return true; }
|
||||
|
||||
void HTMLComboboxAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
if (aIndex != HTMLComboboxAccessible::eAction_Click) return;
|
||||
|
|
|
@ -73,9 +73,8 @@ class HTMLSelectOptionAccessible : public HyperTextAccessibleWrap {
|
|||
nsresult HandleAccEvent(AccEvent* aEvent) override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
|
||||
// Widgets
|
||||
virtual LocalAccessible* ContainerWidget() const override;
|
||||
|
@ -141,9 +140,7 @@ class HTMLSelectOptGroupAccessible : public HTMLSelectOptionAccessible {
|
|||
virtual bool IsAcceptableChild(nsIContent* aEl) const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
};
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
|
@ -172,9 +169,8 @@ class HTMLComboboxAccessible final : public AccessibleWrap {
|
|||
virtual bool IsAcceptableChild(nsIContent* aEl) const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const override;
|
||||
|
|
|
@ -643,6 +643,11 @@ void RemoteAccessibleBase<Derived>::InvalidateGroupInfo() {
|
|||
}
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
bool RemoteAccessibleBase<Derived>::HasPrimaryAction() const {
|
||||
return mCachedFields && mCachedFields->HasAttribute(nsGkAtoms::action);
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
void RemoteAccessibleBase<Derived>::TakeFocus() const {
|
||||
Unused << mDoc->SendTakeFocus(mID);
|
||||
|
|
|
@ -302,6 +302,8 @@ class RemoteAccessibleBase : public Accessible, public HyperTextAccessibleBase {
|
|||
|
||||
virtual AccGroupInfo* GetOrCreateGroupInfo() override;
|
||||
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
|
||||
private:
|
||||
uintptr_t mParent;
|
||||
static const uintptr_t kNoParent = UINTPTR_MAX;
|
||||
|
|
|
@ -76,10 +76,7 @@ void XULComboboxAccessible::Value(nsString& aValue) const {
|
|||
if (menuList) menuList->GetLabel(aValue);
|
||||
}
|
||||
|
||||
uint8_t XULComboboxAccessible::ActionCount() const {
|
||||
// Just one action (click).
|
||||
return 1;
|
||||
}
|
||||
bool XULComboboxAccessible::HasPrimaryAction() const { return true; }
|
||||
|
||||
bool XULComboboxAccessible::DoAction(uint8_t aIndex) const {
|
||||
if (aIndex != XULComboboxAccessible::eAction_Click) return false;
|
||||
|
|
|
@ -27,7 +27,7 @@ class XULComboboxAccessible : public AccessibleWrap {
|
|||
virtual uint64_t NativeState() const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ role XULLinkAccessible::NativeRole() const { return roles::LINK; }
|
|||
|
||||
uint64_t XULLinkAccessible::NativeLinkState() const { return states::LINKED; }
|
||||
|
||||
uint8_t XULLinkAccessible::ActionCount() const { return 1; }
|
||||
bool XULLinkAccessible::HasPrimaryAction() const { return true; }
|
||||
|
||||
void XULLinkAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
aName.Truncate();
|
||||
|
@ -181,13 +181,6 @@ void XULLinkAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
|||
if (aIndex == eAction_Jump) aName.AssignLiteral("jump");
|
||||
}
|
||||
|
||||
bool XULLinkAccessible::DoAction(uint8_t aIndex) const {
|
||||
if (aIndex != eAction_Jump) return false;
|
||||
|
||||
DoCommand();
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XULLinkAccessible: HyperLinkAccessible
|
||||
|
||||
|
|
|
@ -83,9 +83,8 @@ class XULLinkAccessible : public XULLabelAccessible {
|
|||
virtual uint64_t NativeLinkState() const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
|
||||
// HyperLinkAccessible
|
||||
virtual bool IsLink() const override;
|
||||
|
|
|
@ -49,19 +49,12 @@ XULButtonAccessible::~XULButtonAccessible() {}
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XULButtonAccessible: nsIAccessible
|
||||
|
||||
uint8_t XULButtonAccessible::ActionCount() const { return 1; }
|
||||
bool XULButtonAccessible::HasPrimaryAction() const { return true; }
|
||||
|
||||
void XULButtonAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
if (aIndex == eAction_Click) aName.AssignLiteral("press");
|
||||
}
|
||||
|
||||
bool XULButtonAccessible::DoAction(uint8_t aIndex) const {
|
||||
if (aIndex != 0) return false;
|
||||
|
||||
DoCommand();
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XULButtonAccessible: LocalAccessible
|
||||
|
||||
|
@ -148,7 +141,7 @@ XULDropmarkerAccessible::XULDropmarkerAccessible(nsIContent* aContent,
|
|||
DocAccessible* aDoc)
|
||||
: LeafAccessible(aContent, aDoc) {}
|
||||
|
||||
uint8_t XULDropmarkerAccessible::ActionCount() const { return 1; }
|
||||
bool XULDropmarkerAccessible::HasPrimaryAction() const { return true; }
|
||||
|
||||
bool XULDropmarkerAccessible::DropmarkerOpen(bool aToggleOpen) const {
|
||||
bool isOpen = false;
|
||||
|
|
|
@ -34,9 +34,8 @@ class XULButtonAccessible : public AccessibleWrap {
|
|||
virtual uint64_t NativeState() const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const override;
|
||||
|
@ -65,7 +64,7 @@ class XULDropmarkerAccessible : public LeafAccessible {
|
|||
virtual uint64_t NativeState() const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
|
||||
|
|
|
@ -47,19 +47,12 @@ uint64_t XULColumnItemAccessible::NativeState() const {
|
|||
return states::READONLY;
|
||||
}
|
||||
|
||||
uint8_t XULColumnItemAccessible::ActionCount() const { return 1; }
|
||||
bool XULColumnItemAccessible::HasPrimaryAction() const { return true; }
|
||||
|
||||
void XULColumnItemAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
if (aIndex == eAction_Click) aName.AssignLiteral("click");
|
||||
}
|
||||
|
||||
bool XULColumnItemAccessible::DoAction(uint8_t aIndex) const {
|
||||
if (aIndex != eAction_Click) return false;
|
||||
|
||||
DoCommand();
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XULListboxAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -41,9 +41,8 @@ class XULColumnItemAccessible : public LeafAccessible {
|
|||
virtual uint64_t NativeState() const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
|
||||
enum { eAction_Click = 0 };
|
||||
};
|
||||
|
|
|
@ -244,20 +244,11 @@ int32_t XULMenuitemAccessible::GetLevel(bool aFast) const {
|
|||
return nsAccUtils::GetLevelForXULContainerItem(mContent);
|
||||
}
|
||||
|
||||
bool XULMenuitemAccessible::DoAction(uint8_t index) const {
|
||||
if (index == eAction_Click) { // default action
|
||||
DoCommand();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void XULMenuitemAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
if (aIndex == eAction_Click) aName.AssignLiteral("click");
|
||||
}
|
||||
|
||||
uint8_t XULMenuitemAccessible::ActionCount() const { return 1; }
|
||||
bool XULMenuitemAccessible::HasPrimaryAction() const { return true; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XULMenuitemAccessible: Widgets
|
||||
|
@ -335,14 +326,7 @@ ENameValueFlag XULMenuSeparatorAccessible::NativeName(nsString& aName) const {
|
|||
|
||||
role XULMenuSeparatorAccessible::NativeRole() const { return roles::SEPARATOR; }
|
||||
|
||||
bool XULMenuSeparatorAccessible::DoAction(uint8_t index) const { return false; }
|
||||
|
||||
void XULMenuSeparatorAccessible::ActionNameAt(uint8_t aIndex,
|
||||
nsAString& aName) {
|
||||
aName.Truncate();
|
||||
}
|
||||
|
||||
uint8_t XULMenuSeparatorAccessible::ActionCount() const { return 0; }
|
||||
bool XULMenuSeparatorAccessible::HasPrimaryAction() const { return false; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XULMenupopupAccessible
|
||||
|
|
|
@ -28,9 +28,8 @@ class XULMenuitemAccessible : public AccessibleWrap {
|
|||
virtual uint64_t NativeInteractiveState() const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
virtual KeyBinding AccessKey() const override;
|
||||
virtual KeyBinding KeyboardShortcut() const override;
|
||||
|
||||
|
@ -57,9 +56,7 @@ class XULMenuSeparatorAccessible : public XULMenuitemAccessible {
|
|||
virtual uint64_t NativeState() const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
|
||||
protected:
|
||||
// LocalAccessible
|
||||
|
|
|
@ -31,7 +31,7 @@ XULTabAccessible::XULTabAccessible(nsIContent* aContent, DocAccessible* aDoc)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XULTabAccessible: LocalAccessible
|
||||
|
||||
uint8_t XULTabAccessible::ActionCount() const { return 1; }
|
||||
bool XULTabAccessible::HasPrimaryAction() const { return true; }
|
||||
|
||||
void XULTabAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
if (aIndex == eAction_Switch) aName.AssignLiteral("switch");
|
||||
|
@ -123,7 +123,7 @@ XULTabsAccessible::XULTabsAccessible(nsIContent* aContent, DocAccessible* aDoc)
|
|||
|
||||
role XULTabsAccessible::NativeRole() const { return roles::PAGETABLIST; }
|
||||
|
||||
uint8_t XULTabsAccessible::ActionCount() const { return 0; }
|
||||
bool XULTabsAccessible::HasPrimaryAction() const { return false; }
|
||||
|
||||
void XULTabsAccessible::Value(nsString& aValue) const { aValue.Truncate(); }
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class XULTabAccessible : public HyperTextAccessibleWrap {
|
|||
virtual void ApplyARIAState(uint64_t* aState) const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
};
|
||||
|
@ -49,7 +49,7 @@ class XULTabsAccessible : public XULSelectControlAccessible {
|
|||
virtual void ApplyARIAState(uint64_t* aState) const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
|
||||
// SelectAccessible
|
||||
virtual void SelectedItems(nsTArray<LocalAccessible*>* aItems) override;
|
||||
|
|
|
@ -707,6 +707,8 @@ Relation XULTreeItemAccessibleBase::RelationByType(RelationType aType) const {
|
|||
}
|
||||
}
|
||||
|
||||
bool XULTreeItemAccessibleBase::HasPrimaryAction() const { return true; }
|
||||
|
||||
uint8_t XULTreeItemAccessibleBase::ActionCount() const {
|
||||
// "activate" action is available for all treeitems, "expand/collapse" action
|
||||
// is avaible for treeitem which is container.
|
||||
|
|
|
@ -158,6 +158,7 @@ class XULTreeItemAccessibleBase : public AccessibleWrap {
|
|||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
|
||||
|
|
|
@ -440,15 +440,10 @@ nsRect XULTreeGridCellAccessible::BoundsInAppUnits() const {
|
|||
presContext->CSSPixelsToAppUnits(bounds.Height()));
|
||||
}
|
||||
|
||||
uint8_t XULTreeGridCellAccessible::ActionCount() const {
|
||||
if (mColumn->Cycler()) return 1;
|
||||
|
||||
if (mColumn->Type() == dom::TreeColumn_Binding::TYPE_CHECKBOX &&
|
||||
IsEditable()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
bool XULTreeGridCellAccessible::HasPrimaryAction() const {
|
||||
return mColumn->Cycler() ||
|
||||
(mColumn->Type() == dom::TreeColumn_Binding::TYPE_CHECKBOX &&
|
||||
IsEditable());
|
||||
}
|
||||
|
||||
void XULTreeGridCellAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
|
@ -473,23 +468,6 @@ void XULTreeGridCellAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
|||
}
|
||||
}
|
||||
|
||||
bool XULTreeGridCellAccessible::DoAction(uint8_t aIndex) const {
|
||||
if (aIndex != eAction_Click) return false;
|
||||
|
||||
if (mColumn->Cycler()) {
|
||||
DoCommand();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mColumn->Type() == dom::TreeColumn_Binding::TYPE_CHECKBOX &&
|
||||
IsEditable()) {
|
||||
DoCommand();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XULTreeGridCellAccessible: TableCell
|
||||
|
||||
|
|
|
@ -133,9 +133,8 @@ class XULTreeGridCellAccessible : public LeafAccessible,
|
|||
virtual uint64_t NativeInteractiveState() const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
virtual bool HasPrimaryAction() const override;
|
||||
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
||||
virtual bool DoAction(uint8_t aIndex) const override;
|
||||
|
||||
// TableCellAccessible
|
||||
virtual TableAccessible* Table() const override;
|
||||
|
|
Загрузка…
Ссылка в новой задаче