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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(s.impl()); | 136 KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(s.impl()); |
137 if (it == m_keyframesRuleMap.end()) | 137 if (it == m_keyframesRuleMap.end()) |
138 m_keyframesRuleMap.set(s.impl(), rule); | 138 m_keyframesRuleMap.set(s.impl(), rule); |
139 else if (it->value->isVendorPrefixed()) | 139 else if (it->value->isVendorPrefixed()) |
140 m_keyframesRuleMap.set(s.impl(), rule); | 140 m_keyframesRuleMap.set(s.impl(), rule); |
141 } else { | 141 } else { |
142 m_keyframesRuleMap.set(s.impl(), rule); | 142 m_keyframesRuleMap.set(s.impl(), rule); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& colle
ctor, bool includeEmptyRules) | 146 void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& colle
ctor, bool includeEmptyRules, CascadeOrder cascadeOrder) |
147 { | 147 { |
148 ASSERT(!collector.scopeContainsLastMatchedElement()); | 148 ASSERT(!collector.scopeContainsLastMatchedElement()); |
149 collector.setScopeContainsLastMatchedElement(true); | 149 collector.setScopeContainsLastMatchedElement(true); |
150 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { | 150 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { |
151 ASSERT(m_authorStyleSheets[i]->ownerNode()); | 151 ASSERT(m_authorStyleSheets[i]->ownerNode()); |
152 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet()
, includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i); | 152 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet()
, includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i); |
153 collector.collectMatchingRules(matchRequest); | 153 collector.collectMatchingRules(matchRequest, cascadeOrder); |
154 } | 154 } |
155 collector.setScopeContainsLastMatchedElement(false); | 155 collector.setScopeContainsLastMatchedElement(false); |
156 } | 156 } |
157 | 157 |
158 void ScopedStyleResolver::collectMatchingShadowHostRules(ElementRuleCollector& c
ollector, bool includeEmptyRules) | 158 void ScopedStyleResolver::collectMatchingShadowHostRules(ElementRuleCollector& c
ollector, bool includeEmptyRules, CascadeOrder cascadeOrder) |
159 { | 159 { |
160 ASSERT(!collector.scopeContainsLastMatchedElement()); | 160 ASSERT(!collector.scopeContainsLastMatchedElement()); |
161 collector.setScopeContainsLastMatchedElement(true); | 161 collector.setScopeContainsLastMatchedElement(true); |
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); | 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) | 170 void ScopedStyleResolver::collectMatchingTreeBoundaryCrossingRules(ElementRuleCo
llector& collector, bool includeEmptyRules, CascadeOrder cascadeOrder) |
171 { | 171 { |
172 if (!m_treeBoundaryCrossingRuleSet) | 172 if (!m_treeBoundaryCrossingRuleSet) |
173 return; | 173 return; |
174 | 174 |
175 ASSERT(!collector.scopeContainsLastMatchedElement()); | 175 ASSERT(!collector.scopeContainsLastMatchedElement()); |
176 collector.setScopeContainsLastMatchedElement(true); | 176 collector.setScopeContainsLastMatchedElement(true); |
177 | 177 |
178 for (const auto& rules : *m_treeBoundaryCrossingRuleSet) { | 178 for (const auto& rules : *m_treeBoundaryCrossingRuleSet) { |
179 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); |
180 collector.collectMatchingRules(request, true); | 180 collector.collectMatchingRules(request, cascadeOrder, true); |
181 } | 181 } |
182 | 182 |
183 collector.setScopeContainsLastMatchedElement(false); | 183 collector.setScopeContainsLastMatchedElement(false); |
184 } | 184 } |
185 | 185 |
186 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) | 186 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) |
187 { | 187 { |
188 // 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. |
189 ASSERT(m_scope->rootNode().isDocumentNode()); | 189 ASSERT(m_scope->rootNode().isDocumentNode()); |
190 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) | 190 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s
heetIndex, ruleSetForScope.release())); | 237 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s
heetIndex, ruleSetForScope.release())); |
238 } | 238 } |
239 | 239 |
240 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) | 240 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) |
241 { | 241 { |
242 visitor->trace(m_parentStyleSheet); | 242 visitor->trace(m_parentStyleSheet); |
243 visitor->trace(m_ruleSet); | 243 visitor->trace(m_ruleSet); |
244 } | 244 } |
245 | 245 |
246 } // namespace blink | 246 } // namespace blink |
OLD | NEW |