Changeset 231778 in webkit
- Timestamp:
- May 14, 2018, 5:32:06 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r231766 r231778 1 2018-05-14 Joanmarie Diggs <[email protected]> 2 3 AX: Listbox and Combobox roles embedded in labels should participate in name calculation 4 https://bugs.webkit.org/show_bug.cgi?id=185521 5 6 Reviewed by Chris Fleizach. 7 8 * accessibility/label-with-pseudo-elements-expected.txt: Updated for new behavior. 9 * accessibility/text-alternative-calculation-from-listbox-expected.txt: Added. 10 * accessibility/text-alternative-calculation-from-listbox.html: Added. 11 * platform/mac/accessibility/label-with-pseudo-elements-expected.txt: Updated for new behavior. 12 * platform/win/accessibility/label-with-pseudo-elements-expected.txt: Updated for new behavior. 13 1 14 2018-05-14 Antoine Quint <[email protected]> 2 15 -
trunk/LayoutTests/accessibility/label-with-pseudo-elements-expected.txt
r229682 r231778 25 25 AXTitleUIElement: null 26 26 27 AXTitle: 27 AXTitle: test 5 input value 28 28 AXDescription: 29 AXTitleUIElement: n on-null29 AXTitleUIElement: null 30 30 31 AXTitle: 31 AXTitle: before test 6 input value after 32 32 AXDescription: 33 AXTitleUIElement: n on-null33 AXTitleUIElement: null 34 34 35 35 PASS successfullyParsed is true -
trunk/LayoutTests/platform/mac/accessibility/label-with-pseudo-elements-expected.txt
r229682 r231778 29 29 AXTitleUIElement: null 30 30 31 AXTitle: 31 AXTitle: test 5 input value 32 32 AXDescription: 33 33 AXHelp: 34 AXTitleUIElement: n on-null34 AXTitleUIElement: null 35 35 36 AXTitle: 36 AXTitle: before test 6 input value after 37 37 AXDescription: 38 38 AXHelp: 39 AXTitleUIElement: n on-null39 AXTitleUIElement: null 40 40 41 41 PASS successfullyParsed is true -
trunk/LayoutTests/platform/win/accessibility/label-with-pseudo-elements-expected.txt
r229682 r231778 25 25 AXTitleUIElement: null 26 26 27 AXTitle: 27 AXTitle: test 5 input value 28 28 AXDescription: 29 AXTitleUIElement: n on-null29 AXTitleUIElement: null 30 30 31 AXTitle: 31 AXTitle: before test 6 input value after 32 32 AXDescription: 33 AXTitleUIElement: n on-null33 AXTitleUIElement: null 34 34 35 35 PASS successfullyParsed is true -
trunk/Source/WebCore/ChangeLog
r231766 r231778 1 2018-05-14 Joanmarie Diggs <[email protected]> 2 3 AX: Listbox and Combobox roles embedded in labels should participate in name calculation 4 https://bugs.webkit.org/show_bug.cgi?id=185521 5 6 Reviewed by Chris Fleizach. 7 8 Take selected children into account when computing the name in accessibleNameForNode. 9 Add ListBox to the roles for which accessibleNameDerivesFromContent returns false so 10 that native select elements with size > 1 are treated the same way as ARIA listbox. 11 Also add ListBox to the roles which are treated as controls when used in ARIA. Finally, 12 prevent labels which contain unrelated controls from being used as an AXTitleUIElement. 13 This causes us to build a string from the label and its descendants, ensuring the latter 14 participate in the name calculation. 15 16 Test: accessibility/text-alternative-calculation-from-listbox.html 17 18 * accessibility/AccessibilityLabel.cpp: 19 (WebCore::childrenContainUnrelatedControls): 20 (WebCore::AccessibilityLabel::containsUnrelatedControls const): 21 * accessibility/AccessibilityLabel.h: 22 * accessibility/AccessibilityNodeObject.cpp: 23 (WebCore::accessibleNameForNode): 24 * accessibility/AccessibilityObject.cpp: 25 (WebCore::AccessibilityObject::accessibleNameDerivesFromContent const): 26 (WebCore::AccessibilityObject::isARIAControl): 27 * accessibility/AccessibilityRenderObject.cpp: 28 (WebCore::AccessibilityRenderObject::exposesTitleUIElement const): 29 (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const): 30 1 31 2018-05-14 Antoine Quint <[email protected]> 2 32 -
trunk/Source/WebCore/accessibility/AccessibilityLabel.cpp
r224074 r231778 84 84 } 85 85 86 static bool childrenContainUnrelatedControls(const AccessibilityObject::AccessibilityChildrenVector& children, AccessibilityObject* controlForLabel) 87 { 88 if (!children.size()) 89 return false; 90 91 for (const auto& child : children) { 92 if (child->isControl()) { 93 if (child == controlForLabel) 94 continue; 95 return true; 96 } 97 98 if (childrenContainUnrelatedControls(child->children(), controlForLabel)) 99 return true; 100 } 101 102 return false; 103 } 104 105 bool AccessibilityLabel::containsUnrelatedControls() const 106 { 107 if (containsOnlyStaticText()) 108 return false; 109 110 return childrenContainUnrelatedControls(m_children, correspondingControlForLabelElement()); 111 } 112 86 113 void AccessibilityLabel::updateChildrenIfNecessary() 87 114 { -
trunk/Source/WebCore/accessibility/AccessibilityLabel.h
r224074 r231778 39 39 40 40 bool containsOnlyStaticText() const; 41 bool containsUnrelatedControls() const; 41 42 42 43 private: -
trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp
r231627 r231778 1953 1953 if (!valueDescription.isEmpty()) 1954 1954 return valueDescription; 1955 1956 // The Accname specification states that if the name is being calculated for a combobox 1957 // or listbox inside a labeling element, return the text alternative of the chosen option. 1958 AccessibilityObject::AccessibilityChildrenVector children; 1959 if (axObject->isListBox()) 1960 axObject->selectedChildren(children); 1961 else if (axObject->isComboBox()) { 1962 for (const auto& child : axObject->children()) { 1963 if (child->isListBox()) { 1964 child->selectedChildren(children); 1965 break; 1966 } 1967 } 1968 } 1969 1970 StringBuilder builder; 1971 String childText; 1972 for (const auto& child : children) 1973 appendNameToStringBuilder(builder, accessibleNameForNode(child->node())); 1974 1975 childText = builder.toString(); 1976 if (!childText.isEmpty()) 1977 return childText; 1955 1978 } 1956 1979 -
trunk/Source/WebCore/accessibility/AccessibilityObject.cpp
r231720 r231778 355 355 switch (roleValue()) { 356 356 case AccessibilityRole::Slider: 357 case AccessibilityRole::ListBox: 357 358 return false; 358 359 default: … … 906 907 bool AccessibilityObject::isARIAControl(AccessibilityRole ariaRole) 907 908 { 908 return isARIAInput(ariaRole) || ariaRole == AccessibilityRole::TextArea || ariaRole == AccessibilityRole::Button || ariaRole == AccessibilityRole::ComboBox || ariaRole == AccessibilityRole::Slider ;909 return isARIAInput(ariaRole) || ariaRole == AccessibilityRole::TextArea || ariaRole == AccessibilityRole::Button || ariaRole == AccessibilityRole::ComboBox || ariaRole == AccessibilityRole::Slider || ariaRole == AccessibilityRole::ListBox; 909 910 } 910 911 -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r229310 r231778 32 32 #include "AXObjectCache.h" 33 33 #include "AccessibilityImageMapLink.h" 34 #include "AccessibilityLabel.h" 34 35 #include "AccessibilityListBox.h" 35 36 #include "AccessibilitySVGRoot.h" … … 1065 1066 if (!labelObject->ariaLabeledByAttribute().isEmpty()) 1066 1067 return false; 1068 // To simplify instances where the labeling element includes widget descendants 1069 // which it does not label. 1070 if (is<AccessibilityLabel>(*labelObject) 1071 && downcast<AccessibilityLabel>(*labelObject).containsUnrelatedControls()) 1072 return false; 1067 1073 } 1068 1074 } … … 1205 1211 return true; 1206 1212 1207 // find out if this element is inside of a label element.1208 // if so, it may be ignored because it's the label for a checkbox or radio button1209 AccessibilityObject* controlObject = correspondingControlForLabelElement();1210 if (controlObject && !controlObject->exposesTitleUIElement() && controlObject->isCheckboxOrRadio())1211 return true;1212 1213 1213 // https://webkit.org/b/161276 Getting the controlObject might cause the m_renderer to be nullptr. 1214 1214 if (!m_renderer) … … 1416 1416 if (m_renderer->isRubyRun() || m_renderer->isRubyBlock() || m_renderer->isRubyInline()) 1417 1417 return false; 1418 1419 // Find out if this element is inside of a label element. 1420 // If so, it may be ignored because it's the label for a checkbox or radio button. 1421 AccessibilityObject* controlObject = correspondingControlForLabelElement(); 1422 if (controlObject && !controlObject->exposesTitleUIElement() && controlObject->isCheckboxOrRadio()) 1423 return true; 1418 1424 1419 1425 // By default, objects should be ignored so that the AX hierarchy is not
Note:
See TracChangeset
for help on using the changeset viewer.