Changeset 284612 in webkit


Ignore:
Timestamp:
Oct 21, 2021, 9:49:44 AM (4 years ago)
Author:
commit-queue@webkit.org
Message:

AX: Remove redundant insert of autofill button child in AccessibilityRenderObject::addTextFieldChildren
https://bugs.webkit.org/show_bug.cgi?id=232033

Patch by Tyler Wilcock <Tyler Wilcock> on 2021-10-21
Reviewed by Chris Fleizach.

Source/WebCore:

Autofill buttons are represented in the DOM, so there's no reason
to also insert it in AccessibilityRenderObject::addTextFieldChildren.
This results in duplicate objects for this button in the AX tree.

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::addTextFieldChildren):
Remove redundant insertion of autofill button element into the
accessibility tree.

LayoutTests:

  • accessibility/auto-fill-crash-expected.txt:
  • accessibility/auto-fill-crash.html:
  • platform/glib/accessibility/auto-fill-crash-expected.txt:

Expect one less child because we no longer insert a redundant button
into the accessibility tree. Also add an expectation confirming the
autofill button is actually a part of the accessibility tree.

  • platform/win/accessibility/auto-fill-crash-expected.txt: Added.
Location:
trunk
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r284611 r284612  
     12021-10-21  Tyler Wilcock  <tyler_w@apple.com>
     2
     3        AX: Remove redundant insert of autofill button child in AccessibilityRenderObject::addTextFieldChildren
     4        https://bugs.webkit.org/show_bug.cgi?id=232033
     5
     6        Reviewed by Chris Fleizach.
     7
     8        * accessibility/auto-fill-crash-expected.txt:
     9        * accessibility/auto-fill-crash.html:
     10        * platform/glib/accessibility/auto-fill-crash-expected.txt:
     11        Expect one less child because we no longer insert a redundant button
     12        into the accessibility tree. Also add an expectation confirming the
     13        autofill button is actually a part of the accessibility tree.
     14        * platform/win/accessibility/auto-fill-crash-expected.txt: Added.
     15
    1162021-10-21  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/LayoutTests/accessibility/auto-fill-crash-expected.txt

    r198769 r284612  
    55
    66
    7 PASS accessibilityController.accessibleElementById('textfield').childrenCount is 3
    8 PASS accessibilityController.accessibleElementById('textfield').childrenCount is 1
     7PASS textFieldAxObject.childrenCount is 2
     8PASS textFieldAxObject.childAtIndex(childrenCountExpected - 1).description is 'AXDescription: contact info AutoFill'
     9PASS textFieldAxObject.childrenCount is 1
    910PASS successfullyParsed is true
    1011
  • trunk/LayoutTests/accessibility/auto-fill-crash.html

    r225707 r284612  
    1818    if (window.accessibilityController) {
    1919        var axTextField = accessibilityController.accessibleElementById("textfield");
    20         var childrenCountExpected = accessibilityController.platformName == "atk" ? "2" : "3";
     20        var childrenCountExpected = accessibilityController.platformName == "atk" ? "1" : "2";
    2121        window.internals.setShowAutoFillButton(document.getElementById("textfield"), "Contacts");
    22         shouldBe("accessibilityController.accessibleElementById('textfield').childrenCount", childrenCountExpected);
     22        var textFieldAxObject = accessibilityController.accessibleElementById('textfield');
     23        shouldBe("textFieldAxObject.childrenCount", childrenCountExpected);
     24        // Verify the autofill button is represented in the accessibility tree.
     25        shouldBe("textFieldAxObject.childAtIndex(childrenCountExpected - 1).description", "'AXDescription: contact info AutoFill'");
     26
     27        var platform = accessibilityController.platformName;
     28        // Windows expects 2 children.
     29        childrenCountExpected = "2";
     30        if (platform == "mac" || platform == "ios")
     31            childrenCountExpected = "1"
     32        else if (platform == "atk")
     33            childrenCountExpected = "0"
    2334
    2435        // Don't crash!
    25         childrenCountExpected = accessibilityController.platformName == "atk" ? "0" : "1";
    2636        window.internals.setShowAutoFillButton(document.getElementById("textfield"), "None");
    27         shouldBe("accessibilityController.accessibleElementById('textfield').childrenCount", childrenCountExpected);
     37        shouldBe("textFieldAxObject.childrenCount", childrenCountExpected);
    2838    }
    2939
  • trunk/LayoutTests/platform/glib/accessibility/auto-fill-crash-expected.txt

    r261701 r284612  
    55
    66
    7 PASS accessibilityController.accessibleElementById('textfield').childrenCount is 2
    8 PASS accessibilityController.accessibleElementById('textfield').childrenCount is 0
     7PASS textFieldAxObject.childrenCount is 1
     8PASS textFieldAxObject.childAtIndex(childrenCountExpected - 1).description is 'AXDescription: contact info AutoFill'
     9PASS textFieldAxObject.childrenCount is 0
    910PASS successfullyParsed is true
    1011
  • trunk/LayoutTests/platform/win/accessibility/auto-fill-crash-expected.txt

    r284611 r284612  
    55
    66
    7 PASS accessibilityController.accessibleElementById('textfield').childrenCount is 3
    8 PASS accessibilityController.accessibleElementById('textfield').childrenCount is 1
     7PASS textFieldAxObject.childrenCount is 2
     8PASS textFieldAxObject.childAtIndex(childrenCountExpected - 1).description is 'AXDescription: contact info AutoFill'
     9PASS textFieldAxObject.childrenCount is 2
    910PASS successfullyParsed is true
    1011
  • trunk/Source/WebCore/ChangeLog

    r284606 r284612  
     12021-10-21  Tyler Wilcock  <tyler_w@apple.com>
     2
     3        AX: Remove redundant insert of autofill button child in AccessibilityRenderObject::addTextFieldChildren
     4        https://bugs.webkit.org/show_bug.cgi?id=232033
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Autofill buttons are represented in the DOM, so there's no reason
     9        to also insert it in AccessibilityRenderObject::addTextFieldChildren.
     10        This results in duplicate objects for this button in the AX tree.
     11
     12        * accessibility/AccessibilityRenderObject.cpp:
     13        (WebCore::AccessibilityRenderObject::addTextFieldChildren):
     14        Remove redundant insertion of autofill button element into the
     15        accessibility tree.
     16
    1172021-10-21  Tyler Wilcock  <tyler_w@apple.com>
    218
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r284606 r284612  
    33043304        return;
    33053305   
    3306     HTMLInputElement& input = downcast<HTMLInputElement>(*node);
    3307     if (HTMLElement* autoFillElement = input.autoFillButtonElement()) {
    3308         if (AccessibilityObject* axAutoFill = axObjectCache()->getOrCreate(autoFillElement))
    3309             m_children.append(axAutoFill);
    3310     }
    3311    
    3312     HTMLElement* spinButtonElement = input.innerSpinButtonElement();
     3306    HTMLElement* spinButtonElement = downcast<HTMLInputElement>(*node).innerSpinButtonElement();
    33133307    if (!is<SpinButtonElement>(spinButtonElement))
    33143308        return;
Note: See TracChangeset for help on using the changeset viewer.