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

Unified Diff: Source/modules/accessibility/AXLayoutObject.cpp

Issue 1007353002: Use NodeTraversal to iterate over the accessibility nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/modules/accessibility/AXNodeObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/accessibility/AXLayoutObject.cpp
diff --git a/Source/modules/accessibility/AXLayoutObject.cpp b/Source/modules/accessibility/AXLayoutObject.cpp
index f8581d371fb9f19c347fd61be7ed8ff824980bdb..4fe12bb83466203ac5c744888b02b22dcd6db3f6 100644
--- a/Source/modules/accessibility/AXLayoutObject.cpp
+++ b/Source/modules/accessibility/AXLayoutObject.cpp
@@ -2162,8 +2162,8 @@ void AXLayoutObject::addHiddenChildren()
// First do a quick run through to determine if we have any hidden nodes (most often we will not).
// If we do have hidden nodes, we need to determine where to insert them so they match DOM order as close as possible.
bool shouldInsertHiddenNodes = false;
- for (Node* child = node->firstChild(); child; child = child->nextSibling()) {
- if (!child->layoutObject() && isNodeAriaVisible(child)) {
+ for (Node& child : NodeTraversal::childrenOf(*node)) {
+ if (!child.layoutObject() && isNodeAriaVisible(&child)) {
shouldInsertHiddenNodes = true;
break;
}
@@ -2175,31 +2175,28 @@ void AXLayoutObject::addHiddenChildren()
// Iterate through all of the children, including those that may have already been added, and
// try to insert hidden nodes in the correct place in the DOM order.
unsigned insertionIndex = 0;
- for (Node* child = node->firstChild(); child; child = child->nextSibling()) {
- if (child->layoutObject()) {
+ for (Node& child : NodeTraversal::childrenOf(*node)) {
+ if (child.layoutObject()) {
// Find out where the last layout sibling is located within m_children.
- AXObject* childObject = axObjectCache()->get(child->layoutObject());
- if (childObject && childObject->accessibilityIsIgnored()) {
- const AccessibilityChildrenVector& children = childObject->children();
- if (children.size())
- childObject = children.last().get();
- else
- childObject = 0;
+ if (AXObject* childObject = axObjectCache()->get(child.layoutObject())) {
+ if (childObject->accessibilityIsIgnored()) {
+ const AccessibilityChildrenVector& children = childObject->children();
+ childObject = children.size() ? children.last().get() : 0;
+ }
+ if (childObject)
+ insertionIndex = m_children.find(childObject) + 1;
+ continue;
}
-
- if (childObject)
- insertionIndex = m_children.find(childObject) + 1;
- continue;
}
- if (!isNodeAriaVisible(child))
+ if (!isNodeAriaVisible(&child))
continue;
unsigned previousSize = m_children.size();
if (insertionIndex > previousSize)
insertionIndex = previousSize;
- insertChild(axObjectCache()->getOrCreate(child), insertionIndex);
+ insertChild(axObjectCache()->getOrCreate(&child), insertionIndex);
insertionIndex += (m_children.size() - previousSize);
}
}
« no previous file with comments | « no previous file | Source/modules/accessibility/AXNodeObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698