Skip to content

Commit

Permalink
[AX][GTK] Implement Text interface for document-web
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=268154

Reviewed by NOBODY (OOPS!).

This patch changes slightly how the roles reported by the AT-SPI DOM
tree are available. The goal is to unify how browsers report roles on
their accessible trees. It makes WebKit mostly match what Firefox and
Chromium do.

It is based on three general rules discussed with Orca developers:

 1. Accessible objects that implements Text must also implement Hypertext
 2. Children of Hypertext implementors must implement Hyperlink
 3. The document-web object must implement Text

In practice, this makes all accessible objects under the document-web
object implement Hyperlink, and many more implement Text now.

* Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp:
(WebCore::AccessibilityObjectAtspi::interfacesForObject):
  • Loading branch information
GeorgesStavracas committed Feb 22, 2024
1 parent 4ded51d commit 2a84947
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,10 @@ OptionSet<AccessibilityObjectAtspi::Interface> AccessibilityObjectAtspi::interfa
interfaces.add(Interface::Text);
else if (coreObject.isTextControl() || coreObject.isNonNativeTextControl())
interfaces.add(Interface::Text);
else if (!coreObject.isWebArea()) {
if (coreObject.roleValue() != AccessibilityRole::Table) {
interfaces.add(Interface::Hypertext);
if ((renderer && renderer->childrenInline()) || roleIsTextType(coreObject.roleValue()) || coreObject.isMathToken())
interfaces.add(Interface::Text);
}
}
else if (coreObject.isWebArea())
interfaces.add(Interface::Text);
else if (coreObject.roleValue() != AccessibilityRole::Table && ((renderer && renderer->childrenInline()) || roleIsTextType(coreObject.roleValue()) || coreObject.isMathToken()))
interfaces.add(Interface::Text);

if (coreObject.supportsRangeValue())
interfaces.add(Interface::Value);
Expand Down Expand Up @@ -108,9 +105,19 @@ OptionSet<AccessibilityObjectAtspi::Interface> AccessibilityObjectAtspi::interfa
interfaces.add(Interface::Image);
else
interfaces.add(Interface::Text);
interfaces.add(Interface::Hyperlink);
}

// Anything that implements the Text interface should also implement the
// Hypertext interface
if (interfaces.contains(Interface::Text))
interfaces.add(Interface::Hypertext);

// All accessible objects beneath the web area should be linked by their
// parent. In practice, this means all objects except the root and the
// web area should be hyperlinks.
if (!coreObject.isWebArea() && coreObject.isDescendantOfRole(AccessibilityRole::WebArea))
interfaces.add(Interface::Hyperlink);

return interfaces;
}

Expand Down

0 comments on commit 2a84947

Please sign in to comment.