Changeset 287038 in webkit
- Timestamp:
- Dec 14, 2021, 11:59:26 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/accessibility/mac/ignore-redundant-accessibility-text-groups-expected.txt (modified) (2 diffs)
-
LayoutTests/accessibility/mac/ignore-redundant-accessibility-text-groups.html (modified) (7 diffs)
-
LayoutTests/accessibility/mac/ignore-redundant-groups-crash-expected.txt (added)
-
LayoutTests/accessibility/mac/ignore-redundant-groups-crash.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/accessibility/AccessibilityNodeObject.h (modified) (2 diffs)
-
Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r287029 r287038 1 2021-12-14 Tyler Wilcock <tyler_w@apple.com> 2 3 Web Inspector: test webpage keeps reloading when Inspector is open 4 https://bugs.webkit.org/show_bug.cgi?id=234076 5 6 Reviewed by Chris Fleizach. 7 8 This patch fixes the potential for infinite recursion introduced by 9 https://trac.webkit.org/changeset/284335/webkit. See corresponding 10 Source/WebCore/ChangeLog for full details. 11 12 * accessibility/mac/ignore-redundant-accessibility-text-groups-expected.txt: 13 * accessibility/mac/ignore-redundant-accessibility-text-groups.html: 14 Add an aria-describedby testcase. 15 16 * accessibility/mac/ignore-redundant-groups-crash-expected.txt: Added. 17 * accessibility/mac/ignore-redundant-groups-crash.html: 18 Added. Exercises the crash testcase raised in 19 https://bugs.webkit.org/show_bug.cgi?id=234076 along with other 20 branches in AccessibilityNodeObject::alternativeText to prevent future 21 problems. 22 1 23 2021-12-14 Brandon Stewart <brandonstewart@apple.com> 2 24 -
trunk/LayoutTests/accessibility/mac/ignore-redundant-accessibility-text-groups-expected.txt
r284335 r287038 8 8 PASS !ariaLabelDiv is true 9 9 PASS !titleDiv is true 10 PASS !ariaDescribedByDiv is true 10 11 PASS typeof clickHandlerGroup is 'object' 11 12 PASS typeof clickHandlerDiv is 'object' … … 14 15 PASS resultElement.role is 'AXRole: AXStaticText' 15 16 PASS resultElement.stringValue is 'AXValue: Oranges' 16 PASS contentContainer.childrenCount is 6 17 PASS resultElement.role is 'AXRole: AXStaticText' 18 PASS resultElement.stringValue is 'AXValue: Jello' 19 PASS resultElement.role is 'AXRole: AXStaticText' 20 PASS resultElement.stringValue is 'AXValue: Broccoli' 21 PASS contentContainer.childrenCount is 8 17 22 PASS contentContainer.childAtIndex(0).stringValue is 'AXValue: Blue cheese' 18 23 PASS contentContainer.childAtIndex(0).role is 'AXRole: AXStaticText' 19 24 PASS contentContainer.childAtIndex(1).stringValue is 'AXValue: Oranges' 20 25 PASS contentContainer.childAtIndex(1).role is 'AXRole: AXStaticText' 21 PASS contentContainer.childAtIndex(2).role is 'AXRole: AXGroup' 22 PASS contentContainer.childAtIndex(3).stringValue is 'AXValue: Jello' 26 PASS contentContainer.childAtIndex(2).stringValue is 'AXValue: Jello' 27 PASS contentContainer.childAtIndex(2).role is 'AXRole: AXStaticText' 28 PASS contentContainer.childAtIndex(3).stringValue is 'AXValue: Broccoli' 23 29 PASS contentContainer.childAtIndex(3).role is 'AXRole: AXStaticText' 24 PASS contentContainer.childAtIndex(4).stringValue is 'AXValue: Broccoli' 25 PASS contentContainer.childAtIndex(4).role is 'AXRole: AXStaticText' 26 PASS contentContainer.childAtIndex(5).role is 'AXRole: AXGroup' 30 Verifying #describer 31 PASS contentContainer.childAtIndex(4).role is 'AXRole: AXGroup' 32 PASS contentContainer.childAtIndex(5).stringValue is 'AXValue: Cheesecake' 33 PASS contentContainer.childAtIndex(5).role is 'AXRole: AXStaticText' 34 Verifying #click-handler-div 35 PASS contentContainer.childAtIndex(6).role is 'AXRole: AXGroup' 36 Verifying #click-handler-group 37 PASS contentContainer.childAtIndex(7).role is 'AXRole: AXGroup' 27 38 PASS successfullyParsed is true 28 39 -
trunk/LayoutTests/accessibility/mac/ignore-redundant-accessibility-text-groups.html
r284335 r287038 17 17 </div> 18 18 19 <div id="click-handler-group" role="group" aria-label="Group click handler" onclick="emptyClickHandler()">20 Group click handler21 </div>22 23 19 <!-- Also test role-less generic divs. --> 24 20 <div id="aria-label-div" aria-label="Jello"> … … 30 26 </div> 31 27 28 <div id="describer">Cheesecake</div> 29 <div id="aria-describedby-div" aria-describedby="describer"> 30 Cheesecake 31 </div> 32 32 33 <div id="click-handler-div" aria-label="Div click handler" onclick="emptyClickHandler()"> 33 34 Div click handler 35 </div> 36 37 <div id="click-handler-group" role="group" aria-label="Group click handler" onclick="emptyClickHandler()"> 38 Group click handler 34 39 </div> 35 40 </div> … … 40 45 41 46 if (window.accessibilityController) { 42 43 47 var contentContainer = accessibilityController.accessibleElementById("content"); 44 48 … … 50 54 var clickHandlerDiv = accessibilityController.accessibleElementById("click-handler-div"); 51 55 var titleDiv = accessibilityController.accessibleElementById("title-div"); 56 var ariaDescribedByDiv = accessibilityController.accessibleElementById("aria-describedby-div"); 52 57 53 58 // We shouldn't be able to get an accessible element for these groups because they should be ignored. … … 56 61 shouldBeTrue("!ariaLabelDiv"); 57 62 shouldBeTrue("!titleDiv"); 63 shouldBeTrue("!ariaDescribedByDiv"); 58 64 // But any group with an event handler should always be exposed. 59 65 shouldBe("typeof clickHandlerGroup", "'object'"); … … 69 75 shouldBe("resultElement.stringValue", "'AXValue: Oranges'"); 70 76 77 resultElement = contentContainer.uiElementForSearchPredicate(resultElement, true, "AXAnyTypeSearchKey", "", false); 78 shouldBe("resultElement.role", "'AXRole: AXStaticText'"); 79 shouldBe("resultElement.stringValue", "'AXValue: Jello'"); 80 81 resultElement = contentContainer.uiElementForSearchPredicate(resultElement, true, "AXAnyTypeSearchKey", "", false); 82 shouldBe("resultElement.role", "'AXRole: AXStaticText'"); 83 shouldBe("resultElement.stringValue", "'AXValue: Broccoli'"); 84 71 85 // Ensure the only accessible content exposed via `children` is the text elements and event handler groups. 72 shouldBe("contentContainer.childrenCount", " 6");86 shouldBe("contentContainer.childrenCount", "8"); 73 87 shouldBe("contentContainer.childAtIndex(0).stringValue", "'AXValue: Blue cheese'"); 74 88 shouldBe("contentContainer.childAtIndex(0).role", "'AXRole: AXStaticText'"); … … 77 91 shouldBe("contentContainer.childAtIndex(1).role", "'AXRole: AXStaticText'"); 78 92 79 shouldBe("contentContainer.childAtIndex(2).role", "'AXRole: AXGroup'"); 93 shouldBe("contentContainer.childAtIndex(2).stringValue", "'AXValue: Jello'"); 94 shouldBe("contentContainer.childAtIndex(2).role", "'AXRole: AXStaticText'"); 80 95 81 shouldBe("contentContainer.childAtIndex(3).stringValue", "'AXValue: Jello'");96 shouldBe("contentContainer.childAtIndex(3).stringValue", "'AXValue: Broccoli'"); 82 97 shouldBe("contentContainer.childAtIndex(3).role", "'AXRole: AXStaticText'"); 83 98 84 shouldBe("contentContainer.childAtIndex(4).stringValue", "'AXValue: Broccoli'");85 shouldBe("contentContainer.childAtIndex(4).role", "'AXRole: AX StaticText'");99 debug("Verifying #describer") 100 shouldBe("contentContainer.childAtIndex(4).role", "'AXRole: AXGroup'"); 86 101 87 shouldBe("contentContainer.childAtIndex(5).role", "'AXRole: AXGroup'"); 102 shouldBe("contentContainer.childAtIndex(5).stringValue", "'AXValue: Cheesecake'"); 103 shouldBe("contentContainer.childAtIndex(5).role", "'AXRole: AXStaticText'"); 104 105 debug("Verifying #click-handler-div") 106 shouldBe("contentContainer.childAtIndex(6).role", "'AXRole: AXGroup'"); 107 debug("Verifying #click-handler-group") 108 shouldBe("contentContainer.childAtIndex(7).role", "'AXRole: AXGroup'"); 88 109 89 110 document.getElementById("content").style.visibility = "hidden"; -
trunk/Source/WebCore/ChangeLog
r287036 r287038 1 2021-12-14 Tyler Wilcock <tyler_w@apple.com> 2 3 Web Inspector: test webpage keeps reloading when Inspector is open 4 https://bugs.webkit.org/show_bug.cgi?id=234076 5 6 Reviewed by Chris Fleizach. 7 8 https://trac.webkit.org/changeset/284335/webkit introduced the 9 potential for infinite recursion in AccessibilityObjectMac::shouldIgnoreGroup: 10 11 From accessibilityIsIgnored to computeAccessibilityIsIgnored to 12 defaultObjectInclusion to accessibilityPlatformIncludesObject to 13 shouldIgnoreGroup to accessibilityText to titleElementText to 14 exposesTitleUIElement to accessibilityIsIgnored to ... 15 16 shouldIgnoreGroup returns `true` if the group has one static text 17 child with the same content as the group's AX text. We fix the 18 recursion by making this check more conservative. 19 20 Rather than checking all of the AX text (which includes title text, alt text, help text, 21 visible text, placeholder text), only check the group's alt text and help text. This 22 accomplishes the original problem statement laid out in 23 https://bugs.webkit.org/show_bug.cgi?id=169924#c0 while avoiding 24 infinite recursion, as nothing in AccessibilityNodeObject::alternativeText or 25 AccessibilityNodeObject::helpText calls accessibilityIsIgnored. 26 27 Test: accessibility/mac/ignore-redundant-groups-crash.html 28 29 * accessibility/AccessibilityNodeObject.h: 30 Move alternativeText and helpText method definitions from private to public 31 so they can be called by the static shouldIgnoreGroup method in AccessibilityObjectMac. 32 * accessibility/mac/AccessibilityObjectMac.mm: 33 (WebCore::shouldIgnoreGroup): 34 Check only alt text and help text rather than all 35 AX text when deciding if a group should be ignored. 36 1 37 2021-12-14 Alan Bujtas <zalan@apple.com> 2 38 -
trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h
r285092 r287038 112 112 String title() const override; 113 113 String text() const override; 114 void alternativeText(Vector<AccessibilityText>&) const; 115 void helpText(Vector<AccessibilityText>&) const; 114 116 String stringValue() const override; 115 117 SRGBA<uint8_t> colorValue() const override; … … 181 183 bool isAccessibilityNodeObject() const final { return true; } 182 184 void accessibilityText(Vector<AccessibilityText>&) const override; 183 void alternativeText(Vector<AccessibilityText>&) const;184 185 void visibleText(Vector<AccessibilityText>&) const; 185 void helpText(Vector<AccessibilityText>&) const;186 186 String alternativeTextForWebArea() const; 187 187 void ariaLabeledByText(Vector<AccessibilityText>&) const; -
trunk/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm
r286406 r287038 120 120 return false; 121 121 122 // Never ignore a <div>with event listeners attached to it (e.g. onclick).122 // Never ignore a group with event listeners attached to it (e.g. onclick). 123 123 if (axObject.node() && axObject.node()->hasEventListeners()) 124 124 return false; … … 128 128 auto childString = first->stringValue(); 129 129 // stringValue() can be null if the underlying document needs style recalculation. 130 if (!childString.isNull() ) {130 if (!childString.isNull() && is<AccessibilityNodeObject>(axObject)) { 131 131 Vector<AccessibilityText> axText; 132 axObject.accessibilityText(axText); 133 // Don't expose <div>s whose only child is text that has the same content as the <div>s accessibility text. 134 // Instead, we should expose the text element directly. 132 auto& axNodeObject = downcast<AccessibilityNodeObject>(axObject); 133 axNodeObject.alternativeText(axText); 134 axNodeObject.helpText(axText); 135 // Ignore groups whose accessibility text is the same as their child's static-text content. 135 136 auto firstText = axText.size() ? axText[0].text : String(); 136 137 if (firstText == childString)
Note:
See TracChangeset
for help on using the changeset viewer.