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

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

Issue 1669493006: Incorrect setHasMediaQueries() when @media rule is dropped. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 /* 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 m_importRules.insert(index, importRule); 230 m_importRules.insert(index, importRule);
231 m_importRules[index]->setParentStyleSheet(this); 231 m_importRules[index]->setParentStyleSheet(this);
232 m_importRules[index]->requestStyleSheet(); 232 m_importRules[index]->requestStyleSheet();
233 // FIXME: Stylesheet doesn't actually change meaningfully before the imp orted sheets are loaded. 233 // FIXME: Stylesheet doesn't actually change meaningfully before the imp orted sheets are loaded.
234 return true; 234 return true;
235 } 235 }
236 // Inserting @import rule after a non-import rule is not allowed. 236 // Inserting @import rule after a non-import rule is not allowed.
237 if (rule->isImportRule()) 237 if (rule->isImportRule())
238 return false; 238 return false;
239 239
240 if (rule->isMediaRule())
241 setHasMediaQueries();
242
243 index -= m_importRules.size(); 240 index -= m_importRules.size();
244 241
245 if (index < m_namespaceRules.size() || (index == m_namespaceRules.size() && rule->isNamespaceRule())) { 242 if (index < m_namespaceRules.size() || (index == m_namespaceRules.size() && rule->isNamespaceRule())) {
246 // Inserting non-namespace rules other than import rule before @namespac e is not allowed. 243 // Inserting non-namespace rules other than import rule before @namespac e is not allowed.
247 if (!rule->isNamespaceRule()) 244 if (!rule->isNamespaceRule())
248 return false; 245 return false;
249 // Inserting @namespace rule when rules other than import/namespace/char set are present is not allowed. 246 // Inserting @namespace rule when rules other than import/namespace/char set are present is not allowed.
250 if (!m_childRules.isEmpty()) 247 if (!m_childRules.isEmpty())
251 return false; 248 return false;
252 249
253 StyleRuleNamespace* namespaceRule = toStyleRuleNamespace(rule.get()); 250 StyleRuleNamespace* namespaceRule = toStyleRuleNamespace(rule.get());
254 m_namespaceRules.insert(index, namespaceRule); 251 m_namespaceRules.insert(index, namespaceRule);
255 // For now to be compatible with IE and Firefox if namespace rule with s ame prefix is added 252 // For now to be compatible with IE and Firefox if namespace rule with s ame prefix is added
256 // irrespective of adding the rule at any index, last added rule's value is considered. 253 // irrespective of adding the rule at any index, last added rule's value is considered.
257 // TODO (ramya.v@samsung.com): As per spec last valid rule should be con sidered, 254 // TODO (ramya.v@samsung.com): As per spec last valid rule should be con sidered,
258 // which means if namespace rule is added in the middle of existing name space rules, 255 // which means if namespace rule is added in the middle of existing name space rules,
259 // rule which comes later in rule list with same prefix needs to be cons idered. 256 // rule which comes later in rule list with same prefix needs to be cons idered.
260 parserAddNamespace(namespaceRule->prefix(), namespaceRule->uri()); 257 parserAddNamespace(namespaceRule->prefix(), namespaceRule->uri());
261 return true; 258 return true;
262 } 259 }
263 260
264 if (rule->isNamespaceRule()) 261 if (rule->isNamespaceRule())
265 return false; 262 return false;
266 263
267 index -= m_namespaceRules.size(); 264 index -= m_namespaceRules.size();
268 265
269 if (rule->isFontFaceRule()) 266 if (rule->isMediaRule())
267 setHasMediaQueries();
268 else if (rule->isFontFaceRule())
270 setHasFontFaceRule(true); 269 setHasFontFaceRule(true);
270
271 m_childRules.insert(index, rule); 271 m_childRules.insert(index, rule);
272 return true; 272 return true;
273 } 273 }
274 274
275 bool StyleSheetContents::wrapperDeleteRule(unsigned index) 275 bool StyleSheetContents::wrapperDeleteRule(unsigned index)
276 { 276 {
277 ASSERT(m_isMutable); 277 ASSERT(m_isMutable);
278 ASSERT_WITH_SECURITY_IMPLICATION(index < ruleCount()); 278 ASSERT_WITH_SECURITY_IMPLICATION(index < ruleCount());
279 279
280 if (index < m_importRules.size()) { 280 if (index < m_importRules.size()) {
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 visitor->trace(m_importRules); 669 visitor->trace(m_importRules);
670 visitor->trace(m_namespaceRules); 670 visitor->trace(m_namespaceRules);
671 visitor->trace(m_childRules); 671 visitor->trace(m_childRules);
672 visitor->trace(m_loadingClients); 672 visitor->trace(m_loadingClients);
673 visitor->trace(m_completedClients); 673 visitor->trace(m_completedClients);
674 visitor->trace(m_ruleSet); 674 visitor->trace(m_ruleSet);
675 #endif 675 #endif
676 } 676 }
677 677
678 } // namespace blink 678 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/css/StyleSheetContentsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698