[webkit-changes] [WebKit/WebKit] 6dbdd5: AX: RenderSVGInlineText accessibility objects are ...

Tyler Wilcock noreply at github.com
Sat Oct 26 16:12:16 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6dbdd5c6af9bf00c4f131bd0616f6ec9ad10d6c8
      https://github.com/WebKit/WebKit/commit/6dbdd5c6af9bf00c4f131bd0616f6ec9ad10d6c8
  Author: Tyler Wilcock <tyler_w at apple.com>
  Date:   2024-10-26 (Sat, 26 Oct 2024)

  Changed paths:
    M Source/WebCore/SaferCPPExpectations/UncountedCallArgsCheckerExpectations
    M Source/WebCore/SaferCPPExpectations/UncountedLocalVarsCheckerExpectations
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/accessibility/AXObjectCache.cpp
    R Source/WebCore/accessibility/AccessibilitySVGElement.cpp
    R Source/WebCore/accessibility/AccessibilitySVGElement.h
    A Source/WebCore/accessibility/AccessibilitySVGObject.cpp
    A Source/WebCore/accessibility/AccessibilitySVGObject.h
    M Source/WebCore/accessibility/AccessibilitySVGRoot.cpp
    M Source/WebCore/accessibility/AccessibilitySVGRoot.h

  Log Message:
  -----------
  AX: RenderSVGInlineText accessibility objects are created in the wrong AXObjectCache
https://bugs.webkit.org/show_bug.cgi?id=282028
rdar://138534253

Reviewed by Chris Fleizach.

In https://bugs.webkit.org/show_bug.cgi?id=247316, we largely addressed the problem where SVG objects were created
in the `AXObjectCache` associated with their `Document`, rather than the `Document` that contains the canonical
`AXObjectCache`, which is the top document.

There was one case we missed, however. Prior to this commit, we only created `AccessibilitySVGElement`s in this condition:

```
if (is<SVGElement>(node))
    return AccessibilitySVGObject::create(renderer, this);
```

Critically, `RenderSVGInlineText`s are not `SVGElement` subclasses. Instead, they subclass `RenderText`. Fix this by
making `RenderSVGInlineText`s created as `AccessibilitySVGElement`s, ensuring they have the the right `::axObjectCache()`
override.

This fixes an ASSERT we've been hitting in ITM for a long time in accessibility/add-children-pseudo-element.html:

https://github.com/WebKit/WebKit/blob/aeacdd2cd7d9d2d77cc232b524975ee2f0815191/Source/WebCore/accessibility/AccessibilityObject.cpp#L689

`ASSERT(isTableComponent(*child) || isTableComponent(*this) || child->parentObject() == this);`

This commit also renames `AccessibilitySVGElement` to `AccessibilitySVGObject`. `AccessibilitySVGElement` was confusing
before this patch ("element" overrides a "renderer" class (`AccessibilityRenderObject`), which overrides a "node" class (`AccessibilityNodeObject`)).
But it now would've been especially confusing, since we now may have `AccessibilitySVGObject`s that don't have an element,
just a text node. `AccessibilitySVGObject` is more appropriate and matches the naming scheme for all our other objects.

* Source/WebCore/SaferCPPExpectations/UncountedCallArgsCheckerExpectations:
* Source/WebCore/SaferCPPExpectations/UncountedLocalVarsCheckerExpectations:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::createObjectFromRenderer):
* Source/WebCore/accessibility/AccessibilitySVGObject.cpp: Renamed from Source/WebCore/accessibility/AccessibilitySVGElement.cpp.
(WebCore::AccessibilitySVGObject::AccessibilitySVGObject):
(WebCore::AccessibilitySVGObject::create):
(WebCore::AccessibilitySVGObject::targetForUseElement const):
(WebCore::AccessibilitySVGObject::childElementWithMatchingLanguage const):
(WebCore::AccessibilitySVGObject::accessibilityText const):
(WebCore::AccessibilitySVGObject::description const):
(WebCore::AccessibilitySVGObject::helpText const):
(WebCore::AccessibilitySVGObject::hasTitleOrDescriptionChild const):
(WebCore::AccessibilitySVGObject::computeIsIgnored const):
(WebCore::AccessibilitySVGObject::inheritsPresentationalRole const):
(WebCore::AccessibilitySVGObject::determineAriaRoleAttribute const):
(WebCore::AccessibilitySVGObject::determineAccessibilityRole):
* Source/WebCore/accessibility/AccessibilitySVGObject.h: Renamed from Source/WebCore/accessibility/AccessibilitySVGElement.h.
* Source/WebCore/accessibility/AccessibilitySVGRoot.cpp:
(WebCore::AccessibilitySVGRoot::AccessibilitySVGRoot):
(WebCore::AccessibilitySVGRoot::parentObject const):
* Source/WebCore/accessibility/AccessibilitySVGRoot.h:

Canonical link: https://commits.webkit.org/285730@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