[webkit-changes] [WebKit/WebKit] 1907a4: AX: AccessibilityTable should use m_role like ever...

Tyler Wilcock noreply at github.com
Sun Oct 27 14:02:16 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1907a445147bf44d8a54bd25067bc62ecc06b63f
      https://github.com/WebKit/WebKit/commit/1907a445147bf44d8a54bd25067bc62ecc06b63f
  Author: Tyler Wilcock <tyler_w at apple.com>
  Date:   2024-10-27 (Sun, 27 Oct 2024)

  Changed paths:
    M Source/WebCore/accessibility/AccessibilityObject.h
    M Source/WebCore/accessibility/AccessibilityRenderObject.h
    M Source/WebCore/accessibility/AccessibilityTable.cpp
    M Source/WebCore/accessibility/AccessibilityTable.h

  Log Message:
  -----------
  AX: AccessibilityTable should use m_role like every other AccessibilityObject subclass
https://bugs.webkit.org/show_bug.cgi?id=282136
rdar://138698416

Reviewed by Chris Fleizach.

Prior to this commit, every object besides AccessibilityTable initializes AccessibilityObject::m_role in
AccessibilityObject::init(), and has an implementation of roleValue() that simply returns this m_role. It's both
confusing and inefficient (for some reasons listed in the next paragraph) for AccessibilityTable to be the exception,
so this commit fixes that.

Fixing this is advantageous for performance in several ways:

  1. AccessibilityTable's override of `roleValue()` is now removed. This means that any time the compiler has a type of
     AccessibilityObject (rather than AXCoreObject), it can de-virtualize the `roleValue()` call. This is very important
     because roleValue() is called all over the place.

  2. AccessibilityTable::roleValue() is now cheaper, since it just reads from a member variable. Again, roleValue() is
     called all the time, so it's important that it's as cheap as possible.

  3. updateRoleAfterChildrenCreation() and updateRole() are now non-virtual, further improving the compiliers ability
     to perform optimizations.

This commit also includes a drive-by change to remove a redundant hasNonTableARIARole() check in computeIsTableExposableThroughAccessibility().
isDataTable() already checks this.

* Source/WebCore/accessibility/AccessibilityObject.h:
* Source/WebCore/accessibility/AccessibilityRenderObject.h:
* Source/WebCore/accessibility/AccessibilityTable.cpp:
(WebCore::AccessibilityTable::init):
(WebCore::AccessibilityTable::recomputeIsExposable):
(WebCore::AccessibilityTable::determineAccessibilityRole):
(WebCore::AccessibilityTable::computeIsTableExposableThroughAccessibility const): Deleted.
(WebCore::AccessibilityTable::roleValue const): Deleted.
* Source/WebCore/accessibility/AccessibilityTable.h:
(WebCore::AccessibilityTable::computeIsTableExposableThroughAccessibility const):

Canonical link: https://commits.webkit.org/285749@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list