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

Side by Side Diff: third_party/WebKit/Source/core/css/ActiveStyleSheets.cpp

Issue 2657443005: Migrate WTF::HashSet::add() to ::insert() [part 1 of N] (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/ActiveStyleSheets.h" 5 #include "core/css/ActiveStyleSheets.h"
6 6
7 #include "core/css/CSSStyleSheet.h" 7 #include "core/css/CSSStyleSheet.h"
8 #include "core/css/RuleSet.h" 8 #include "core/css/RuleSet.h"
9 #include "core/css/resolver/ScopedStyleResolver.h" 9 #include "core/css/resolver/ScopedStyleResolver.h"
10 #include "core/dom/ContainerNode.h" 10 #include "core/dom/ContainerNode.h"
(...skipping 14 matching lines...) Expand all
25 25
26 // Walk the common prefix of stylesheets. If the stylesheet rules were 26 // Walk the common prefix of stylesheets. If the stylesheet rules were
27 // modified since last time, add them to the list of changed rulesets. 27 // modified since last time, add them to the list of changed rulesets.
28 for (; index < minCount && 28 for (; index < minCount &&
29 newStyleSheets[index].first == oldStyleSheets[index].first; 29 newStyleSheets[index].first == oldStyleSheets[index].first;
30 index++) { 30 index++) {
31 if (newStyleSheets[index].second == oldStyleSheets[index].second) 31 if (newStyleSheets[index].second == oldStyleSheets[index].second)
32 continue; 32 continue;
33 33
34 if (newStyleSheets[index].second) 34 if (newStyleSheets[index].second)
35 changedRuleSets.add(newStyleSheets[index].second); 35 changedRuleSets.insert(newStyleSheets[index].second);
36 if (oldStyleSheets[index].second) 36 if (oldStyleSheets[index].second)
37 changedRuleSets.add(oldStyleSheets[index].second); 37 changedRuleSets.insert(oldStyleSheets[index].second);
38 } 38 }
39 39
40 if (index == oldStyleSheetCount) { 40 if (index == oldStyleSheetCount) {
41 // The old stylesheet vector is a prefix of the new vector in terms of 41 // The old stylesheet vector is a prefix of the new vector in terms of
42 // StyleSheets. If none of the RuleSets changed, we only need to add the new 42 // StyleSheets. If none of the RuleSets changed, we only need to add the new
43 // sheets to the ScopedStyleResolver (ActiveSheetsAppended). 43 // sheets to the ScopedStyleResolver (ActiveSheetsAppended).
44 bool ruleSetsChangedInCommonPrefix = !changedRuleSets.isEmpty(); 44 bool ruleSetsChangedInCommonPrefix = !changedRuleSets.isEmpty();
45 for (; index < newStyleSheetCount; index++) { 45 for (; index < newStyleSheetCount; index++) {
46 if (newStyleSheets[index].second) 46 if (newStyleSheets[index].second)
47 changedRuleSets.add(newStyleSheets[index].second); 47 changedRuleSets.add(newStyleSheets[index].second);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 if (sheet1.second) 101 if (sheet1.second)
102 changedRuleSets.add(sheet1.second); 102 changedRuleSets.add(sheet1.second);
103 if (sheet2.second) 103 if (sheet2.second)
104 changedRuleSets.add(sheet2.second); 104 changedRuleSets.add(sheet2.second);
105 } 105 }
106 return changedRuleSets.isEmpty() ? NoActiveSheetsChanged 106 return changedRuleSets.isEmpty() ? NoActiveSheetsChanged
107 : ActiveSheetsChanged; 107 : ActiveSheetsChanged;
108 } 108 }
109 109
110 } // namespace blink 110 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698