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

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

Issue 1298173004: Implement proposed shadow tree cascade order. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed expected results and added another TODO. Created 5 years, 4 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { 162 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) {
163 ASSERT(m_authorStyleSheets[i]->ownerNode()); 163 ASSERT(m_authorStyleSheets[i]->ownerNode());
164 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet() , includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i); 164 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet() , includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i);
165 collector.collectMatchingShadowHostRules(matchRequest, cascadeOrder); 165 collector.collectMatchingShadowHostRules(matchRequest, cascadeOrder);
166 } 166 }
167 collector.setScopeContainsLastMatchedElement(false); 167 collector.setScopeContainsLastMatchedElement(false);
168 } 168 }
169 169
170 void ScopedStyleResolver::collectMatchingTreeBoundaryCrossingRules(ElementRuleCo llector& collector, bool includeEmptyRules, CascadeOrder cascadeOrder) 170 void ScopedStyleResolver::collectMatchingTreeBoundaryCrossingRules(ElementRuleCo llector& collector, bool includeEmptyRules, CascadeOrder cascadeOrder)
171 { 171 {
172 if (!m_treeBoundaryCrossingRuleSet)
173 return;
174
175 ASSERT(!collector.scopeContainsLastMatchedElement());
176 collector.setScopeContainsLastMatchedElement(true);
177
172 for (const auto& rules : *m_treeBoundaryCrossingRuleSet) { 178 for (const auto& rules : *m_treeBoundaryCrossingRuleSet) {
173 MatchRequest request(rules->m_ruleSet.get(), includeEmptyRules, &treeSco pe().rootNode(), rules->m_parentStyleSheet, rules->m_parentIndex); 179 MatchRequest request(rules->m_ruleSet.get(), includeEmptyRules, &treeSco pe().rootNode(), rules->m_parentStyleSheet, rules->m_parentIndex);
174 collector.collectMatchingRules(request, cascadeOrder, true); 180 collector.collectMatchingRules(request, cascadeOrder, true);
175 } 181 }
182
183 collector.setScopeContainsLastMatchedElement(false);
176 } 184 }
177 185
178 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) 186 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector)
179 { 187 {
180 // Only consider the global author RuleSet for @page rules, as per the HTML5 spec. 188 // Only consider the global author RuleSet for @page rules, as per the HTML5 spec.
181 ASSERT(m_scope->rootNode().isDocumentNode()); 189 ASSERT(m_scope->rootNode().isDocumentNode());
182 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) 190 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i)
183 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet()) ; 191 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet()) ;
184 } 192 }
185 193
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s heetIndex, ruleSetForScope.release())); 237 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s heetIndex, ruleSetForScope.release()));
230 } 238 }
231 239
232 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) 240 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet)
233 { 241 {
234 visitor->trace(m_parentStyleSheet); 242 visitor->trace(m_parentStyleSheet);
235 visitor->trace(m_ruleSet); 243 visitor->trace(m_ruleSet);
236 } 244 }
237 245
238 } // namespace blink 246 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/resolver/ScopedStyleResolver.h ('k') | Source/core/css/resolver/StyleResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698