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

Unified Diff: ui/accessibility/ax_position.h

Issue 2930273002: Use ContainsValue() instead of std::find() in ui/accessibility, ui/gl and ui/ozone (Closed)
Patch Set: Rebase patch Created 3 years, 6 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 | ui/accessibility/ax_tree_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/accessibility/ax_position.h
diff --git a/ui/accessibility/ax_position.h b/ui/accessibility/ax_position.h
index 8886b1f833d15763cb975a0481fd0b485fab2afa..c38d9511128976a2f0f726799a4a89ff6c464d06 100644
--- a/ui/accessibility/ax_position.h
+++ b/ui/accessibility/ax_position.h
@@ -7,13 +7,13 @@
#include <stdint.h>
-#include <algorithm>
#include <memory>
#include <stack>
#include <string>
#include <utility>
#include <vector>
+#include "base/stl_util.h"
#include "base/strings/string16.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
@@ -238,10 +238,8 @@ class AXPosition {
case AXPositionKind::TEXT_POSITION: {
const std::vector<int32_t> word_starts =
text_position->GetWordStartOffsets();
- auto iterator =
- std::find(word_starts.begin(), word_starts.end(),
- static_cast<int32_t>(text_position->text_offset_));
- return iterator != word_starts.end();
+ return base::ContainsValue(
+ word_starts, static_cast<int32_t>(text_position->text_offset_));
}
}
return false;
@@ -258,10 +256,8 @@ class AXPosition {
case AXPositionKind::TEXT_POSITION: {
const std::vector<int32_t> word_ends =
text_position->GetWordEndOffsets();
- auto iterator =
- std::find(word_ends.begin(), word_ends.end(),
- static_cast<int32_t>(text_position->text_offset_));
- return iterator != word_ends.end();
+ return base::ContainsValue(
+ word_ends, static_cast<int32_t>(text_position->text_offset_));
}
}
return false;
« no previous file with comments | « no previous file | ui/accessibility/ax_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698