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

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

Issue 2081893003: Mark stylesheet as having media queries at consume time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Back to marking at consume time Created 4 years, 5 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 /* 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 if (rule->isNamespaceRule()) { 168 if (rule->isNamespaceRule()) {
169 // Parser enforces that @namespace rules come before all rules other tha n 169 // Parser enforces that @namespace rules come before all rules other tha n
170 // import/charset rules 170 // import/charset rules
171 ASSERT(m_childRules.isEmpty()); 171 ASSERT(m_childRules.isEmpty());
172 StyleRuleNamespace& namespaceRule = toStyleRuleNamespace(*rule); 172 StyleRuleNamespace& namespaceRule = toStyleRuleNamespace(*rule);
173 parserAddNamespace(namespaceRule.prefix(), namespaceRule.uri()); 173 parserAddNamespace(namespaceRule.prefix(), namespaceRule.uri());
174 m_namespaceRules.append(&namespaceRule); 174 m_namespaceRules.append(&namespaceRule);
175 return; 175 return;
176 } 176 }
177 177
178 if (rule->isMediaRule())
179 setHasMediaQueries();
180
181 m_childRules.append(rule); 178 m_childRules.append(rule);
182 } 179 }
183 180
184 void StyleSheetContents::setHasMediaQueries() 181 void StyleSheetContents::setHasMediaQueries()
185 { 182 {
186 m_hasMediaQueries = true; 183 m_hasMediaQueries = true;
187 if (parentStyleSheet()) 184 if (parentStyleSheet())
188 parentStyleSheet()->setHasMediaQueries(); 185 parentStyleSheet()->setHasMediaQueries();
189 } 186 }
190 187
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // rule which comes later in rule list with same prefix needs to be cons idered. 261 // rule which comes later in rule list with same prefix needs to be cons idered.
265 parserAddNamespace(namespaceRule->prefix(), namespaceRule->uri()); 262 parserAddNamespace(namespaceRule->prefix(), namespaceRule->uri());
266 return true; 263 return true;
267 } 264 }
268 265
269 if (rule->isNamespaceRule()) 266 if (rule->isNamespaceRule())
270 return false; 267 return false;
271 268
272 index -= m_namespaceRules.size(); 269 index -= m_namespaceRules.size();
273 270
274 if (rule->isMediaRule())
275 setHasMediaQueries();
276 else if (rule->isFontFaceRule())
277 setHasFontFaceRule(true);
278
279 m_childRules.insert(index, rule); 271 m_childRules.insert(index, rule);
280 return true; 272 return true;
281 } 273 }
282 274
283 bool StyleSheetContents::wrapperDeleteRule(unsigned index) 275 bool StyleSheetContents::wrapperDeleteRule(unsigned index)
284 { 276 {
285 ASSERT(m_isMutable); 277 ASSERT(m_isMutable);
286 ASSERT_WITH_SECURITY_IMPLICATION(index < ruleCount()); 278 ASSERT_WITH_SECURITY_IMPLICATION(index < ruleCount());
287 279
288 if (index < m_importRules.size()) { 280 if (index < m_importRules.size()) {
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 visitor->trace(m_importRules); 674 visitor->trace(m_importRules);
683 visitor->trace(m_namespaceRules); 675 visitor->trace(m_namespaceRules);
684 visitor->trace(m_childRules); 676 visitor->trace(m_childRules);
685 visitor->trace(m_loadingClients); 677 visitor->trace(m_loadingClients);
686 visitor->trace(m_completedClients); 678 visitor->trace(m_completedClients);
687 visitor->trace(m_ruleSet); 679 visitor->trace(m_ruleSet);
688 visitor->trace(m_referencedFromResource); 680 visitor->trace(m_referencedFromResource);
689 } 681 }
690 682
691 } // namespace blink 683 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleSheetContents.h ('k') | third_party/WebKit/Source/core/css/StyleSheetContentsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698