| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple 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 2228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2239 | 2239 |
| 2240 // If the object is in a tree, only tree items should be exposed (and the ch
ildren of tree items). | 2240 // If the object is in a tree, only tree items should be exposed (and the ch
ildren of tree items). |
| 2241 if (treeAncestor) { | 2241 if (treeAncestor) { |
| 2242 AccessibilityRole role = roleValue(); | 2242 AccessibilityRole role = roleValue(); |
| 2243 if (role != TreeItemRole && role != StaticTextRole) | 2243 if (role != TreeItemRole && role != StaticTextRole) |
| 2244 return treeAncestor; | 2244 return treeAncestor; |
| 2245 } | 2245 } |
| 2246 return 0; | 2246 return 0; |
| 2247 } | 2247 } |
| 2248 | 2248 |
| 2249 void AXLayoutObject::ariaListboxSelectedChildren(AccessibilityChildrenVector& re
sult) | |
| 2250 { | |
| 2251 bool isMulti = isMultiSelectable(); | |
| 2252 | |
| 2253 for (const auto& child : children()) { | |
| 2254 // Every child should have aria-role option, and if so, check for select
ed attribute/state. | |
| 2255 if (child->isSelected() && child->ariaRoleAttribute() == ListBoxOptionRo
le) { | |
| 2256 result.append(child); | |
| 2257 if (!isMulti) | |
| 2258 return; | |
| 2259 } | |
| 2260 } | |
| 2261 } | |
| 2262 | |
| 2263 bool AXLayoutObject::nodeIsTextControl(const Node* node) const | 2249 bool AXLayoutObject::nodeIsTextControl(const Node* node) const |
| 2264 { | 2250 { |
| 2265 if (!node) | 2251 if (!node) |
| 2266 return false; | 2252 return false; |
| 2267 | 2253 |
| 2268 const AXObject* axObjectForNode = axObjectCache().getOrCreate(const_cast<Nod
e*>(node)); | 2254 const AXObject* axObjectForNode = axObjectCache().getOrCreate(const_cast<Nod
e*>(node)); |
| 2269 if (!axObjectForNode) | 2255 if (!axObjectForNode) |
| 2270 return false; | 2256 return false; |
| 2271 | 2257 |
| 2272 return axObjectForNode->isTextControl(); | 2258 return axObjectForNode->isTextControl(); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2547 root->setParent(this); | 2533 root->setParent(this); |
| 2548 | 2534 |
| 2549 if (root->accessibilityIsIgnored()) { | 2535 if (root->accessibilityIsIgnored()) { |
| 2550 for (const auto& child : root->children()) | 2536 for (const auto& child : root->children()) |
| 2551 m_children.append(child); | 2537 m_children.append(child); |
| 2552 } else { | 2538 } else { |
| 2553 m_children.append(root); | 2539 m_children.append(root); |
| 2554 } | 2540 } |
| 2555 } | 2541 } |
| 2556 | 2542 |
| 2557 void AXLayoutObject::ariaSelectedRows(AccessibilityChildrenVector& result) | |
| 2558 { | |
| 2559 // Get all the rows. | |
| 2560 AccessibilityChildrenVector allRows; | |
| 2561 if (isTree()) | |
| 2562 ariaTreeRows(allRows); | |
| 2563 else if (isAXTable() && toAXTable(this)->supportsSelectedRows()) | |
| 2564 allRows = toAXTable(this)->rows(); | |
| 2565 | |
| 2566 // Determine which rows are selected. | |
| 2567 bool isMulti = isMultiSelectable(); | |
| 2568 | |
| 2569 // Prefer active descendant over aria-selected. | |
| 2570 AXObject* activeDesc = activeDescendant(); | |
| 2571 if (activeDesc && (activeDesc->isTreeItem() || activeDesc->isTableRow())) { | |
| 2572 result.append(activeDesc); | |
| 2573 if (!isMulti) | |
| 2574 return; | |
| 2575 } | |
| 2576 | |
| 2577 for (const auto& row : allRows) { | |
| 2578 if (row->isSelected()) { | |
| 2579 result.append(row); | |
| 2580 if (!isMulti) | |
| 2581 break; | |
| 2582 } | |
| 2583 } | |
| 2584 } | |
| 2585 | |
| 2586 bool AXLayoutObject::elementAttributeValue(const QualifiedName& attributeName) c
onst | 2543 bool AXLayoutObject::elementAttributeValue(const QualifiedName& attributeName) c
onst |
| 2587 { | 2544 { |
| 2588 if (!m_layoutObject) | 2545 if (!m_layoutObject) |
| 2589 return false; | 2546 return false; |
| 2590 | 2547 |
| 2591 return equalIgnoringCase(getAttribute(attributeName), "true"); | 2548 return equalIgnoringCase(getAttribute(attributeName), "true"); |
| 2592 } | 2549 } |
| 2593 | 2550 |
| 2594 LayoutRect AXLayoutObject::computeElementRect() const | 2551 LayoutRect AXLayoutObject::computeElementRect() const |
| 2595 { | 2552 { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2635 if (label && label->layoutObject()) { | 2592 if (label && label->layoutObject()) { |
| 2636 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); | 2593 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); |
| 2637 result.unite(labelRect); | 2594 result.unite(labelRect); |
| 2638 } | 2595 } |
| 2639 } | 2596 } |
| 2640 | 2597 |
| 2641 return result; | 2598 return result; |
| 2642 } | 2599 } |
| 2643 | 2600 |
| 2644 } // namespace blink | 2601 } // namespace blink |
| OLD | NEW |