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

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

Issue 2566403003: Migrate WTF::Vector::append() to ::push_back() [part 3 of N] (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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 return true; 155 return true;
156 } 156 }
157 157
158 void StyleSheetContents::parserAppendRule(StyleRuleBase* rule) { 158 void StyleSheetContents::parserAppendRule(StyleRuleBase* rule) {
159 if (rule->isImportRule()) { 159 if (rule->isImportRule()) {
160 // Parser enforces that @import rules come before anything else 160 // Parser enforces that @import rules come before anything else
161 ASSERT(m_childRules.isEmpty()); 161 ASSERT(m_childRules.isEmpty());
162 StyleRuleImport* importRule = toStyleRuleImport(rule); 162 StyleRuleImport* importRule = toStyleRuleImport(rule);
163 if (importRule->mediaQueries()) 163 if (importRule->mediaQueries())
164 setHasMediaQueries(); 164 setHasMediaQueries();
165 m_importRules.append(importRule); 165 m_importRules.push_back(importRule);
166 m_importRules.back()->setParentStyleSheet(this); 166 m_importRules.back()->setParentStyleSheet(this);
167 m_importRules.back()->requestStyleSheet(); 167 m_importRules.back()->requestStyleSheet();
168 return; 168 return;
169 } 169 }
170 170
171 if (rule->isNamespaceRule()) { 171 if (rule->isNamespaceRule()) {
172 // Parser enforces that @namespace rules come before all rules other than 172 // Parser enforces that @namespace rules come before all rules other than
173 // import/charset rules 173 // import/charset rules
174 ASSERT(m_childRules.isEmpty()); 174 ASSERT(m_childRules.isEmpty());
175 StyleRuleNamespace& namespaceRule = toStyleRuleNamespace(*rule); 175 StyleRuleNamespace& namespaceRule = toStyleRuleNamespace(*rule);
176 parserAddNamespace(namespaceRule.prefix(), namespaceRule.uri()); 176 parserAddNamespace(namespaceRule.prefix(), namespaceRule.uri());
177 m_namespaceRules.append(&namespaceRule); 177 m_namespaceRules.push_back(&namespaceRule);
178 return; 178 return;
179 } 179 }
180 180
181 m_childRules.append(rule); 181 m_childRules.push_back(rule);
182 } 182 }
183 183
184 void StyleSheetContents::setHasMediaQueries() { 184 void StyleSheetContents::setHasMediaQueries() {
185 m_hasMediaQueries = true; 185 m_hasMediaQueries = true;
186 if (parentStyleSheet()) 186 if (parentStyleSheet())
187 parentStyleSheet()->setHasMediaQueries(); 187 parentStyleSheet()->setHasMediaQueries();
188 } 188 }
189 189
190 StyleRuleBase* StyleSheetContents::ruleAt(unsigned index) const { 190 StyleRuleBase* StyleSheetContents::ruleAt(unsigned index) const {
191 SECURITY_DCHECK(index < ruleCount()); 191 SECURITY_DCHECK(index < ruleCount());
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 removeFontFaceRules(root->m_completedClients, fontFaceRule); 656 removeFontFaceRules(root->m_completedClients, fontFaceRule);
657 } 657 }
658 658
659 static void findFontFaceRulesFromRules( 659 static void findFontFaceRulesFromRules(
660 const HeapVector<Member<StyleRuleBase>>& rules, 660 const HeapVector<Member<StyleRuleBase>>& rules,
661 HeapVector<Member<const StyleRuleFontFace>>& fontFaceRules) { 661 HeapVector<Member<const StyleRuleFontFace>>& fontFaceRules) {
662 for (unsigned i = 0; i < rules.size(); ++i) { 662 for (unsigned i = 0; i < rules.size(); ++i) {
663 StyleRuleBase* rule = rules[i].get(); 663 StyleRuleBase* rule = rules[i].get();
664 664
665 if (rule->isFontFaceRule()) { 665 if (rule->isFontFaceRule()) {
666 fontFaceRules.append(toStyleRuleFontFace(rule)); 666 fontFaceRules.push_back(toStyleRuleFontFace(rule));
667 } else if (rule->isMediaRule()) { 667 } else if (rule->isMediaRule()) {
668 StyleRuleMedia* mediaRule = toStyleRuleMedia(rule); 668 StyleRuleMedia* mediaRule = toStyleRuleMedia(rule);
669 // We cannot know whether the media rule matches or not, but 669 // We cannot know whether the media rule matches or not, but
670 // for safety, remove @font-face in the media rule (if exists). 670 // for safety, remove @font-face in the media rule (if exists).
671 findFontFaceRulesFromRules(mediaRule->childRules(), fontFaceRules); 671 findFontFaceRulesFromRules(mediaRule->childRules(), fontFaceRules);
672 } 672 }
673 } 673 }
674 } 674 }
675 675
676 void StyleSheetContents::findFontFaceRules( 676 void StyleSheetContents::findFontFaceRules(
(...skipping 12 matching lines...) Expand all
689 visitor->trace(m_importRules); 689 visitor->trace(m_importRules);
690 visitor->trace(m_namespaceRules); 690 visitor->trace(m_namespaceRules);
691 visitor->trace(m_childRules); 691 visitor->trace(m_childRules);
692 visitor->trace(m_loadingClients); 692 visitor->trace(m_loadingClients);
693 visitor->trace(m_completedClients); 693 visitor->trace(m_completedClients);
694 visitor->trace(m_ruleSet); 694 visitor->trace(m_ruleSet);
695 visitor->trace(m_referencedFromResource); 695 visitor->trace(m_referencedFromResource);
696 } 696 }
697 697
698 } // namespace blink 698 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698