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

Unified Diff: third_party/WebKit/Source/core/dom/TreeScopeStyleSheetCollection.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
Index: third_party/WebKit/Source/core/dom/TreeScopeStyleSheetCollection.cpp
diff --git a/third_party/WebKit/Source/core/dom/TreeScopeStyleSheetCollection.cpp b/third_party/WebKit/Source/core/dom/TreeScopeStyleSheetCollection.cpp
index 21363da495e89e1e156e1a5599c2f9664ead50c5..a64330698a590fa62ffe8da209d914a5272f575c 100644
--- a/third_party/WebKit/Source/core/dom/TreeScopeStyleSheetCollection.cpp
+++ b/third_party/WebKit/Source/core/dom/TreeScopeStyleSheetCollection.cpp
@@ -89,9 +89,8 @@ bool TreeScopeStyleSheetCollection::activeLoadingStyleSheetLoaded(
// StyleSheets of <style> elements that @import stylesheets are active but
// loading. We need to trigger a full recalc when such loads are done.
bool hasActiveLoadingStylesheet = false;
- unsigned newStylesheetCount = newStyleSheets.size();
- for (unsigned i = 0; i < newStylesheetCount; ++i) {
- if (newStyleSheets[i]->isLoading())
+ for (const auto& sheet : newStyleSheets) {
+ if (sheet->isLoading())
hasActiveLoadingStylesheet = true;
}
if (m_hadActiveLoadingStylesheet && !hasActiveLoadingStylesheet) {
@@ -107,11 +106,11 @@ static bool findFontFaceRulesFromStyleSheetContents(
HeapVector<Member<const StyleRuleFontFace>>& fontFaceRules) {
bool hasFontFaceRule = false;
- for (unsigned i = 0; i < sheets.size(); ++i) {
- DCHECK(sheets[i]);
- if (sheets[i]->hasFontFaceRule()) {
+ for (const auto& sheet : sheets) {
+ DCHECK(sheet);
+ if (sheet->hasFontFaceRule()) {
// FIXME: We don't need this for styles in shadow tree.
- sheets[i]->findFontFaceRules(fontFaceRules);
+ sheet->findFontFaceRules(fontFaceRules);
hasFontFaceRule = true;
}
}
@@ -171,8 +170,8 @@ void TreeScopeStyleSheetCollection::analyzeStyleSheetChange(
}
void TreeScopeStyleSheetCollection::clearMediaQueryRuleSetStyleSheets() {
- for (size_t i = 0; i < m_activeAuthorStyleSheets.size(); ++i) {
- StyleSheetContents* contents = m_activeAuthorStyleSheets[i]->contents();
+ for (const auto& sheet : m_activeAuthorStyleSheets) {
+ StyleSheetContents* contents = sheet->contents();
if (contents->hasMediaQueries())
contents->clearRuleSet();
}

Powered by Google App Engine
This is Rietveld 408576698