| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 if (!isAXTable()) { | 86 if (!isAXTable()) { |
| 87 AXLayoutObject::addChildren(); | 87 AXLayoutObject::addChildren(); |
| 88 return; | 88 return; |
| 89 } | 89 } |
| 90 | 90 |
| 91 m_haveChildren = true; | 91 m_haveChildren = true; |
| 92 if (!m_layoutObject) | 92 if (!m_layoutObject) |
| 93 return; | 93 return; |
| 94 | 94 |
| 95 Vector<AXObject*> children; |
| 96 for (AXObject* child = firstChild(); child; child = child->nextSibling()) |
| 97 children.append(child); |
| 98 computeAriaOwnsChildren(children); |
| 99 |
| 95 AXObjectCacheImpl& axCache = axObjectCache(); | 100 AXObjectCacheImpl& axCache = axObjectCache(); |
| 96 | 101 |
| 97 // add only rows that are labeled as aria rows | 102 // add only rows that are labeled as aria rows |
| 98 HashSet<AXObject*> appendedRows; | 103 HashSet<AXObject*> appendedRows; |
| 99 unsigned columnCount = 0; | 104 unsigned columnCount = 0; |
| 100 for (RefPtr<AXObject> child = firstChild(); child; child = child->nextSiblin
g()) { | 105 for (const auto& child : children) { |
| 101 | 106 if (!addTableCellChild(child, appendedRows, columnCount)) { |
| 102 if (!addTableCellChild(child.get(), appendedRows, columnCount)) { | |
| 103 | 107 |
| 104 // in case the layout tree doesn't match the expected ARIA hierarchy
, look at the children | 108 // in case the layout tree doesn't match the expected ARIA hierarchy
, look at the children |
| 105 if (!child->hasChildren()) | 109 if (!child->hasChildren()) |
| 106 child->addChildren(); | 110 child->addChildren(); |
| 107 | 111 |
| 108 // The children of this non-row will contain all non-ignored element
s (recursing to find them). | 112 // The children of this non-row will contain all non-ignored element
s (recursing to find them). |
| 109 // This allows the table to dive arbitrarily deep to find the rows. | 113 // This allows the table to dive arbitrarily deep to find the rows. |
| 110 for (const auto& childObject : child->children()) | 114 for (const auto& childObject : child->children()) |
| 111 addTableCellChild(childObject.get(), appendedRows, columnCount); | 115 addTableCellChild(childObject.get(), appendedRows, columnCount); |
| 112 } | 116 } |
| 113 } | 117 } |
| 114 | 118 |
| 115 // make the columns based on the number of columns in the first body | 119 // make the columns based on the number of columns in the first body |
| 116 for (unsigned i = 0; i < columnCount; ++i) { | 120 for (unsigned i = 0; i < columnCount; ++i) { |
| 117 AXTableColumn* column = toAXTableColumn(axCache.getOrCreate(ColumnRole))
; | 121 AXTableColumn* column = toAXTableColumn(axCache.getOrCreate(ColumnRole))
; |
| 118 column->setColumnIndex((int)i); | 122 column->setColumnIndex((int)i); |
| 119 column->setParent(this); | 123 column->setParent(this); |
| 120 m_columns.append(column); | 124 m_columns.append(column); |
| 121 if (!column->accessibilityIsIgnored()) | 125 if (!column->accessibilityIsIgnored()) |
| 122 m_children.append(column); | 126 m_children.append(column); |
| 123 } | 127 } |
| 124 | 128 |
| 125 AXObject* headerContainerObject = headerContainer(); | 129 AXObject* headerContainerObject = headerContainer(); |
| 126 if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored(
)) | 130 if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored(
)) |
| 127 m_children.append(headerContainerObject); | 131 m_children.append(headerContainerObject); |
| 128 } | 132 } |
| 129 | 133 |
| 130 } // namespace blink | 134 } // namespace blink |
| OLD | NEW |