Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Side by Side Diff: Source/core/css/resolver/ScopedStyleResolver.cpp

Issue 579253002: Change StyleResolver::document() to be private (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 ScopedStyleResolver* ScopedStyleResolver::parent() const 62 ScopedStyleResolver* ScopedStyleResolver::parent() const
63 { 63 {
64 for (TreeScope* scope = treeScope().parentTreeScope(); scope; scope = scope- >parentTreeScope()) { 64 for (TreeScope* scope = treeScope().parentTreeScope(); scope; scope = scope- >parentTreeScope()) {
65 if (ScopedStyleResolver* resolver = scope->scopedStyleResolver()) 65 if (ScopedStyleResolver* resolver = scope->scopedStyleResolver())
66 return resolver; 66 return resolver;
67 } 67 }
68 return 0; 68 return 0;
69 } 69 }
70 70
71 void ScopedStyleResolver::addRulesFromSheet(CSSStyleSheet* cssSheet, const Media QueryEvaluator& medium, StyleResolver* resolver) 71 unsigned ScopedStyleResolver::appendCSSStyleSheet(CSSStyleSheet* cssSheet)
72 { 72 {
73 m_authorStyleSheets.append(cssSheet); 73 m_authorStyleSheets.append(cssSheet);
74 unsigned index = m_authorStyleSheets.size() - 1; 74 return m_authorStyleSheets.size() - 1;
75 StyleSheetContents* sheet = cssSheet->contents();
76
77 AddRuleFlags addRuleFlags = resolver->document().securityOrigin()->canReques t(sheet->baseURL()) ? RuleHasDocumentSecurityOrigin : RuleHasNoSpecialState;
78 const RuleSet& ruleSet = sheet->ensureRuleSet(medium, addRuleFlags);
79 resolver->addMediaQueryResults(ruleSet.viewportDependentMediaQueryResults()) ;
80 resolver->processScopedRules(ruleSet, cssSheet, index, treeScope().rootNode( ));
81 } 75 }
82 76
83 void ScopedStyleResolver::collectFeaturesTo(RuleFeatureSet& features, HashSet<co nst StyleSheetContents*>& visitedSharedStyleSheetContents) const 77 void ScopedStyleResolver::collectFeaturesTo(RuleFeatureSet& features, HashSet<co nst StyleSheetContents*>& visitedSharedStyleSheetContents) const
84 { 78 {
85 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { 79 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) {
86 StyleSheetContents* contents = m_authorStyleSheets[i]->contents(); 80 StyleSheetContents* contents = m_authorStyleSheets[i]->contents();
87 if (contents->hasOneClient() || visitedSharedStyleSheetContents.add(cont ents).isNewEntry) 81 if (contents->hasOneClient() || visitedSharedStyleSheetContents.add(cont ents).isNewEntry)
88 features.add(contents->ruleSet().features()); 82 features.add(contents->ruleSet().features());
89 } 83 }
90 } 84 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 void ScopedStyleResolver::trace(Visitor* visitor) 148 void ScopedStyleResolver::trace(Visitor* visitor)
155 { 149 {
156 #if ENABLE(OILPAN) 150 #if ENABLE(OILPAN)
157 visitor->trace(m_scope); 151 visitor->trace(m_scope);
158 visitor->trace(m_authorStyleSheets); 152 visitor->trace(m_authorStyleSheets);
159 visitor->trace(m_keyframesRuleMap); 153 visitor->trace(m_keyframesRuleMap);
160 #endif 154 #endif
161 } 155 }
162 156
163 } // namespace blink 157 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/resolver/ScopedStyleResolver.h ('k') | Source/core/css/resolver/StyleResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698