Title: [287390] trunk/Tools
Revision
287390
Author
carlo...@webkit.org
Date
2021-12-23 00:56:11 -0800 (Thu, 23 Dec 2021)

Log Message

[GTK][a11y] WTR: add missing bool and string attribute values with ATSPI
https://bugs.webkit.org/show_bug.cgi?id=234599

Reviewed by Adrian Perez de Castro.

* WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp:
(WTR::checkElementState):
(WTR::AccessibilityUIElement::stringAttributeValue):
(WTR::AccessibilityUIElement::boolAttributeValue):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (287389 => 287390)


--- trunk/Tools/ChangeLog	2021-12-23 08:55:22 UTC (rev 287389)
+++ trunk/Tools/ChangeLog	2021-12-23 08:56:11 UTC (rev 287390)
@@ -1,5 +1,17 @@
 2021-12-23  Carlos Garcia Campos  <cgar...@igalia.com>
 
+        [GTK][a11y] WTR: add missing bool and string attribute values with ATSPI
+        https://bugs.webkit.org/show_bug.cgi?id=234599
+
+        Reviewed by Adrian Perez de Castro.
+
+        * WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp:
+        (WTR::checkElementState):
+        (WTR::AccessibilityUIElement::stringAttributeValue):
+        (WTR::AccessibilityUIElement::boolAttributeValue):
+
+2021-12-23  Carlos Garcia Campos  <cgar...@igalia.com>
+
         [GTK][a11y] WTR: ensure the root object is created before getting the focused element with ATSPI
         https://bugs.webkit.org/show_bug.cgi?id=234597
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp (287389 => 287390)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp	2021-12-23 08:55:22 UTC (rev 287389)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp	2021-12-23 08:56:11 UTC (rev 287390)
@@ -343,6 +343,11 @@
     return JSStringCreateWithCharacters(nullptr, 0);
 }
 
+static bool checkElementState(WebCore::AccessibilityObjectAtspi* element, WebCore::Atspi::State state)
+{
+    return element->state() & (G_GUINT64_CONSTANT(1) << state);
+}
+
 JSRetainPtr<JSStringRef> AccessibilityUIElement::stringAttributeValue(JSStringRef attribute)
 {
     String attributeName = toWTFString(attribute);
@@ -359,6 +364,13 @@
     auto attributes = m_element->attributes();
     if (attributeName == "AXPlaceholderValue")
         return OpaqueJSString::tryCreate(attributes.get("placeholder-text")).leakRef();
+    if (attributeName == "AXInvalid") {
+        auto textAttributes = m_element->textAttributes();
+        auto value = textAttributes.attributes.get("invalid");
+        if (value.isEmpty())
+            value = checkElementState(m_element.get(), WebCore::Atspi::State::InvalidEntry) ? "true" : "false";
+        return OpaqueJSString::tryCreate(value).leakRef();
+    }
 
     return JSStringCreateWithCharacters(nullptr, 0);
 }
@@ -444,16 +456,19 @@
     return nullptr;
 }
 
-static bool checkElementState(WebCore::AccessibilityObjectAtspi* element, WebCore::Atspi::State state)
-{
-    return element->state() & (G_GUINT64_CONSTANT(1) << state);
-}
-
 bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute)
 {
     String attributeName = toWTFString(attribute);
     if (attributeName == "AXElementBusy")
         return checkElementState(m_element.get(), WebCore::Atspi::State::Busy);
+    if (attributeName == "AXModal")
+        return checkElementState(m_element.get(), WebCore::Atspi::State::Modal);
+    if (attributeName == "AXSupportsAutoCompletion")
+        return checkElementState(m_element.get(), WebCore::Atspi::State::SupportsAutocompletion);
+    if (attributeName == "AXInterfaceTable")
+        return m_element->interfaces().contains(WebCore::AccessibilityObjectAtspi::Interface::Table);
+    if (attributeName == "AXInterfaceTableCell")
+        return m_element->interfaces().contains(WebCore::AccessibilityObjectAtspi::Interface::TableCell);
 
     return false;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to