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

Unified Diff: third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp

Issue 2553343002: Avoid WTF::Vector::at() and operator[] in core/dom. (Closed)
Patch Set: Created 4 years 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 | third_party/WebKit/Source/core/dom/ClientRectList.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp
diff --git a/third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp b/third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp
index f01b29cc6e4c0b3bc691a0191d425568b51bc567..a45caa6a16baf06e613b0500b10be8466ff46a93 100644
--- a/third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp
+++ b/third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp
@@ -92,8 +92,7 @@ void CSSSelectorWatch::updateSelectorMatches(
const Vector<String>& addedSelectors) {
bool shouldUpdateTimer = false;
- for (unsigned i = 0; i < removedSelectors.size(); ++i) {
- const String& selector = removedSelectors[i];
+ for (const auto& selector : removedSelectors) {
if (!m_matchingCallbackSelectors.remove(selector))
continue;
@@ -106,8 +105,7 @@ void CSSSelectorWatch::updateSelectorMatches(
m_removedSelectors.add(selector);
}
- for (unsigned i = 0; i < addedSelectors.size(); ++i) {
- const String& selector = addedSelectors[i];
+ for (const auto& selector : addedSelectors) {
HashCountedSet<String>::AddResult result =
m_matchingCallbackSelectors.add(selector);
if (!result.isNewEntry)
@@ -151,9 +149,9 @@ void CSSSelectorWatch::watchCSSSelectors(const Vector<String>& selectors) {
StylePropertySet* callbackPropertySet =
ImmutableStylePropertySet::create(nullptr, 0, UASheetMode);
- for (unsigned i = 0; i < selectors.size(); ++i) {
+ for (const auto& selector : selectors) {
CSSSelectorList selectorList = CSSParser::parseSelector(
- CSSParserContext(UASheetMode, nullptr), nullptr, selectors[i]);
+ CSSParserContext(UASheetMode, nullptr), nullptr, selector);
if (!selectorList.isValid())
continue;
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/ClientRectList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698