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

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

Issue 742353004: Implement computedRole and computedName (behind a flag) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update webexposed/element-instance-property-listing.html and add some SVG test cases Created 6 years 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.h » ('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 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 if (axObj) { 1364 if (axObj) {
1365 AccessibilityRole role = axObj->roleValue(); 1365 AccessibilityRole role = axObj->roleValue();
1366 if (role != GroupRole && role != UnknownRole) 1366 if (role != GroupRole && role != UnknownRole)
1367 break; 1367 break;
1368 } 1368 }
1369 } 1369 }
1370 1370
1371 return String(); 1371 return String();
1372 } 1372 }
1373 1373
1374 String AXNodeObject::computedName() const
1375 {
1376 String title = this->title();
1377
1378 String titleUIText;
1379 if (title.isEmpty()) {
1380 AXObject* titleUIElement = this->titleUIElement();
1381 if (titleUIElement) {
1382 titleUIText = titleUIElement->textUnderElement();
1383 if (!titleUIText.isEmpty())
1384 return titleUIText;
1385 }
1386 }
1387
1388 String description = accessibilityDescription();
1389 if (!description.isEmpty())
1390 return description;
1391
1392 if (!title.isEmpty())
1393 return title;
1394
1395 String placeholder;
1396 if (isHTMLInputElement(node())) {
1397 HTMLInputElement* element = toHTMLInputElement(node());
1398 placeholder = element->strippedPlaceholder();
1399 if (!placeholder.isEmpty())
1400 return placeholder;
1401 }
1402
1403 return String();
1404 }
1405
1406
1407
1374 LayoutRect AXNodeObject::elementRect() const 1408 LayoutRect AXNodeObject::elementRect() const
1375 { 1409 {
1376 // First check if it has a custom rect, for example if this element is tied to a canvas path. 1410 // First check if it has a custom rect, for example if this element is tied to a canvas path.
1377 if (!m_explicitElementRect.isEmpty()) 1411 if (!m_explicitElementRect.isEmpty())
1378 return m_explicitElementRect; 1412 return m_explicitElementRect;
1379 1413
1380 // FIXME: If there are a lot of elements in the canvas, it will be inefficie nt. 1414 // FIXME: If there are a lot of elements in the canvas, it will be inefficie nt.
1381 // We can avoid the inefficient calculations by using AXComputedObjectAttrib uteCache. 1415 // We can avoid the inefficient calculations by using AXComputedObjectAttrib uteCache.
1382 if (node()->parentElement()->isInCanvasSubtree()) { 1416 if (node()->parentElement()->isInCanvasSubtree()) {
1383 LayoutRect rect; 1417 LayoutRect rect;
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 float range = maxValueForRange() - minValueForRange(); 1871 float range = maxValueForRange() - minValueForRange();
1838 float value = valueForRange(); 1872 float value = valueForRange();
1839 1873
1840 value += range * (percentChange / 100); 1874 value += range * (percentChange / 100);
1841 setValue(String::number(value)); 1875 setValue(String::number(value));
1842 1876
1843 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged, true); 1877 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged, true);
1844 } 1878 }
1845 1879
1846 } // namespace blink 1880 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXNodeObject.h ('k') | Source/modules/accessibility/AXObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698