Skip to content
Permalink
Browse files
AX: rename actionVerb() as localizedActionVerb()
https://bugs.webkit.org/show_bug.cgi?id=232711
<rdar://problem/85015496>

Reviewed by Andres Gonzalez.

Source/WebCore:

Since it's returning the localized name. In ATSPI there are two methods in the action interface GetName and
GetLocalizedName, so this patch also adds actionVerb() returning the unlocalized action name.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::localizedActionVerb const):
(WebCore::AccessibilityObject::actionVerb const):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::localizedActionVerb const):
* accessibility/AccessibilityObjectInterface.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::tabChildren):
(WebCore::AccessibilityRenderObject::actionVerb const): Deleted.
* accessibility/AccessibilityRenderObject.h:
* accessibility/atk/WebKitAccessibleHyperlink.cpp:
(webkitAccessibleHyperlinkActionGetName):
* accessibility/atk/WebKitAccessibleInterfaceAction.cpp:
(webkitAccessibleActionGetName):
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::initializeAttributeData):
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/isolatedtree/AXIsolatedTree.h:

Source/WebKitLegacy/win:

* AccessibleBase.cpp:
(AccessibleBase::get_accDefaultAction): Use localizedActionVerb().


Canonical link: https://commits.webkit.org/243901@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285340 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
carlosgcampos committed Nov 5, 2021
1 parent 54bea94 commit a7b912a211613033cd1e74b89a78d57daba96226
Showing 13 changed files with 81 additions and 38 deletions.
@@ -1,3 +1,33 @@
2021-11-05 Carlos Garcia Campos <cgarcia@igalia.com>

AX: rename actionVerb() as localizedActionVerb()
https://bugs.webkit.org/show_bug.cgi?id=232711
<rdar://problem/85015496>

Reviewed by Andres Gonzalez.

Since it's returning the localized name. In ATSPI there are two methods in the action interface GetName and
GetLocalizedName, so this patch also adds actionVerb() returning the unlocalized action name.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::localizedActionVerb const):
(WebCore::AccessibilityObject::actionVerb const):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::localizedActionVerb const):
* accessibility/AccessibilityObjectInterface.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::tabChildren):
(WebCore::AccessibilityRenderObject::actionVerb const): Deleted.
* accessibility/AccessibilityRenderObject.h:
* accessibility/atk/WebKitAccessibleHyperlink.cpp:
(webkitAccessibleHyperlinkActionGetName):
* accessibility/atk/WebKitAccessibleInterfaceAction.cpp:
(webkitAccessibleActionGetName):
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::initializeAttributeData):
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/isolatedtree/AXIsolatedTree.h:

2021-11-05 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK][a11y] Embedded objects are not correctly handled by text interface with ATSPI
@@ -1800,7 +1800,7 @@ const String AccessibilityObject::defaultLiveRegionStatusForRole(AccessibilityRo
}

#if ENABLE(ACCESSIBILITY)
String AccessibilityObject::actionVerb() const
String AccessibilityObject::localizedActionVerb() const
{
#if !PLATFORM(IOS_FAMILY)
// FIXME: Need to add verbs for select elements.
@@ -1842,6 +1842,36 @@ String AccessibilityObject::actionVerb() const
return nullAtom();
#endif
}

String AccessibilityObject::actionVerb() const
{
#if !PLATFORM(IOS_FAMILY)
// FIXME: Need to add verbs for select elements.
switch (roleValue()) {
case AccessibilityRole::Button:
case AccessibilityRole::ToggleButton:
return "press"_s;
case AccessibilityRole::TextField:
case AccessibilityRole::TextArea:
return "activate"_s;
case AccessibilityRole::RadioButton:
return "select"_s;
case AccessibilityRole::CheckBox:
case AccessibilityRole::Switch:
return isChecked() ? "uncheck"_s : "check"_s;
case AccessibilityRole::Link:
case AccessibilityRole::WebCoreLink:
return "jump"_s;
case AccessibilityRole::PopUpButton:
case AccessibilityRole::MenuListPopup:
case AccessibilityRole::ListItem:
return "select"_s;
default:
break;
}
#endif
return { };
}
#endif

