Chromium Code Reviews| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 } | 70 } |
| 71 | 71 |
| 72 void ScopedStyleResolver::addRulesFromSheet(CSSStyleSheet* cssSheet, const Media QueryEvaluator& medium, StyleResolver* resolver) | 72 void ScopedStyleResolver::addRulesFromSheet(CSSStyleSheet* cssSheet, const Media QueryEvaluator& medium, StyleResolver* resolver) |
| 73 { | 73 { |
| 74 m_authorStyleSheets.append(cssSheet); | 74 m_authorStyleSheets.append(cssSheet); |
| 75 StyleSheetContents* sheet = cssSheet->contents(); | 75 StyleSheetContents* sheet = cssSheet->contents(); |
| 76 | 76 |
| 77 AddRuleFlags addRuleFlags = resolver->document().securityOrigin()->canReques t(sheet->baseURL()) ? RuleHasDocumentSecurityOrigin : RuleHasNoSpecialState; | 77 AddRuleFlags addRuleFlags = resolver->document().securityOrigin()->canReques t(sheet->baseURL()) ? RuleHasDocumentSecurityOrigin : RuleHasNoSpecialState; |
| 78 const RuleSet& ruleSet = sheet->ensureRuleSet(medium, addRuleFlags); | 78 const RuleSet& ruleSet = sheet->ensureRuleSet(medium, addRuleFlags); |
| 79 resolver->addMediaQueryResults(ruleSet.viewportDependentMediaQueryResults()) ; | 79 resolver->addMediaQueryResults(ruleSet.viewportDependentMediaQueryResults()) ; |
| 80 resolver->processScopedRules(ruleSet, cssSheet, m_scope.rootNode()); | 80 resolver->processScopedRules(ruleSet, cssSheet, m_scope->rootNode()); |
|
tkent
2014/07/24 04:30:09
nit: We prefer a reference. treeScope().rootNode(
haraken
2014/07/24 04:37:41
Done.
| |
| 81 } | 81 } |
| 82 | 82 |
| 83 void ScopedStyleResolver::collectFeaturesTo(RuleFeatureSet& features, HashSet<co nst StyleSheetContents*>& visitedSharedStyleSheetContents) | 83 void ScopedStyleResolver::collectFeaturesTo(RuleFeatureSet& features, HashSet<co nst StyleSheetContents*>& visitedSharedStyleSheetContents) |
| 84 { | 84 { |
| 85 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { | 85 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { |
| 86 StyleSheetContents* contents = m_authorStyleSheets[i]->contents(); | 86 StyleSheetContents* contents = m_authorStyleSheets[i]->contents(); |
| 87 if (contents->hasOneClient() || visitedSharedStyleSheetContents.add(cont ents).isNewEntry) | 87 if (contents->hasOneClient() || visitedSharedStyleSheetContents.add(cont ents).isNewEntry) |
| 88 features.add(contents->ruleSet().features()); | 88 features.add(contents->ruleSet().features()); |
| 89 } | 89 } |
| 90 } | 90 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 } | 144 } |
| 145 | 145 |
| 146 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const | 146 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const |
| 147 { | 147 { |
| 148 if (!scopingNode().isDocumentNode()) | 148 if (!scopingNode().isDocumentNode()) |
| 149 return; | 149 return; |
| 150 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) | 150 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) |
| 151 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin); | 151 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void ScopedStyleResolver::trace(Visitor* visitor) | |
| 155 { | |
| 156 visitor->trace(m_scope); | |
| 157 visitor->trace(m_authorStyleSheets); | |
| 158 visitor->trace(m_keyframesRuleMap); | |
| 159 } | |
| 160 | |
| 154 } // namespace blink | 161 } // namespace blink |
| OLD | NEW |