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 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2155 // meaning that they should be exposed to the AX hierarchy. | 2155 // meaning that they should be exposed to the AX hierarchy. |
2156 void AXLayoutObject::addHiddenChildren() | 2156 void AXLayoutObject::addHiddenChildren() |
2157 { | 2157 { |
2158 Node* node = this->node(); | 2158 Node* node = this->node(); |
2159 if (!node) | 2159 if (!node) |
2160 return; | 2160 return; |
2161 | 2161 |
2162 // First do a quick run through to determine if we have any hidden nodes (mo
st often we will not). | 2162 // First do a quick run through to determine if we have any hidden nodes (mo
st often we will not). |
2163 // If we do have hidden nodes, we need to determine where to insert them so
they match DOM order as close as possible. | 2163 // If we do have hidden nodes, we need to determine where to insert them so
they match DOM order as close as possible. |
2164 bool shouldInsertHiddenNodes = false; | 2164 bool shouldInsertHiddenNodes = false; |
2165 for (Node* child = node->firstChild(); child; child = child->nextSibling())
{ | 2165 for (Node& child : NodeTraversal::childrenOf(*node)) { |
2166 if (!child->layoutObject() && isNodeAriaVisible(child)) { | 2166 if (!child.layoutObject() && isNodeAriaVisible(&child)) { |
2167 shouldInsertHiddenNodes = true; | 2167 shouldInsertHiddenNodes = true; |
2168 break; | 2168 break; |
2169 } | 2169 } |
2170 } | 2170 } |
2171 | 2171 |
2172 if (!shouldInsertHiddenNodes) | 2172 if (!shouldInsertHiddenNodes) |
2173 return; | 2173 return; |
2174 | 2174 |
2175 // Iterate through all of the children, including those that may have alread
y been added, and | 2175 // Iterate through all of the children, including those that may have alread
y been added, and |
2176 // try to insert hidden nodes in the correct place in the DOM order. | 2176 // try to insert hidden nodes in the correct place in the DOM order. |
2177 unsigned insertionIndex = 0; | 2177 unsigned insertionIndex = 0; |
2178 for (Node* child = node->firstChild(); child; child = child->nextSibling())
{ | 2178 for (Node& child : NodeTraversal::childrenOf(*node)) { |
2179 if (child->layoutObject()) { | 2179 if (child.layoutObject()) { |
2180 // Find out where the last layout sibling is located within m_childr
en. | 2180 // Find out where the last layout sibling is located within m_childr
en. |
2181 AXObject* childObject = axObjectCache()->get(child->layoutObject()); | 2181 if (AXObject* childObject = axObjectCache()->get(child.layoutObject(
))) { |
2182 if (childObject && childObject->accessibilityIsIgnored()) { | 2182 if (childObject->accessibilityIsIgnored()) { |
2183 const AccessibilityChildrenVector& children = childObject->child
ren(); | 2183 const AccessibilityChildrenVector& children = childObject->c
hildren(); |
2184 if (children.size()) | 2184 childObject = children.size() ? children.last().get() : 0; |
2185 childObject = children.last().get(); | 2185 } |
2186 else | 2186 if (childObject) |
2187 childObject = 0; | 2187 insertionIndex = m_children.find(childObject) + 1; |
| 2188 continue; |
2188 } | 2189 } |
2189 | |
2190 if (childObject) | |
2191 insertionIndex = m_children.find(childObject) + 1; | |
2192 continue; | |
2193 } | 2190 } |
2194 | 2191 |
2195 if (!isNodeAriaVisible(child)) | 2192 if (!isNodeAriaVisible(&child)) |
2196 continue; | 2193 continue; |
2197 | 2194 |
2198 unsigned previousSize = m_children.size(); | 2195 unsigned previousSize = m_children.size(); |
2199 if (insertionIndex > previousSize) | 2196 if (insertionIndex > previousSize) |
2200 insertionIndex = previousSize; | 2197 insertionIndex = previousSize; |
2201 | 2198 |
2202 insertChild(axObjectCache()->getOrCreate(child), insertionIndex); | 2199 insertChild(axObjectCache()->getOrCreate(&child), insertionIndex); |
2203 insertionIndex += (m_children.size() - previousSize); | 2200 insertionIndex += (m_children.size() - previousSize); |
2204 } | 2201 } |
2205 } | 2202 } |
2206 | 2203 |
2207 void AXLayoutObject::addTextFieldChildren() | 2204 void AXLayoutObject::addTextFieldChildren() |
2208 { | 2205 { |
2209 Node* node = this->node(); | 2206 Node* node = this->node(); |
2210 if (!isHTMLInputElement(node)) | 2207 if (!isHTMLInputElement(node)) |
2211 return; | 2208 return; |
2212 | 2209 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2411 if (label && label->layoutObject()) { | 2408 if (label && label->layoutObject()) { |
2412 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); | 2409 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); |
2413 result.unite(labelRect); | 2410 result.unite(labelRect); |
2414 } | 2411 } |
2415 } | 2412 } |
2416 | 2413 |
2417 return result; | 2414 return result; |
2418 } | 2415 } |
2419 | 2416 |
2420 } // namespace blink | 2417 } // namespace blink |
OLD | NEW |