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

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

Issue 1224673002: Implement proposed shadow tree cascade order. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added documentation 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(s.impl()); 153 KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(s.impl());
154 if (it == m_keyframesRuleMap.end()) 154 if (it == m_keyframesRuleMap.end())
155 m_keyframesRuleMap.set(s.impl(), rule); 155 m_keyframesRuleMap.set(s.impl(), rule);
156 else if (it->value->isVendorPrefixed()) 156 else if (it->value->isVendorPrefixed())
157 m_keyframesRuleMap.set(s.impl(), rule); 157 m_keyframesRuleMap.set(s.impl(), rule);
158 } else { 158 } else {
159 m_keyframesRuleMap.set(s.impl(), rule); 159 m_keyframesRuleMap.set(s.impl(), rule);
160 } 160 }
161 } 161 }
162 162
163 void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& colle ctor, bool includeEmptyRules, CascadeOrder cascadeOrder) 163 void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& colle ctor, bool includeEmptyRules)
164 { 164 {
165 ASSERT(!collector.scopeContainsLastMatchedElement()); 165 ASSERT(!collector.scopeContainsLastMatchedElement());
166 collector.setScopeContainsLastMatchedElement(true); 166 collector.setScopeContainsLastMatchedElement(true);
167 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { 167 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) {
168 ASSERT(m_authorStyleSheets[i]->ownerNode()); 168 ASSERT(m_authorStyleSheets[i]->ownerNode());
169 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet() , includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i); 169 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet() , includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i);
170 collector.collectMatchingRules(matchRequest, cascadeOrder); 170 collector.collectMatchingRules(matchRequest);
171 } 171 }
172 collector.setScopeContainsLastMatchedElement(false); 172 collector.setScopeContainsLastMatchedElement(false);
173 } 173 }
174 174
175 void ScopedStyleResolver::collectMatchingShadowHostRules(ElementRuleCollector& c ollector, bool includeEmptyRules, CascadeOrder cascadeOrder) 175 void ScopedStyleResolver::collectMatchingShadowHostRules(ElementRuleCollector& c ollector, bool includeEmptyRules)
176 { 176 {
177 ASSERT(!collector.scopeContainsLastMatchedElement()); 177 ASSERT(!collector.scopeContainsLastMatchedElement());
178 collector.setScopeContainsLastMatchedElement(true); 178 collector.setScopeContainsLastMatchedElement(true);
179 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { 179 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) {
180 ASSERT(m_authorStyleSheets[i]->ownerNode()); 180 ASSERT(m_authorStyleSheets[i]->ownerNode());
181 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet() , includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i); 181 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet() , includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i);
182 collector.collectMatchingShadowHostRules(matchRequest, cascadeOrder); 182 collector.collectMatchingShadowHostRules(matchRequest);
183 } 183 }
184 collector.setScopeContainsLastMatchedElement(false); 184 collector.setScopeContainsLastMatchedElement(false);
185 } 185 }
186 186
187 void ScopedStyleResolver::collectMatchingTreeBoundaryCrossingRules(ElementRuleCo llector& collector, bool includeEmptyRules, CascadeOrder cascadeOrder) 187 void ScopedStyleResolver::collectMatchingTreeBoundaryCrossingRules(ElementRuleCo llector& collector, bool includeEmptyRules)
188 { 188 {
189 if (!m_treeBoundaryCrossingRuleSet)
190 return;
191
192 ASSERT(!collector.scopeContainsLastMatchedElement());
193 collector.setScopeContainsLastMatchedElement(true);
194
189 for (const auto& rules : *m_treeBoundaryCrossingRuleSet) { 195 for (const auto& rules : *m_treeBoundaryCrossingRuleSet) {
190 MatchRequest request(rules->m_ruleSet.get(), includeEmptyRules, &treeSco pe().rootNode(), rules->m_parentStyleSheet, rules->m_parentIndex); 196 MatchRequest request(rules->m_ruleSet.get(), includeEmptyRules, &treeSco pe().rootNode(), rules->m_parentStyleSheet, rules->m_parentIndex);
191 collector.collectMatchingRules(request, cascadeOrder, true); 197 collector.collectMatchingRules(request, true);
192 } 198 }
199
200 collector.setScopeContainsLastMatchedElement(false);
193 } 201 }
194 202
195 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) 203 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector)
196 { 204 {
197 // Only consider the global author RuleSet for @page rules, as per the HTML5 spec. 205 // Only consider the global author RuleSet for @page rules, as per the HTML5 spec.
198 ASSERT(m_scope->rootNode().isDocumentNode()); 206 ASSERT(m_scope->rootNode().isDocumentNode());
199 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) 207 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i)
200 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet()) ; 208 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet()) ;
201 } 209 }
202 210
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s heetIndex, ruleSetForScope.release())); 254 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s heetIndex, ruleSetForScope.release()));
247 } 255 }
248 256
249 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) 257 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet)
250 { 258 {
251 visitor->trace(m_parentStyleSheet); 259 visitor->trace(m_parentStyleSheet);
252 visitor->trace(m_ruleSet); 260 visitor->trace(m_ruleSet);
253 } 261 }
254 262
255 } // namespace blink 263 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698