Changeset 184676 in webkit
- Timestamp:
- May 20, 2015 4:42:08 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r184675 r184676 1 2015-05-20 Chris Fleizach <cfleizach@apple.com> 2 3 AX: improve list heuristics (presentational use versus actual lists) 4 https://bugs.webkit.org/show_bug.cgi?id=134187 5 6 Reviewed by Darin Adler. 7 8 * accessibility/list-detection-expected.txt: 9 * accessibility/list-detection.html: 10 * accessibility/list-detection2-expected.txt: Added. 11 * accessibility/list-detection2.html: Added. 12 1 13 2015-05-20 Antti Koivisto <antti@apple.com> 2 14 -
trunk/LayoutTests/accessibility/list-detection-expected.txt
r167052 r184676 36 36 37 37 38 Unordered list with more than 1 item and no style is a list.39 PASS axElement.role == 'AXRole: AXList' is true38 Unordered list with more than 1 item and no style is not a list. 39 PASS axElement.role == 'AXRole: AXList' is false 40 40 41 41 -
trunk/LayoutTests/accessibility/list-detection.html
r178912 r184676 41 41 </ul> 42 42 43 <ul id="list9" style="list-style-type: none;" test-description="Unordered list with more than 1 item and no style is a list." is-list="true">43 <ul id="list9" style="list-style-type: none;" test-description="Unordered list with more than 1 item and no style is not a list." is-list="false"> 44 44 <li>item</li> 45 45 <li>item</li> -
trunk/Source/WebCore/ChangeLog
r184675 r184676 1 2015-05-20 Chris Fleizach <cfleizach@apple.com> 2 3 AX: improve list heuristics (presentational use versus actual lists) 4 https://bugs.webkit.org/show_bug.cgi?id=134187 5 6 Reviewed by Darin Adler. 7 8 Improve heuristics for list detection by: 9 1. Not exposing lists without list markers (unless explicitly marked as lists) 10 2. Recognizing css: before-content as list markers 11 12 Test: accessibility/list-detection2.html 13 14 * accessibility/AccessibilityList.cpp: 15 (WebCore::AccessibilityList::isDescriptionList): 16 (WebCore::AccessibilityList::childHasPseudoVisibleListItemMarkers): 17 (WebCore::AccessibilityList::determineAccessibilityRole): 18 * accessibility/AccessibilityList.h: 19 1 20 2015-05-20 Antti Koivisto <antti@apple.com> 2 21 -
trunk/Source/WebCore/accessibility/AccessibilityList.cpp
r177733 r184676 33 33 #include "HTMLElement.h" 34 34 #include "HTMLNames.h" 35 #include "PseudoElement.h" 35 36 #include "RenderListItem.h" 36 37 #include "RenderObject.h" … … 98 99 } 99 100 101 bool AccessibilityList::childHasPseudoVisibleListItemMarkers(RenderObject* listItem) 102 { 103 // Check if the list item has a pseudo-element that should be accessible (e.g. an image or text) 104 Element* listItemElement = downcast<Element>(listItem->node()); 105 if (!listItemElement || !listItemElement->beforePseudoElement()) 106 return false; 107 108 AccessibilityObject* axObj = axObjectCache()->getOrCreate(listItemElement->beforePseudoElement()->renderer()); 109 if (!axObj) 110 return false; 111 112 if (!axObj->accessibilityIsIgnored()) 113 return true; 114 115 for (const auto& child : axObj->children()) { 116 if (!child->accessibilityIsIgnored()) 117 return true; 118 } 119 120 return false; 121 } 122 100 123 AccessibilityRole AccessibilityList::determineAccessibilityRole() 101 124 { … … 132 155 else if (child->roleValue() == ListItemRole) { 133 156 RenderObject* listItem = child->renderer(); 134 if (listItem && listItem->isListItem()) { 135 if (listItem->style().listStyleType() != NoneListStyle || listItem->style().listStyleImage()) 157 if (!listItem) 158 continue; 159 160 // Rendered list items always count. 161 if (listItem->isListItem()) { 162 if (!hasVisibleMarkers && (listItem->style().listStyleType() != NoneListStyle || listItem->style().listStyleImage() || childHasPseudoVisibleListItemMarkers(listItem))) 136 163 hasVisibleMarkers = true; 137 164 listItemCount++; 165 } else if (listItem->node() && listItem->node()->hasTagName(liTag)) { 166 // Inline elements that are in a list with an explicit role should also count. 167 if (m_ariaRole == ListRole) 168 listItemCount++; 169 170 if (childHasPseudoVisibleListItemMarkers(listItem)) { 171 hasVisibleMarkers = true; 172 listItemCount++; 173 } 138 174 } 139 175 } 140 176 } 141 177 142 bool unorderedList = isUnorderedList();143 178 // Non <ul> lists and ARIA lists only need to have one child. 144 // <ul> lists need to have 1 child, orvisible markers.145 if ( !unorderedList ||ariaRoleAttribute() != UnknownRole) {179 // <ul>, <ol> lists need to have visible markers. 180 if (ariaRoleAttribute() != UnknownRole) { 146 181 if (!listItemCount) 147 182 role = GroupRole; 148 } else if ( unorderedList && listItemCount <= 1 &&!hasVisibleMarkers)183 } else if (!hasVisibleMarkers) 149 184 role = GroupRole; 150 185 -
trunk/Source/WebCore/accessibility/AccessibilityList.h
r177733 r184676 50 50 virtual bool computeAccessibilityIsIgnored() const override; 51 51 virtual AccessibilityRole determineAccessibilityRole() override; 52 bool childHasPseudoVisibleListItemMarkers(RenderObject*); 52 53 }; 53 54
Note: See TracChangeset
for help on using the changeset viewer.