OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 24 matching lines...) Expand all Loading... | |
35 #include "core/html/HTMLDListElement.h" | 35 #include "core/html/HTMLDListElement.h" |
36 #include "core/html/HTMLFieldSetElement.h" | 36 #include "core/html/HTMLFieldSetElement.h" |
37 #include "core/html/HTMLFrameElementBase.h" | 37 #include "core/html/HTMLFrameElementBase.h" |
38 #include "core/html/HTMLInputElement.h" | 38 #include "core/html/HTMLInputElement.h" |
39 #include "core/html/HTMLLabelElement.h" | 39 #include "core/html/HTMLLabelElement.h" |
40 #include "core/html/HTMLLegendElement.h" | 40 #include "core/html/HTMLLegendElement.h" |
41 #include "core/html/HTMLMediaElement.h" | 41 #include "core/html/HTMLMediaElement.h" |
42 #include "core/html/HTMLMeterElement.h" | 42 #include "core/html/HTMLMeterElement.h" |
43 #include "core/html/HTMLPlugInElement.h" | 43 #include "core/html/HTMLPlugInElement.h" |
44 #include "core/html/HTMLSelectElement.h" | 44 #include "core/html/HTMLSelectElement.h" |
45 #include "core/html/HTMLTableCellElement.h" | |
46 #include "core/html/HTMLTableElement.h" | |
47 #include "core/html/HTMLTableRowElement.h" | |
48 #include "core/html/HTMLTableSectionElement.h" | |
45 #include "core/html/HTMLTextAreaElement.h" | 49 #include "core/html/HTMLTextAreaElement.h" |
46 #include "core/html/parser/HTMLParserIdioms.h" | 50 #include "core/html/parser/HTMLParserIdioms.h" |
47 #include "core/html/shadow/MediaControlElements.h" | 51 #include "core/html/shadow/MediaControlElements.h" |
48 #include "core/layout/LayoutObject.h" | 52 #include "core/layout/LayoutObject.h" |
49 #include "modules/accessibility/AXObjectCacheImpl.h" | 53 #include "modules/accessibility/AXObjectCacheImpl.h" |
50 #include "platform/UserGestureIndicator.h" | 54 #include "platform/UserGestureIndicator.h" |
51 #include "wtf/text/StringBuilder.h" | 55 #include "wtf/text/StringBuilder.h" |
52 | 56 |
53 | 57 |
54 namespace blink { | 58 namespace blink { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 return true; | 180 return true; |
177 | 181 |
178 // Ignore labels that are already referenced by a control's title UI element . | 182 // Ignore labels that are already referenced by a control's title UI element . |
179 AXObject* controlObject = correspondingControlForLabelElement(); | 183 AXObject* controlObject = correspondingControlForLabelElement(); |
180 if (controlObject && !controlObject->exposesTitleUIElement() && controlObjec t->isCheckboxOrRadio()) | 184 if (controlObject && !controlObject->exposesTitleUIElement() && controlObjec t->isCheckboxOrRadio()) |
181 return true; | 185 return true; |
182 | 186 |
183 return m_role == UnknownRole; | 187 return m_role == UnknownRole; |
184 } | 188 } |
185 | 189 |
190 bool AXNodeObject::computeHasInheritedPresentationRole() const | |
191 { | |
192 // If it has none or presentation role explicitly by itself, return true. | |
dmazzoni
2015/03/31 16:35:23
I'd delete this comment - the code is clear by its
je_julie(Not used)
2015/04/01 12:51:28
Done.
| |
193 if (roleValue() == NoneRole || roleValue() == PresentationalRole) | |
194 return true; | |
195 | |
196 // ARIA states if an item can get focus, it should not be presentational. | |
197 if (canSetFocusAttribute()) | |
dmazzoni
2015/03/31 16:35:23
Should this be above? If an element is focusable I
je_julie(Not used)
2015/04/01 12:51:28
You're right!
| |
198 return false; | |
199 | |
200 // http://www.w3.org/TR/wai-aria/complete#presentation | |
201 // ARIA spec says that the user agent MUST apply an inherited role of presen tation | |
202 // to any owned elements that do not have an explicit role defined. | |
203 if (ariaRoleAttribute() != UnknownRole) | |
204 return false; | |
205 | |
206 AXObject* parent = parentObject(); | |
207 if (!parent) | |
208 return false; | |
209 | |
210 // The parent should have presentationalRole. | |
dmazzoni
2015/03/31 16:35:23
I think it's clear without this comment.
je_julie(Not used)
2015/04/01 12:51:28
Done.
| |
211 if (!isPresentationRole(parent) && !isPresentationRoleInTable(parent)) | |
212 return false; | |
213 | |
214 // ARIA spec says that when a parent object is presentational, and it has re quired owned elements, | |
dmazzoni
2015/03/31 16:35:24
How about: ARIA spec says that when a parent objec
je_julie(Not used)
2015/04/01 12:51:28
Good. Thanks!
| |
215 // those elements are also presentational. For example, <li> becomes present ational from <ul>. | |
216 return isRequiredOwnedElement(parent); | |
217 } | |
218 | |
186 AccessibilityRole AXNodeObject::determineAccessibilityRoleUtil() | 219 AccessibilityRole AXNodeObject::determineAccessibilityRoleUtil() |
187 { | 220 { |
188 if (!node()) | 221 if (!node()) |
189 return UnknownRole; | 222 return UnknownRole; |
190 if (node()->isLink()) | 223 if (node()->isLink()) |
191 return LinkRole; | 224 return LinkRole; |
192 if (isHTMLButtonElement(*node())) | 225 if (isHTMLButtonElement(*node())) |
193 return buttonRoleType(); | 226 return buttonRoleType(); |
194 if (isHTMLDetailsElement(*node())) | 227 if (isHTMLDetailsElement(*node())) |
195 return DetailsRole; | 228 return DetailsRole; |
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1993 { | 2026 { |
1994 float range = maxValueForRange() - minValueForRange(); | 2027 float range = maxValueForRange() - minValueForRange(); |
1995 float value = valueForRange(); | 2028 float value = valueForRange(); |
1996 | 2029 |
1997 value += range * (percentChange / 100); | 2030 value += range * (percentChange / 100); |
1998 setValue(String::number(value)); | 2031 setValue(String::number(value)); |
1999 | 2032 |
2000 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged) ; | 2033 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged) ; |
2001 } | 2034 } |
2002 | 2035 |
2036 bool AXNodeObject::isListElement(Node* node) const | |
dmazzoni
2015/03/31 16:35:23
This shouldn't be a member function since it's jus
je_julie(Not used)
2015/04/01 12:51:28
Done.
| |
2037 { | |
2038 return isHTMLUListElement(*node) || isHTMLOListElement(*node) || isHTMLDList Element(*node); | |
2039 } | |
2040 | |
2041 bool AXNodeObject::isPresentationRole(const AXObject* object) const | |
dmazzoni
2015/03/31 16:35:24
Same, looks like it should be static
je_julie(Not used)
2015/04/01 12:51:28
It's used on AXLayoutObject and AXListBoxOption.
S
| |
2042 { | |
2043 return object->roleValue() == NoneRole || object->roleValue() == Presentatio nalRole | |
2044 || object->hasInheritedPresentationRole(); | |
2045 } | |
2046 | |
2047 bool AXNodeObject::isPresentationRoleInTable(AXObject* parent) const | |
dmazzoni
2015/03/31 16:35:23
same?
je_julie(Not used)
2015/04/01 12:51:28
I added more parameter and changed it to static fu
| |
2048 { | |
2049 Node* parentNode = parent->node(); | |
2050 if (!parentNode || !parentNode->isElementNode()) | |
2051 return false; | |
2052 | |
2053 Node* curNode = node(); | |
2054 // AXTable determines the role as checking isTableXXX. | |
2055 // If Table has explicit role including presentation, AXTable doesn't assign implicit Role | |
2056 // to a whole Table. That's why we should check it based on node. | |
2057 // Normal Table Tree is that | |
2058 // cell(its role)-> tr(tr role)-> tfoot, tbody, thead(ignored role) -> table (table role). | |
2059 // If table has presentation role, it will be like | |
2060 // cell(group)-> tr(unknown) -> tfoot, tbody, thead(ignored) -> table(presen tation). | |
2061 if (isHTMLTableCellElement(curNode) && isHTMLTableRowElement(*parentNode)) | |
2062 return parent->hasInheritedPresentationRole(); | |
2063 | |
2064 if (isHTMLTableRowElement(curNode) && isHTMLTableSectionElement(*parentNode) ) { | |
2065 // Because TableSections have ignored role, presentation should be check ed with its parent node | |
2066 AXObject* tableObject = parent->parentObject(); | |
2067 Node* tableNode = tableObject->node(); | |
2068 return isHTMLTableElement(tableNode) && tableObject->hasInheritedPresent ationRole(); | |
2069 } | |
2070 return false; | |
2071 } | |
2072 | |
2073 bool AXNodeObject::isRequiredOwnedElement(AXObject* parent) const | |
dmazzoni
2015/03/31 16:35:23
same?
je_julie(Not used)
2015/04/01 12:51:28
I also added more parameter and changed it to stat
| |
2074 { | |
2075 Node* parentNode = parent->node(); | |
2076 if (!parentNode || !parentNode->isElementNode()) | |
2077 return false; | |
2078 | |
2079 AccessibilityRole role = roleValue(); | |
2080 | |
2081 if (role == ListItemRole) | |
2082 return isListElement(parentNode); | |
2083 if (role == ListMarkerRole) | |
2084 return isHTMLLIElement(*parentNode); | |
2085 if (role == MenuItemCheckBoxRole || role == MenuItemRole || role == MenuIt emRadioRole) | |
2086 return isHTMLMenuElement(*parentNode); | |
2087 | |
2088 Node* curNode = node(); | |
2089 if (isHTMLTableCellElement(curNode)) | |
2090 return isHTMLTableRowElement(*parentNode); | |
2091 if (isHTMLTableRowElement(curNode)) | |
2092 return isHTMLTableSectionElement(*parentNode); | |
2093 | |
2094 // In case of ListboxRole and it's child, ListBoxOptionRole, | |
2095 // Inheritance of presentation role is handled in AXListBoxOption | |
2096 // Because ListBoxOption Role doesn't have any child. | |
2097 // If it's just ignored because of presentation, we can't see any AX tree re lated to ListBoxOption. | |
2098 return false; | |
2099 } | |
2003 } // namespace blink | 2100 } // namespace blink |
OLD | NEW |