bool AccessibilityObject::ariaIsMultiline() const
@@ -441,6 +441,7 @@ class AccessibilityObject : public AXCoreObject {
VisibleSelection selection() const override { return VisibleSelection(); }
String selectedText() const override { return String(); }
String accessKey() const override { return nullAtom(); }
String localizedActionVerb() const override;
String actionVerb() const override;

bool isWidget() const override { return false; }
@@ -824,6 +825,7 @@ class AccessibilityObject : public AXCoreObject {

#if !ENABLE(ACCESSIBILITY)
inline const AccessibilityObject::AccessibilityChildrenVector& AccessibilityObject::children(bool) { return m_children; }
inline String AccessibilityObject::localizedActionVerb() const { return emptyString(); }
inline String AccessibilityObject::actionVerb() const { return emptyString(); }
inline int AccessibilityObject::lineForPosition(const VisiblePosition&) const { return -1; }
inline void AccessibilityObject::updateBackingStore() { }
@@ -1189,6 +1189,7 @@ class AXCoreObject : public ThreadSafeRefCounted<AXCoreObject> {
virtual VisibleSelection selection() const = 0;
virtual String selectedText() const = 0;
virtual String accessKey() const = 0;
virtual String localizedActionVerb() const = 0;
virtual String actionVerb() const = 0;

// Widget support.
@@ -3728,40 +3728,7 @@ void AccessibilityRenderObject::tabChildren(AccessibilityChildrenVector& result)
result.append(child);
}
}

String AccessibilityRenderObject::actionVerb() const
{
#if !PLATFORM(IOS_FAMILY)
// FIXME: Need to add verbs for select elements.
static NeverDestroyed<const String> buttonAction(AXButtonActionVerb());
static NeverDestroyed<const String> textFieldAction(AXTextFieldActionVerb());
static NeverDestroyed<const String> radioButtonAction(AXRadioButtonActionVerb());
static NeverDestroyed<const String> checkedCheckBoxAction(AXUncheckedCheckBoxActionVerb());
static NeverDestroyed<const String> uncheckedCheckBoxAction(AXUncheckedCheckBoxActionVerb());
static NeverDestroyed<const String> linkAction(AXLinkActionVerb());

switch (roleValue()) {
case AccessibilityRole::Button:
case AccessibilityRole::ToggleButton:
return buttonAction;
case AccessibilityRole::TextField:
case AccessibilityRole::TextArea:
return textFieldAction;
case AccessibilityRole::RadioButton:
return radioButtonAction;
case AccessibilityRole::CheckBox:
return isChecked() ? checkedCheckBoxAction : uncheckedCheckBoxAction;
case AccessibilityRole::Link:
case AccessibilityRole::WebCoreLink:
return linkAction;
default:
return nullAtom();
}
#else
return nullAtom();
#endif
}

void AccessibilityRenderObject::setAccessibleName(const AtomString& name)
{
// Setting the accessible name can store the value in the DOM
@@ -134,7 +134,6 @@ class AccessibilityRenderObject : public AccessibilityNodeObject, public CanMake
int textLength() const override;
String selectedText() const override;
String accessKey() const override;
String actionVerb() const override;

bool isWidget() const override;
Widget* widget() const override;
@@ -111,7 +111,7 @@ static const gchar* webkitAccessibleHyperlinkActionGetName(AtkAction* action, gi
return nullptr;

auto& coreObject = webkitAccessibleGetAccessibilityObject(accessibleHyperlink->priv->hyperlinkImpl);
accessibleHyperlink->priv->actionName = coreObject.actionVerb().utf8();
accessibleHyperlink->priv->actionName = coreObject.localizedActionVerb().utf8();
return accessibleHyperlink->priv->actionName.data();
}

@@ -91,7 +91,7 @@ static const gchar* webkitAccessibleActionGetName(AtkAction* action, gint)
auto* accessible = WEBKIT_ACCESSIBLE(action);
returnValIfWebKitAccessibleIsInvalid(accessible, nullptr);

return webkitAccessibleCacheAndReturnAtkProperty(accessible, AtkCachedActionName, core(action)->actionVerb().utf8());
return webkitAccessibleCacheAndReturnAtkProperty(accessible, AtkCachedActionName, core(action)->localizedActionVerb().utf8());
}

void webkitAccessibleActionInterfaceInit(AtkActionIface* iface)
@@ -201,6 +201,7 @@ void AXIsolatedObject::initializeAttributeData(AXCoreObject& object, bool isRoot
setProperty(AXPropertyName::ValueAutofillButtonType, static_cast<int>(object.valueAutofillButtonType()));
setProperty(AXPropertyName::URL, object.url().isolatedCopy());
setProperty(AXPropertyName::AccessKey, object.accessKey().isolatedCopy());
setProperty(AXPropertyName::LocalizedActionVerb, object.localizedActionVerb().isolatedCopy());
setProperty(AXPropertyName::ActionVerb, object.actionVerb().isolatedCopy());
setProperty(AXPropertyName::ReadOnlyValue, object.readOnlyValue().isolatedCopy());
setProperty(AXPropertyName::AutoCompleteValue, object.autoCompleteValue().isolatedCopy());
@@ -290,6 +290,7 @@ class AXIsolatedObject final : public AXCoreObject {
void ariaTreeItemContent(AccessibilityChildrenVector& children) override { fillChildrenVectorForProperty(AXPropertyName::ARIATreeItemContent, children); }
URL url() const override { return urlAttributeValue(AXPropertyName::URL); }
String accessKey() const override { return stringAttributeValue(AXPropertyName::AccessKey); }
String localizedActionVerb() const override { return stringAttributeValue(AXPropertyName::LocalizedActionVerb); }
String actionVerb() const override { return stringAttributeValue(AXPropertyName::ActionVerb); }
String readOnlyValue() const override { return stringAttributeValue(AXPropertyName::ReadOnlyValue); }
String autoCompleteValue() const override { return stringAttributeValue(AXPropertyName::AutoCompleteValue); }
@@ -237,6 +237,7 @@ enum class AXPropertyName : uint16_t {
LiveRegionAtomic,
LiveRegionRelevant,
LiveRegionStatus,
LocalizedActionVerb,
MathFencedOpenString,
MathFencedCloseString,
MathLineThickness,
@@ -717,7 +717,7 @@ HRESULT AccessibleBase::get_accDefaultAction(VARIANT vChild, __deref_opt_out BST
if (FAILED(hr))
return hr;

if (*action = BString(childObj->actionVerb()).release())
if (*action = BString(childObj->localizedActionVerb()).release())
return S_OK;
return S_FALSE;
}
@@ -1,3 +1,14 @@
2021-11-05 Carlos Garcia Campos <cgarcia@igalia.com>

AX: rename actionVerb() as localizedActionVerb()
https://bugs.webkit.org/show_bug.cgi?id=232711
<rdar://problem/85015496>

Reviewed by Andres Gonzalez.

* AccessibleBase.cpp:
(AccessibleBase::get_accDefaultAction): Use localizedActionVerb().

2021-10-11 Chris Dumez <cdumez@apple.com>

DOMTimeStamp is now EpochTimeStamp

0 comments on commit a7b912a

Please sign in to comment.