| 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. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. |
| 4 * All rights reserved. | 4 * All rights reserved. |
| 5 * Copyright (C) 2012 Google Inc. All rights reserved. | 5 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 const MinimalRuleData& info = rules[i]; | 269 const MinimalRuleData& info = rules[i]; |
| 270 rule_set->AddRule(info.rule_, info.selector_index_, info.flags_); | 270 rule_set->AddRule(info.rule_, info.selector_index_, info.flags_); |
| 271 } | 271 } |
| 272 } | 272 } |
| 273 | 273 |
| 274 void ScopedStyleResolver::AddTreeBoundaryCrossingRules( | 274 void ScopedStyleResolver::AddTreeBoundaryCrossingRules( |
| 275 const RuleSet& author_rules, | 275 const RuleSet& author_rules, |
| 276 CSSStyleSheet* parent_style_sheet, | 276 CSSStyleSheet* parent_style_sheet, |
| 277 unsigned sheet_index) { | 277 unsigned sheet_index) { |
| 278 bool is_document_scope = GetTreeScope().RootNode().IsDocumentNode(); | 278 bool is_document_scope = GetTreeScope().RootNode().IsDocumentNode(); |
| 279 |
| 280 // ::slotted() rules have to be allowed for Document for styling fallback |
| 281 // contents in <slot>. |
| 279 if (author_rules.DeepCombinatorOrShadowPseudoRules().IsEmpty() && | 282 if (author_rules.DeepCombinatorOrShadowPseudoRules().IsEmpty() && |
| 283 author_rules.SlottedPseudoElementRules().IsEmpty() && |
| 280 (is_document_scope || | 284 (is_document_scope || |
| 281 (author_rules.ContentPseudoElementRules().IsEmpty() && | 285 (author_rules.ContentPseudoElementRules().IsEmpty()))) |
| 282 author_rules.SlottedPseudoElementRules().IsEmpty()))) | |
| 283 return; | 286 return; |
| 284 | 287 |
| 285 if (!author_rules.DeepCombinatorOrShadowPseudoRules().IsEmpty()) | 288 if (!author_rules.DeepCombinatorOrShadowPseudoRules().IsEmpty()) |
| 286 has_deep_or_shadow_selector_ = true; | 289 has_deep_or_shadow_selector_ = true; |
| 287 | 290 |
| 288 RuleSet* rule_set_for_scope = RuleSet::Create(); | 291 RuleSet* rule_set_for_scope = RuleSet::Create(); |
| 289 AddRules(rule_set_for_scope, | 292 AddRules(rule_set_for_scope, |
| 290 author_rules.DeepCombinatorOrShadowPseudoRules()); | 293 author_rules.DeepCombinatorOrShadowPseudoRules()); |
| 294 AddRules(rule_set_for_scope, author_rules.SlottedPseudoElementRules()); |
| 291 | 295 |
| 292 if (!is_document_scope) { | 296 if (!is_document_scope) |
| 293 AddRules(rule_set_for_scope, author_rules.ContentPseudoElementRules()); | 297 AddRules(rule_set_for_scope, author_rules.ContentPseudoElementRules()); |
| 294 AddRules(rule_set_for_scope, author_rules.SlottedPseudoElementRules()); | |
| 295 } | |
| 296 | 298 |
| 297 if (!tree_boundary_crossing_rule_set_) { | 299 if (!tree_boundary_crossing_rule_set_) { |
| 298 tree_boundary_crossing_rule_set_ = new CSSStyleSheetRuleSubSet(); | 300 tree_boundary_crossing_rule_set_ = new CSSStyleSheetRuleSubSet(); |
| 299 GetTreeScope().GetDocument().GetStyleEngine().AddTreeBoundaryCrossingScope( | 301 GetTreeScope().GetDocument().GetStyleEngine().AddTreeBoundaryCrossingScope( |
| 300 GetTreeScope()); | 302 GetTreeScope()); |
| 301 } | 303 } |
| 302 | 304 |
| 303 tree_boundary_crossing_rule_set_->push_back( | 305 tree_boundary_crossing_rule_set_->push_back( |
| 304 RuleSubSet::Create(parent_style_sheet, sheet_index, rule_set_for_scope)); | 306 RuleSubSet::Create(parent_style_sheet, sheet_index, rule_set_for_scope)); |
| 305 } | 307 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 325 } | 327 } |
| 326 return true; | 328 return true; |
| 327 } | 329 } |
| 328 | 330 |
| 329 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) { | 331 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) { |
| 330 visitor->Trace(parent_style_sheet_); | 332 visitor->Trace(parent_style_sheet_); |
| 331 visitor->Trace(rule_set_); | 333 visitor->Trace(rule_set_); |
| 332 } | 334 } |
| 333 | 335 |
| 334 } // namespace blink | 336 } // namespace blink |
| OLD | NEW |