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

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

Issue 1346733002: Added layout test for aria-orientation and cleaned up code. Also exposed hr element with an orienta… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added TableRole back with a TODO to fix the relevant bug. Created 5 years, 3 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
« no previous file with comments | « Source/modules/accessibility/AXNodeObject.h ('k') | Source/modules/accessibility/AXObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 493
494 if (node()->hasTagName(figureTag)) 494 if (node()->hasTagName(figureTag))
495 return FigureRole; 495 return FigureRole;
496 496
497 if (node()->nodeName() == "TIME") 497 if (node()->nodeName() == "TIME")
498 return TimeRole; 498 return TimeRole;
499 499
500 if (isEmbeddedObject()) 500 if (isEmbeddedObject())
501 return EmbeddedObjectRole; 501 return EmbeddedObjectRole;
502 502
503 if (isHTMLHRElement(*node()))
504 return SplitterRole;
505
503 return UnknownRole; 506 return UnknownRole;
504 } 507 }
505 508
506 AccessibilityRole AXNodeObject::determineAccessibilityRole() 509 AccessibilityRole AXNodeObject::determineAccessibilityRole()
507 { 510 {
508 if (!node()) 511 if (!node())
509 return UnknownRole; 512 return UnknownRole;
510 513
511 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole) 514 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole)
512 return m_ariaRole; 515 return m_ariaRole;
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 HTMLInputElement* inputElement = toHTMLInputElement(node()); 1251 HTMLInputElement* inputElement = toHTMLInputElement(node());
1249 placeholder = inputElement->strippedPlaceholder(); 1252 placeholder = inputElement->strippedPlaceholder();
1250 } else if (isHTMLTextAreaElement(*node())) { 1253 } else if (isHTMLTextAreaElement(*node())) {
1251 HTMLTextAreaElement* textAreaElement = toHTMLTextAreaElement(node()) ; 1254 HTMLTextAreaElement* textAreaElement = toHTMLTextAreaElement(node()) ;
1252 placeholder = textAreaElement->strippedPlaceholder(); 1255 placeholder = textAreaElement->strippedPlaceholder();
1253 } 1256 }
1254 } 1257 }
1255 return placeholder; 1258 return placeholder;
1256 } 1259 }
1257 1260
1261 AccessibilityOrientation AXNodeObject::orientation() const
1262 {
1263 const AtomicString& ariaOrientation = getAttribute(aria_orientationAttr);
1264 AccessibilityOrientation orientation = AccessibilityOrientationUndefined;
1265 if (equalIgnoringCase(ariaOrientation, "horizontal"))
1266 orientation = AccessibilityOrientationHorizontal;
1267 else if (equalIgnoringCase(ariaOrientation, "vertical"))
1268 orientation = AccessibilityOrientationVertical;
1269
1270 switch (roleValue()) {
1271 case ComboBoxRole:
1272 case ListBoxRole:
1273 case MenuRole:
1274 case ScrollBarRole:
1275 case TreeRole:
1276 if (orientation == AccessibilityOrientationUndefined)
1277 orientation = AccessibilityOrientationVertical;
1278
1279 return orientation;
1280 case MenuBarRole:
1281 case SliderRole:
1282 case SplitterRole:
1283 case TabListRole:
1284 case ToolbarRole:
1285 if (orientation == AccessibilityOrientationUndefined)
1286 orientation = AccessibilityOrientationHorizontal;
1287
1288 return orientation;
1289 case RadioGroupRole:
1290 case TreeGridRole:
1291 // TODO(nektar): Fix bug 532670 and remove table role.
1292 case TableRole:
1293 return orientation;
1294 default:
1295 return AXObject::orientation();
1296 }
1297 }
1298
1258 String AXNodeObject::text() const 1299 String AXNodeObject::text() const
1259 { 1300 {
1260 // If this is a user defined static text, use the accessible name computatio n. 1301 // If this is a user defined static text, use the accessible name computatio n.
1261 if (ariaRoleAttribute() == StaticTextRole) 1302 if (ariaRoleAttribute() == StaticTextRole)
1262 return ariaAccessibilityDescription(); 1303 return ariaAccessibilityDescription();
1263 1304
1264 if (!isTextControl()) 1305 if (!isTextControl())
1265 return String(); 1306 return String();
1266 1307
1267 Node* node = this->node(); 1308 Node* node = this->node();
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after
2784 return textAlternative; 2825 return textAlternative;
2785 } 2826 }
2786 2827
2787 DEFINE_TRACE(AXNodeObject) 2828 DEFINE_TRACE(AXNodeObject)
2788 { 2829 {
2789 visitor->trace(m_node); 2830 visitor->trace(m_node);
2790 AXObject::trace(visitor); 2831 AXObject::trace(visitor);
2791 } 2832 }
2792 2833
2793 } // namespace blink 2834 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXNodeObject.h ('k') | Source/modules/accessibility/AXObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698