| 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 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1469 if (isTextControl()) | 1469 if (isTextControl()) |
| 1470 return text(); | 1470 return text(); |
| 1471 | 1471 |
| 1472 // FIXME: We might need to implement a value here for more types | 1472 // FIXME: We might need to implement a value here for more types |
| 1473 // FIXME: It would be better not to advertise a value at all for the types f
or which we don't implement one; | 1473 // FIXME: It would be better not to advertise a value at all for the types f
or which we don't implement one; |
| 1474 // this would require subclassing or making accessibilityAttributeNames do s
omething other than return a | 1474 // this would require subclassing or making accessibilityAttributeNames do s
omething other than return a |
| 1475 // single static array. | 1475 // single static array. |
| 1476 return String(); | 1476 return String(); |
| 1477 } | 1477 } |
| 1478 | 1478 |
| 1479 | |
| 1480 const AtomicString& AXNodeObject::textInputType() const | |
| 1481 { | |
| 1482 Node* node = this->node(); | |
| 1483 if (!isHTMLInputElement(node)) | |
| 1484 return nullAtom; | |
| 1485 | |
| 1486 HTMLInputElement& input = toHTMLInputElement(*node); | |
| 1487 if (input.isTextField()) | |
| 1488 return input.type(); | |
| 1489 return nullAtom; | |
| 1490 } | |
| 1491 | |
| 1492 String AXNodeObject::ariaDescribedByAttribute() const | 1479 String AXNodeObject::ariaDescribedByAttribute() const |
| 1493 { | 1480 { |
| 1494 WillBeHeapVector<RawPtrWillBeMember<Element>> elements; | 1481 WillBeHeapVector<RawPtrWillBeMember<Element>> elements; |
| 1495 elementsFromAttribute(elements, aria_describedbyAttr); | 1482 elementsFromAttribute(elements, aria_describedbyAttr); |
| 1496 | 1483 |
| 1497 return accessibilityDescriptionForElements(elements); | 1484 return accessibilityDescriptionForElements(elements); |
| 1498 } | 1485 } |
| 1499 | 1486 |
| 1500 const AtomicString& AXNodeObject::ariaDropEffect() const | |
| 1501 { | |
| 1502 return getAttribute(aria_dropeffectAttr); | |
| 1503 } | |
| 1504 | |
| 1505 String AXNodeObject::ariaLabeledByAttribute() const | 1487 String AXNodeObject::ariaLabeledByAttribute() const |
| 1506 { | 1488 { |
| 1507 WillBeHeapVector<RawPtrWillBeMember<Element>> elements; | 1489 WillBeHeapVector<RawPtrWillBeMember<Element>> elements; |
| 1508 ariaLabeledByElements(elements); | 1490 ariaLabeledByElements(elements); |
| 1509 | 1491 |
| 1510 return accessibilityDescriptionForElements(elements); | 1492 return accessibilityDescriptionForElements(elements); |
| 1511 } | 1493 } |
| 1512 | 1494 |
| 1513 AccessibilityRole AXNodeObject::ariaRoleAttribute() const | 1495 AccessibilityRole AXNodeObject::ariaRoleAttribute() const |
| 1514 { | 1496 { |
| 1515 return m_ariaRole; | 1497 return m_ariaRole; |
| 1516 } | 1498 } |
| 1517 | 1499 |
| 1518 AccessibilityOptionalBool AXNodeObject::isAriaGrabbed() const | |
| 1519 { | |
| 1520 const AtomicString& grabbed = getAttribute(aria_grabbedAttr); | |
| 1521 if (equalIgnoringCase(grabbed, "true")) | |
| 1522 return OptionalBoolTrue; | |
| 1523 if (equalIgnoringCase(grabbed, "false")) | |
| 1524 return OptionalBoolFalse; | |
| 1525 | |
| 1526 return OptionalBoolUndefined; | |
| 1527 } | |
| 1528 | |
| 1529 // When building the textUnderElement for an object, determine whether or not | 1500 // When building the textUnderElement for an object, determine whether or not |
| 1530 // we should include the inner text of this given descendant object or skip it. | 1501 // we should include the inner text of this given descendant object or skip it. |
| 1531 static bool shouldUseAccessibilityObjectInnerText(AXObject* obj) | 1502 static bool shouldUseAccessibilityObjectInnerText(AXObject* obj) |
| 1532 { | 1503 { |
| 1533 // Consider this hypothetical example: | 1504 // Consider this hypothetical example: |
| 1534 // <div tabindex=0> | 1505 // <div tabindex=0> |
| 1535 // <h2> | 1506 // <h2> |
| 1536 // Table of contents | 1507 // Table of contents |
| 1537 // </h2> | 1508 // </h2> |
| 1538 // <a href="#start">Jump to start of book</a> | 1509 // <a href="#start">Jump to start of book</a> |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2385 ariaLabeledByElements(elements); | 2356 ariaLabeledByElements(elements); |
| 2386 | 2357 |
| 2387 for (const auto& element : elements) { | 2358 for (const auto& element : elements) { |
| 2388 RefPtr<AXObject> axElement = axObjectCache()->getOrCreate(element); | 2359 RefPtr<AXObject> axElement = axObjectCache()->getOrCreate(element); |
| 2389 textOrder.append(AccessibilityText(ariaLabeledBy, AlternativeText, a
xElement)); | 2360 textOrder.append(AccessibilityText(ariaLabeledBy, AlternativeText, a
xElement)); |
| 2390 } | 2361 } |
| 2391 } | 2362 } |
| 2392 } | 2363 } |
| 2393 | 2364 |
| 2394 } // namespace blink | 2365 } // namespace blink |
| OLD | NEW |