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

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

Issue 1523843004: Add support for new CSS ::slotted() pseudo element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase / fix comments for tests (FYI) Created 4 years, 11 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 * 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 { 199 {
200 for (unsigned i = 0; i < rules.size(); ++i) { 200 for (unsigned i = 0; i < rules.size(); ++i) {
201 const MinimalRuleData& info = rules[i]; 201 const MinimalRuleData& info = rules[i];
202 ruleSet->addRule(info.m_rule, info.m_selectorIndex, info.m_flags); 202 ruleSet->addRule(info.m_rule, info.m_selectorIndex, info.m_flags);
203 } 203 }
204 } 204 }
205 205
206 void ScopedStyleResolver::addTreeBoundaryCrossingRules(const RuleSet& authorRule s, CSSStyleSheet* parentStyleSheet, unsigned sheetIndex) 206 void ScopedStyleResolver::addTreeBoundaryCrossingRules(const RuleSet& authorRule s, CSSStyleSheet* parentStyleSheet, unsigned sheetIndex)
207 { 207 {
208 bool isDocumentScope = treeScope().rootNode().isDocumentNode(); 208 bool isDocumentScope = treeScope().rootNode().isDocumentNode();
209 if (authorRules.deepCombinatorOrShadowPseudoRules().isEmpty() && (isDocument Scope || authorRules.shadowDistributedRules().isEmpty())) 209 if (authorRules.deepCombinatorOrShadowPseudoRules().isEmpty()
210 && (isDocumentScope || (authorRules.shadowDistributedRules().isEmpty() & & authorRules.shadowSlottedRules().isEmpty())))
210 return; 211 return;
211 212
212 if (!authorRules.deepCombinatorOrShadowPseudoRules().isEmpty()) 213 if (!authorRules.deepCombinatorOrShadowPseudoRules().isEmpty())
213 m_hasDeepOrShadowSelector = true; 214 m_hasDeepOrShadowSelector = true;
214 215
215 OwnPtrWillBeRawPtr<RuleSet> ruleSetForScope = RuleSet::create(); 216 OwnPtrWillBeRawPtr<RuleSet> ruleSetForScope = RuleSet::create();
216 addRules(ruleSetForScope.get(), authorRules.deepCombinatorOrShadowPseudoRule s()); 217 addRules(ruleSetForScope.get(), authorRules.deepCombinatorOrShadowPseudoRule s());
217 218
218 if (!isDocumentScope) 219 if (!isDocumentScope) {
219 addRules(ruleSetForScope.get(), authorRules.shadowDistributedRules()); 220 addRules(ruleSetForScope.get(), authorRules.shadowDistributedRules());
221 addRules(ruleSetForScope.get(), authorRules.shadowSlottedRules());
222 }
220 223
221 if (!m_treeBoundaryCrossingRuleSet) { 224 if (!m_treeBoundaryCrossingRuleSet) {
222 m_treeBoundaryCrossingRuleSet = adoptPtrWillBeNoop(new CSSStyleSheetRule SubSet()); 225 m_treeBoundaryCrossingRuleSet = adoptPtrWillBeNoop(new CSSStyleSheetRule SubSet());
223 treeScope().document().styleResolver()->addTreeBoundaryCrossingScope(tre eScope().rootNode()); 226 treeScope().document().styleResolver()->addTreeBoundaryCrossingScope(tre eScope().rootNode());
224 } 227 }
225 228
226 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s heetIndex, ruleSetForScope.release())); 229 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s heetIndex, ruleSetForScope.release()));
227 } 230 }
228 231
229 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) 232 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet)
230 { 233 {
231 visitor->trace(m_parentStyleSheet); 234 visitor->trace(m_parentStyleSheet);
232 visitor->trace(m_ruleSet); 235 visitor->trace(m_ruleSet);
233 } 236 }
234 237
235 } // namespace blink 238 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698