| 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. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. |
| 4 * All rights reserved. | 4 * All rights reserved. |
| 5 * Copyright (C) 2012 Google Inc. All rights reserved. | 5 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 void ScopedStyleResolver::collectFeaturesTo( | 106 void ScopedStyleResolver::collectFeaturesTo( |
| 107 RuleFeatureSet& features, | 107 RuleFeatureSet& features, |
| 108 HeapHashSet<Member<const StyleSheetContents>>& | 108 HeapHashSet<Member<const StyleSheetContents>>& |
| 109 visitedSharedStyleSheetContents) const { | 109 visitedSharedStyleSheetContents) const { |
| 110 features.viewportDependentMediaQueryResults().appendVector( | 110 features.viewportDependentMediaQueryResults().appendVector( |
| 111 m_viewportDependentMediaQueryResults); | 111 m_viewportDependentMediaQueryResults); |
| 112 features.deviceDependentMediaQueryResults().appendVector( | 112 features.deviceDependentMediaQueryResults().appendVector( |
| 113 m_deviceDependentMediaQueryResults); | 113 m_deviceDependentMediaQueryResults); |
| 114 | 114 |
| 115 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { | 115 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { |
| 116 ASSERT(m_authorStyleSheets[i]->ownerNode()); | 116 DCHECK(m_authorStyleSheets[i]->ownerNode()); |
| 117 StyleSheetContents* contents = m_authorStyleSheets[i]->contents(); | 117 StyleSheetContents* contents = m_authorStyleSheets[i]->contents(); |
| 118 if (contents->hasOneClient() || | 118 if (contents->hasOneClient() || |
| 119 visitedSharedStyleSheetContents.insert(contents).isNewEntry) | 119 visitedSharedStyleSheetContents.insert(contents).isNewEntry) |
| 120 features.add(contents->ruleSet().features()); | 120 features.add(contents->ruleSet().features()); |
| 121 } | 121 } |
| 122 | 122 |
| 123 if (!m_treeBoundaryCrossingRuleSet) | 123 if (!m_treeBoundaryCrossingRuleSet) |
| 124 return; | 124 return; |
| 125 | 125 |
| 126 for (const auto& rules : *m_treeBoundaryCrossingRuleSet) | 126 for (const auto& rules : *m_treeBoundaryCrossingRuleSet) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } | 204 } |
| 205 | 205 |
| 206 // If we have animations running, added/removed @keyframes may affect these. | 206 // If we have animations running, added/removed @keyframes may affect these. |
| 207 treeScope.document().timeline().invalidateKeyframeEffects(treeScope); | 207 treeScope.document().timeline().invalidateKeyframeEffects(treeScope); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void ScopedStyleResolver::collectMatchingAuthorRules( | 210 void ScopedStyleResolver::collectMatchingAuthorRules( |
| 211 ElementRuleCollector& collector, | 211 ElementRuleCollector& collector, |
| 212 CascadeOrder cascadeOrder) { | 212 CascadeOrder cascadeOrder) { |
| 213 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { | 213 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { |
| 214 ASSERT(m_authorStyleSheets[i]->ownerNode()); | 214 DCHECK(m_authorStyleSheets[i]->ownerNode()); |
| 215 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet(), | 215 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet(), |
| 216 &m_scope->rootNode(), m_authorStyleSheets[i], i); | 216 &m_scope->rootNode(), m_authorStyleSheets[i], i); |
| 217 collector.collectMatchingRules(matchRequest, cascadeOrder); | 217 collector.collectMatchingRules(matchRequest, cascadeOrder); |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 | 220 |
| 221 void ScopedStyleResolver::collectMatchingShadowHostRules( | 221 void ScopedStyleResolver::collectMatchingShadowHostRules( |
| 222 ElementRuleCollector& collector, | 222 ElementRuleCollector& collector, |
| 223 CascadeOrder cascadeOrder) { | 223 CascadeOrder cascadeOrder) { |
| 224 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { | 224 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { |
| 225 ASSERT(m_authorStyleSheets[i]->ownerNode()); | 225 DCHECK(m_authorStyleSheets[i]->ownerNode()); |
| 226 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet(), | 226 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet(), |
| 227 &m_scope->rootNode(), m_authorStyleSheets[i], i); | 227 &m_scope->rootNode(), m_authorStyleSheets[i], i); |
| 228 collector.collectMatchingShadowHostRules(matchRequest, cascadeOrder); | 228 collector.collectMatchingShadowHostRules(matchRequest, cascadeOrder); |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 | 231 |
| 232 void ScopedStyleResolver::collectMatchingTreeBoundaryCrossingRules( | 232 void ScopedStyleResolver::collectMatchingTreeBoundaryCrossingRules( |
| 233 ElementRuleCollector& collector, | 233 ElementRuleCollector& collector, |
| 234 CascadeOrder cascadeOrder) { | 234 CascadeOrder cascadeOrder) { |
| 235 if (!m_treeBoundaryCrossingRuleSet) | 235 if (!m_treeBoundaryCrossingRuleSet) |
| 236 return; | 236 return; |
| 237 | 237 |
| 238 for (const auto& rules : *m_treeBoundaryCrossingRuleSet) { | 238 for (const auto& rules : *m_treeBoundaryCrossingRuleSet) { |
| 239 MatchRequest request(rules->m_ruleSet.get(), &treeScope().rootNode(), | 239 MatchRequest request(rules->m_ruleSet.get(), &treeScope().rootNode(), |
| 240 rules->m_parentStyleSheet, rules->m_parentIndex); | 240 rules->m_parentStyleSheet, rules->m_parentIndex); |
| 241 collector.collectMatchingRules(request, cascadeOrder, true); | 241 collector.collectMatchingRules(request, cascadeOrder, true); |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 | 244 |
| 245 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) { | 245 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) { |
| 246 // Only consider the global author RuleSet for @page rules, as per the HTML5 | 246 // Only consider the global author RuleSet for @page rules, as per the HTML5 |
| 247 // spec. | 247 // spec. |
| 248 ASSERT(m_scope->rootNode().isDocumentNode()); | 248 DCHECK(m_scope->rootNode().isDocumentNode()); |
| 249 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) | 249 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) |
| 250 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet()); | 250 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet()); |
| 251 } | 251 } |
| 252 | 252 |
| 253 DEFINE_TRACE(ScopedStyleResolver) { | 253 DEFINE_TRACE(ScopedStyleResolver) { |
| 254 visitor->trace(m_scope); | 254 visitor->trace(m_scope); |
| 255 visitor->trace(m_authorStyleSheets); | 255 visitor->trace(m_authorStyleSheets); |
| 256 visitor->trace(m_viewportDependentMediaQueryResults); | 256 visitor->trace(m_viewportDependentMediaQueryResults); |
| 257 visitor->trace(m_deviceDependentMediaQueryResults); | 257 visitor->trace(m_deviceDependentMediaQueryResults); |
| 258 visitor->trace(m_keyframesRuleMap); | 258 visitor->trace(m_keyframesRuleMap); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 } | 319 } |
| 320 return true; | 320 return true; |
| 321 } | 321 } |
| 322 | 322 |
| 323 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) { | 323 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) { |
| 324 visitor->trace(m_parentStyleSheet); | 324 visitor->trace(m_parentStyleSheet); |
| 325 visitor->trace(m_ruleSet); | 325 visitor->trace(m_ruleSet); |
| 326 } | 326 } |
| 327 | 327 |
| 328 } // namespace blink | 328 } // namespace blink |
| OLD | NEW |