| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 if (type == InputTypeNames::range) | 235 if (type == InputTypeNames::range) |
| 236 return SliderRole; | 236 return SliderRole; |
| 237 if (type == InputTypeNames::color) | 237 if (type == InputTypeNames::color) |
| 238 return ColorWellRole; | 238 return ColorWellRole; |
| 239 if (type == InputTypeNames::time) | 239 if (type == InputTypeNames::time) |
| 240 return TimeRole; | 240 return TimeRole; |
| 241 return TextFieldRole; | 241 return TextFieldRole; |
| 242 } | 242 } |
| 243 if (isHTMLSelectElement(*node())) { | 243 if (isHTMLSelectElement(*node())) { |
| 244 HTMLSelectElement& selectElement = toHTMLSelectElement(*node()); | 244 HTMLSelectElement& selectElement = toHTMLSelectElement(*node()); |
| 245 return selectElement.multiple() ? ListBoxRole : PopUpButtonRole; | 245 return (selectElement.multiple() || selectElement.size() > 1) ? ListBoxR
ole : PopUpButtonRole; |
| 246 } | 246 } |
| 247 if (isHTMLTextAreaElement(*node())) | 247 if (isHTMLTextAreaElement(*node())) |
| 248 return TextAreaRole; | 248 return TextAreaRole; |
| 249 if (headingLevel()) | 249 if (headingLevel()) |
| 250 return HeadingRole; | 250 return HeadingRole; |
| 251 if (isHTMLDivElement(*node())) | 251 if (isHTMLDivElement(*node())) |
| 252 return DivRole; | 252 return DivRole; |
| 253 if (isHTMLMeterElement(*node())) | 253 if (isHTMLMeterElement(*node())) |
| 254 return MeterRole; | 254 return MeterRole; |
| 255 if (isHTMLOutputElement(*node())) | 255 if (isHTMLOutputElement(*node())) |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 | 1174 |
| 1175 if (isHTMLSelectElement(*node)) { | 1175 if (isHTMLSelectElement(*node)) { |
| 1176 HTMLSelectElement& selectElement = toHTMLSelectElement(*node); | 1176 HTMLSelectElement& selectElement = toHTMLSelectElement(*node); |
| 1177 int selectedIndex = selectElement.selectedIndex(); | 1177 int selectedIndex = selectElement.selectedIndex(); |
| 1178 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = sel
ectElement.listItems(); | 1178 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = sel
ectElement.listItems(); |
| 1179 if (selectedIndex >= 0 && static_cast<size_t>(selectedIndex) < listItems
.size()) { | 1179 if (selectedIndex >= 0 && static_cast<size_t>(selectedIndex) < listItems
.size()) { |
| 1180 const AtomicString& overriddenDescription = listItems[selectedIndex]
->fastGetAttribute(aria_labelAttr); | 1180 const AtomicString& overriddenDescription = listItems[selectedIndex]
->fastGetAttribute(aria_labelAttr); |
| 1181 if (!overriddenDescription.isNull()) | 1181 if (!overriddenDescription.isNull()) |
| 1182 return overriddenDescription; | 1182 return overriddenDescription; |
| 1183 } | 1183 } |
| 1184 if (!selectElement.multiple()) | 1184 return selectElement.value(); |
| 1185 return selectElement.value(); | |
| 1186 return String(); | |
| 1187 } | 1185 } |
| 1188 | 1186 |
| 1189 if (isTextControl()) | 1187 if (isTextControl()) |
| 1190 return text(); | 1188 return text(); |
| 1191 | 1189 |
| 1190 // Handle other HTML input elements that aren't text controls, like date and
time |
| 1191 // controls, by returning the string value, with the exception of checkboxes |
| 1192 // and radio buttons (which would return "on"). |
| 1193 if (node && isHTMLInputElement(node)) { |
| 1194 HTMLInputElement* input = toHTMLInputElement(node); |
| 1195 if (input->type() != InputTypeNames::checkbox && input->type() != InputT
ypeNames::radio) |
| 1196 return input->value(); |
| 1197 } |
| 1198 |
| 1192 // FIXME: We might need to implement a value here for more types | 1199 // FIXME: We might need to implement a value here for more types |
| 1193 // FIXME: It would be better not to advertise a value at all for the types f
or which we don't implement one; | 1200 // FIXME: It would be better not to advertise a value at all for the types f
or which we don't implement one; |
| 1194 // this would require subclassing or making accessibilityAttributeNames do s
omething other than return a | 1201 // this would require subclassing or making accessibilityAttributeNames do s
omething other than return a |
| 1195 // single static array. | 1202 // single static array. |
| 1196 return String(); | 1203 return String(); |
| 1197 } | 1204 } |
| 1198 | 1205 |
| 1199 | 1206 |
| 1200 const AtomicString& AXNodeObject::textInputType() const | 1207 const AtomicString& AXNodeObject::textInputType() const |
| 1201 { | 1208 { |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1992 float range = maxValueForRange() - minValueForRange(); | 1999 float range = maxValueForRange() - minValueForRange(); |
| 1993 float value = valueForRange(); | 2000 float value = valueForRange(); |
| 1994 | 2001 |
| 1995 value += range * (percentChange / 100); | 2002 value += range * (percentChange / 100); |
| 1996 setValue(String::number(value)); | 2003 setValue(String::number(value)); |
| 1997 | 2004 |
| 1998 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged,
true); | 2005 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged,
true); |
| 1999 } | 2006 } |
| 2000 | 2007 |
| 2001 } // namespace blink | 2008 } // namespace blink |
| OLD | NEW |