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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, CascadeOrder cascadeOrder) |
164 { | 164 { |
165 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); | |
166 ASSERT(!collector.scopeContainsLastMatchedElement()); | 165 ASSERT(!collector.scopeContainsLastMatchedElement()); |
167 collector.setScopeContainsLastMatchedElement(true); | 166 collector.setScopeContainsLastMatchedElement(true); |
168 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { | 167 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { |
169 ASSERT(m_authorStyleSheets[i]->ownerNode()); | 168 ASSERT(m_authorStyleSheets[i]->ownerNode()); |
170 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); |
171 collector.collectMatchingRules(matchRequest, ruleRange, cascadeOrder); | 170 collector.collectMatchingRules(matchRequest, cascadeOrder); |
172 } | 171 } |
173 collector.setScopeContainsLastMatchedElement(false); | 172 collector.setScopeContainsLastMatchedElement(false); |
174 } | 173 } |
175 | 174 |
176 void ScopedStyleResolver::collectMatchingShadowHostRules(ElementRuleCollector& c
ollector, bool includeEmptyRules, CascadeOrder cascadeOrder) | 175 void ScopedStyleResolver::collectMatchingShadowHostRules(ElementRuleCollector& c
ollector, bool includeEmptyRules, CascadeOrder cascadeOrder) |
177 { | 176 { |
178 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); | |
179 ASSERT(!collector.scopeContainsLastMatchedElement()); | 177 ASSERT(!collector.scopeContainsLastMatchedElement()); |
180 collector.setScopeContainsLastMatchedElement(true); | 178 collector.setScopeContainsLastMatchedElement(true); |
181 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { | 179 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { |
182 ASSERT(m_authorStyleSheets[i]->ownerNode()); | 180 ASSERT(m_authorStyleSheets[i]->ownerNode()); |
183 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); |
184 collector.collectMatchingShadowHostRules(matchRequest, ruleRange, cascad
eOrder); | 182 collector.collectMatchingShadowHostRules(matchRequest, cascadeOrder); |
185 } | 183 } |
186 collector.setScopeContainsLastMatchedElement(false); | 184 collector.setScopeContainsLastMatchedElement(false); |
187 } | 185 } |
188 | 186 |
189 void ScopedStyleResolver::collectMatchingTreeBoundaryCrossingRules(ElementRuleCo
llector& collector, bool includeEmptyRules, CascadeOrder cascadeOrder) | 187 void ScopedStyleResolver::collectMatchingTreeBoundaryCrossingRules(ElementRuleCo
llector& collector, bool includeEmptyRules, CascadeOrder cascadeOrder) |
190 { | 188 { |
191 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); | |
192 for (const auto& rules : *m_treeBoundaryCrossingRuleSet) { | 189 for (const auto& rules : *m_treeBoundaryCrossingRuleSet) { |
193 MatchRequest request(rules->m_ruleSet.get(), includeEmptyRules, &treeSco
pe().rootNode(), rules->m_parentStyleSheet, rules->m_parentIndex); | 190 MatchRequest request(rules->m_ruleSet.get(), includeEmptyRules, &treeSco
pe().rootNode(), rules->m_parentStyleSheet, rules->m_parentIndex); |
194 collector.collectMatchingRules(request, ruleRange, cascadeOrder, true); | 191 collector.collectMatchingRules(request, cascadeOrder, true); |
195 } | 192 } |
196 } | 193 } |
197 | 194 |
198 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) | 195 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) |
199 { | 196 { |
200 // Only consider the global author RuleSet for @page rules, as per the HTML5
spec. | 197 // Only consider the global author RuleSet for @page rules, as per the HTML5
spec. |
201 ASSERT(m_scope->rootNode().isDocumentNode()); | 198 ASSERT(m_scope->rootNode().isDocumentNode()); |
202 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) | 199 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) |
203 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet())
; | 200 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet())
; |
204 } | 201 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 245 |
249 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s
heetIndex, ruleSetForScope.release())); | 246 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s
heetIndex, ruleSetForScope.release())); |
250 } | 247 } |
251 | 248 |
252 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) | 249 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) |
253 { | 250 { |
254 visitor->trace(m_ruleSet); | 251 visitor->trace(m_ruleSet); |
255 } | 252 } |
256 | 253 |
257 } // namespace blink | 254 } // namespace blink |
OLD | NEW |