[Webkit-unassigned] [Bug 260174] AX: Fix multiple-label-input test in ITM mode

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 14 16:38:53 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=260174

Tyler Wilcock <tyler_w at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tyler_w at apple.com

--- Comment #3 from Tyler Wilcock <tyler_w at apple.com> ---
Comment on attachment 467272
  --> https://bugs.webkit.org/attachment.cgi?id=467272
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=467272&action=review

> Source/WebCore/accessibility/AXObjectCache.cpp:4091
> +            if (auto* axParent = notification.first->parentObject()) {
> +                if (axParent->isLabel() && axParent->correspondingControlForLabelElement())
> +                    updateNode(axParent->correspondingControlForLabelElement());

Let's use a RefPtr to protect usage of `axParent`, since we call axParent->correspondingControlForLabelElement() which does non-trivial work that could potentially destroy it. We can also use C++17-style multi-condition if-statements to make this more concise:

if (RefPtr axParent = notification.first->parentObject(); axParent && axParent->isLabel()) {
    if (RefPtr correspondingControl = axParent->correspondingControlForLabelElement())
        updateNode(axParent->correspondingControl.get());
}
break;

> Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:615
> +    if (axObject.isLabel() && axObject.correspondingControlForLabelElement())
> +        updateNode(*axObject.correspondingControlForLabelElement());

correspondingControlForLabelElement does a bit of work, so let's only call it once. Something like this might work:

if (RefPtr correspondingControl = axObject.isLabel() ? axObject.correspondingControlForLabelElement() : nullptr)
    updateNode(*correspondingControl);

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230814/93eaf859/attachment.htm>


More information about the webkit-unassigned mailing list