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

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

Issue 1019313003: Use c++11 range loops in accessibility (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 | « Source/modules/accessibility/AXNodeObject.cpp ('k') | Source/modules/accessibility/AXTable.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/accessibility/AXObject.cpp
diff --git a/Source/modules/accessibility/AXObject.cpp b/Source/modules/accessibility/AXObject.cpp
index f5cd5277653bcf7d39b8ee6be823cef3b425d883..8af2fc0cb6475942dbba7db1f7415c6fe5354771 100644
--- a/Source/modules/accessibility/AXObject.cpp
+++ b/Source/modules/accessibility/AXObject.cpp
@@ -535,17 +535,13 @@ bool AXObject::supportsRangeValue() const
void AXObject::ariaTreeRows(AccessibilityChildrenVector& result)
{
- const AccessibilityChildrenVector& axChildren = children();
- unsigned count = axChildren.size();
- for (unsigned k = 0; k < count; ++k) {
- AXObject* obj = axChildren[k].get();
-
+ for (const auto& child : children()) {
// Add tree items as the rows.
- if (obj->roleValue() == TreeItemRole)
- result.append(obj);
+ if (child->roleValue() == TreeItemRole)
+ result.append(child);
// Now see if this item also has rows hiding inside of it.
- obj->ariaTreeRows(result);
+ child->ariaTreeRows(result);
}
}
@@ -587,8 +583,8 @@ bool AXObject::containerLiveRegionBusy() const
void AXObject::markCachedElementRectDirty() const
{
- for (unsigned i = 0; i < m_children.size(); ++i)
- m_children[i].get()->markCachedElementRectDirty();
+ for (const auto& child : m_children)
+ child->markCachedElementRectDirty();
}
IntPoint AXObject::clickPoint()
@@ -630,10 +626,9 @@ AXObject* AXObject::elementAccessibilityHitTest(const IntPoint& point) const
}
// Check if there are any mock elements that need to be handled.
- size_t count = m_children.size();
- for (size_t k = 0; k < count; k++) {
- if (m_children[k]->isMockObject() && m_children[k]->elementRect().contains(point))
- return m_children[k]->elementAccessibilityHitTest(point);
+ for (const auto& child : m_children) {
+ if (child->isMockObject() && child->elementRect().contains(point))
+ return child->elementAccessibilityHitTest(point);
}
return const_cast<AXObject*>(this);
@@ -686,9 +681,8 @@ void AXObject::updateChildrenIfNecessary()
void AXObject::clearChildren()
{
// Detach all weak pointers from objects to their parents.
- size_t length = m_children.size();
- for (size_t i = 0; i < length; i++)
- m_children[i]->detachFromParent();
+ for (const auto& child : m_children)
+ child->detachFromParent();
m_children.clear();
m_haveChildren = false;
@@ -1046,10 +1040,8 @@ AccessibilityRole AXObject::ariaRoleToWebCoreRole(const String& value)
Vector<String> roleVector;
value.split(' ', roleVector);
AccessibilityRole role = UnknownRole;
- unsigned size = roleVector.size();
- for (unsigned i = 0; i < size; ++i) {
- String roleName = roleVector[i];
- role = roleMap->get(roleName);
+ for (const auto& child : roleVector) {
+ role = roleMap->get(child);
if (role)
return role;
}
@@ -1093,10 +1085,8 @@ bool AXObject::includesARIAWidgetRole(const String& role)
Vector<String> roleVector;
role.split(' ', roleVector);
- unsigned size = roleVector.size();
- for (unsigned i = 0; i < size; ++i) {
- String roleName = roleVector[i];
- if (roleSet->contains(roleName))
+ for (const auto& child : roleVector) {
+ if (roleSet->contains(child))
return true;
}
return false;
« no previous file with comments | « Source/modules/accessibility/AXNodeObject.cpp ('k') | Source/modules/accessibility/AXTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698