| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 4 * Copyright (C) 2012 Google Inc. All rights reserved. | 4 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 { | 200 { |
| 201 for (unsigned i = 0; i < rules.size(); ++i) { | 201 for (unsigned i = 0; i < rules.size(); ++i) { |
| 202 const MinimalRuleData& info = rules[i]; | 202 const MinimalRuleData& info = rules[i]; |
| 203 ruleSet->addRule(info.m_rule, info.m_selectorIndex, info.m_flags); | 203 ruleSet->addRule(info.m_rule, info.m_selectorIndex, info.m_flags); |
| 204 } | 204 } |
| 205 } | 205 } |
| 206 | 206 |
| 207 void ScopedStyleResolver::addTreeBoundaryCrossingRules(const RuleSet& authorRule
s, CSSStyleSheet* parentStyleSheet, unsigned sheetIndex) | 207 void ScopedStyleResolver::addTreeBoundaryCrossingRules(const RuleSet& authorRule
s, CSSStyleSheet* parentStyleSheet, unsigned sheetIndex) |
| 208 { | 208 { |
| 209 bool isDocumentScope = treeScope().rootNode().isDocumentNode(); | 209 bool isDocumentScope = treeScope().rootNode().isDocumentNode(); |
| 210 if (authorRules.deepCombinatorOrShadowPseudoRules().isEmpty() && (isDocument
Scope || authorRules.shadowDistributedRules().isEmpty())) | 210 if (authorRules.deepCombinatorOrShadowPseudoRules().isEmpty() |
| 211 && (isDocumentScope || (authorRules.shadowDistributedRules().isEmpty() &
& authorRules.shadowSlottedRules().isEmpty()))) |
| 211 return; | 212 return; |
| 212 | 213 |
| 213 if (!authorRules.deepCombinatorOrShadowPseudoRules().isEmpty()) | 214 if (!authorRules.deepCombinatorOrShadowPseudoRules().isEmpty()) |
| 214 m_hasDeepOrShadowSelector = true; | 215 m_hasDeepOrShadowSelector = true; |
| 215 | 216 |
| 216 OwnPtrWillBeRawPtr<RuleSet> ruleSetForScope = RuleSet::create(); | 217 OwnPtrWillBeRawPtr<RuleSet> ruleSetForScope = RuleSet::create(); |
| 217 addRules(ruleSetForScope.get(), authorRules.deepCombinatorOrShadowPseudoRule
s()); | 218 addRules(ruleSetForScope.get(), authorRules.deepCombinatorOrShadowPseudoRule
s()); |
| 218 | 219 |
| 219 if (!isDocumentScope) | 220 if (!isDocumentScope) { |
| 220 addRules(ruleSetForScope.get(), authorRules.shadowDistributedRules()); | 221 addRules(ruleSetForScope.get(), authorRules.shadowDistributedRules()); |
| 222 addRules(ruleSetForScope.get(), authorRules.shadowSlottedRules()); |
| 223 } |
| 221 | 224 |
| 222 if (!m_treeBoundaryCrossingRuleSet) { | 225 if (!m_treeBoundaryCrossingRuleSet) { |
| 223 m_treeBoundaryCrossingRuleSet = adoptPtrWillBeNoop(new CSSStyleSheetRule
SubSet()); | 226 m_treeBoundaryCrossingRuleSet = adoptPtrWillBeNoop(new CSSStyleSheetRule
SubSet()); |
| 224 treeScope().document().styleResolver()->addTreeBoundaryCrossingScope(tre
eScope().rootNode()); | 227 treeScope().document().styleResolver()->addTreeBoundaryCrossingScope(tre
eScope().rootNode()); |
| 225 } | 228 } |
| 226 | 229 |
| 227 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s
heetIndex, ruleSetForScope.release())); | 230 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s
heetIndex, ruleSetForScope.release())); |
| 228 } | 231 } |
| 229 | 232 |
| 230 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) | 233 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) |
| 231 { | 234 { |
| 232 visitor->trace(m_parentStyleSheet); | 235 visitor->trace(m_parentStyleSheet); |
| 233 visitor->trace(m_ruleSet); | 236 visitor->trace(m_ruleSet); |
| 234 } | 237 } |
| 235 | 238 |
| 236 } // namespace blink | 239 } // namespace blink |
| OLD | NEW |