Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(584)

Side by Side Diff: Source/modules/accessibility/AXNodeObject.cpp

Issue 887643003: Changed accessibility properies to meet W3C standard. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 if (type == InputTypeNames::range) 234 if (type == InputTypeNames::range)
235 return SliderRole; 235 return SliderRole;
236 if (type == InputTypeNames::color) 236 if (type == InputTypeNames::color)
237 return ColorWellRole; 237 return ColorWellRole;
238 if (type == InputTypeNames::time) 238 if (type == InputTypeNames::time)
239 return TimeRole; 239 return TimeRole;
240 return TextFieldRole; 240 return TextFieldRole;
241 } 241 }
242 if (isHTMLSelectElement(*node())) { 242 if (isHTMLSelectElement(*node())) {
243 HTMLSelectElement& selectElement = toHTMLSelectElement(*node()); 243 HTMLSelectElement& selectElement = toHTMLSelectElement(*node());
244 return selectElement.multiple() ? ListBoxRole : PopUpButtonRole; 244 return (selectElement.multiple() || selectElement.size() > 1) ? ListBoxR ole : PopUpButtonRole;
245 } 245 }
246 if (isHTMLTextAreaElement(*node())) 246 if (isHTMLTextAreaElement(*node()))
247 return TextAreaRole; 247 return TextAreaRole;
248 if (headingLevel()) 248 if (headingLevel())
249 return HeadingRole; 249 return HeadingRole;
250 if (isHTMLDivElement(*node())) 250 if (isHTMLDivElement(*node()))
251 return DivRole; 251 return DivRole;
252 if (isHTMLMeterElement(*node())) 252 if (isHTMLMeterElement(*node()))
253 return MeterRole; 253 return MeterRole;
254 if (isHTMLOutputElement(*node())) 254 if (isHTMLOutputElement(*node()))
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 1183
1184 if (isHTMLSelectElement(*node)) { 1184 if (isHTMLSelectElement(*node)) {
1185 HTMLSelectElement& selectElement = toHTMLSelectElement(*node); 1185 HTMLSelectElement& selectElement = toHTMLSelectElement(*node);
1186 int selectedIndex = selectElement.selectedIndex(); 1186 int selectedIndex = selectElement.selectedIndex();
1187 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = sel ectElement.listItems(); 1187 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = sel ectElement.listItems();
1188 if (selectedIndex >= 0 && static_cast<size_t>(selectedIndex) < listItems .size()) { 1188 if (selectedIndex >= 0 && static_cast<size_t>(selectedIndex) < listItems .size()) {
1189 const AtomicString& overriddenDescription = listItems[selectedIndex] ->fastGetAttribute(aria_labelAttr); 1189 const AtomicString& overriddenDescription = listItems[selectedIndex] ->fastGetAttribute(aria_labelAttr);
1190 if (!overriddenDescription.isNull()) 1190 if (!overriddenDescription.isNull())
1191 return overriddenDescription; 1191 return overriddenDescription;
1192 } 1192 }
1193 if (!selectElement.multiple()) 1193 return selectElement.value();
1194 return selectElement.value();
1195 return String();
1196 } 1194 }
1197 1195
1198 if (isTextControl()) 1196 if (isTextControl())
1199 return text(); 1197 return text();
1200 1198
1199 // Handle other HTML input elements that aren't text controls, like date and time
1200 // controls, by returning the string value, with the exception of checkboxes
1201 // and radio buttons (which would return "on").
1202 if (node && isHTMLInputElement(node)) {
1203 HTMLInputElement* input = toHTMLInputElement(node);
1204 if (input->type() != InputTypeNames::checkbox && input->type() != InputT ypeNames::radio)
1205 return input->value();
dmazzoni 2015/01/29 16:28:29 Thanks, this change looks good.
1206 }
1207
1201 // FIXME: We might need to implement a value here for more types 1208 // FIXME: We might need to implement a value here for more types
1202 // FIXME: It would be better not to advertise a value at all for the types f or which we don't implement one; 1209 // FIXME: It would be better not to advertise a value at all for the types f or which we don't implement one;
1203 // this would require subclassing or making accessibilityAttributeNames do s omething other than return a 1210 // this would require subclassing or making accessibilityAttributeNames do s omething other than return a
1204 // single static array. 1211 // single static array.
1205 return String(); 1212 return String();
1206 } 1213 }
1207 1214
1208 1215
1209 const AtomicString& AXNodeObject::textInputType() const 1216 const AtomicString& AXNodeObject::textInputType() const
1210 { 1217 {
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 float range = maxValueForRange() - minValueForRange(); 1980 float range = maxValueForRange() - minValueForRange();
1974 float value = valueForRange(); 1981 float value = valueForRange();
1975 1982
1976 value += range * (percentChange / 100); 1983 value += range * (percentChange / 100);
1977 setValue(String::number(value)); 1984 setValue(String::number(value));
1978 1985
1979 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged, true); 1986 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged, true);
1980 } 1987 }
1981 1988
1982 } // namespace blink 1989 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698