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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | |
178 for (const auto& rules : *m_treeBoundaryCrossingRuleSet) { | 172 for (const auto& rules : *m_treeBoundaryCrossingRuleSet) { |
179 MatchRequest request(rules->m_ruleSet.get(), includeEmptyRules, &treeSco
pe().rootNode(), rules->m_parentStyleSheet, rules->m_parentIndex); | 173 MatchRequest request(rules->m_ruleSet.get(), includeEmptyRules, &treeSco
pe().rootNode(), rules->m_parentStyleSheet, rules->m_parentIndex); |
180 collector.collectMatchingRules(request, cascadeOrder, true); | 174 collector.collectMatchingRules(request, cascadeOrder, true); |
181 } | 175 } |
182 | |
183 collector.setScopeContainsLastMatchedElement(false); | |
184 } | 176 } |
185 | 177 |
186 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) | 178 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) |
187 { | 179 { |
188 // Only consider the global author RuleSet for @page rules, as per the HTML5
spec. | 180 // Only consider the global author RuleSet for @page rules, as per the HTML5
spec. |
189 ASSERT(m_scope->rootNode().isDocumentNode()); | 181 ASSERT(m_scope->rootNode().isDocumentNode()); |
190 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) | 182 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) |
191 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet())
; | 183 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet())
; |
192 } | 184 } |
193 | 185 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s
heetIndex, ruleSetForScope.release())); | 229 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s
heetIndex, ruleSetForScope.release())); |
238 } | 230 } |
239 | 231 |
240 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) | 232 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) |
241 { | 233 { |
242 visitor->trace(m_parentStyleSheet); | 234 visitor->trace(m_parentStyleSheet); |
243 visitor->trace(m_ruleSet); | 235 visitor->trace(m_ruleSet); |
244 } | 236 } |
245 | 237 |
246 } // namespace blink | 238 } // namespace blink |
OLD | NEW |