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

Side by Side Diff: sky/engine/core/dom/StyleEngine.cpp

Issue 837883002: Store features in the ScopedStyleResoolver. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Simpler even. Created 5 years, 11 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 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 void StyleEngine::removeSheet(StyleSheetContents* contents) 197 void StyleEngine::removeSheet(StyleSheetContents* contents)
198 { 198 {
199 HashMap<StyleSheetContents*, AtomicString>::iterator it = m_sheetToTextCache .find(contents); 199 HashMap<StyleSheetContents*, AtomicString>::iterator it = m_sheetToTextCache .find(contents);
200 if (it == m_sheetToTextCache.end()) 200 if (it == m_sheetToTextCache.end())
201 return; 201 return;
202 202
203 m_textToSheetCache.remove(it->value); 203 m_textToSheetCache.remove(it->value);
204 m_sheetToTextCache.remove(contents); 204 m_sheetToTextCache.remove(contents);
205 } 205 }
206 206
207 // TODO(esprehn): This walks the entire document to collect features, instead
208 // we should store features per scope and get rid of the global set.
209 static void collectFeatures(TreeScope& scope, RuleFeatureSet& features, HashSet< const StyleSheetContents*> visitedSharedStyleSheetContents)
210 {
211 scope.scopedStyleResolver().collectFeaturesTo(features, visitedSharedStyleSh eetContents);
212 for (Element* element = ElementTraversal::firstWithin(scope.rootNode()); ele ment; element = ElementTraversal::next(*element, &scope.rootNode())) {
213 if (ShadowRoot* root = element->shadowRoot())
214 collectFeatures(*root, features, visitedSharedStyleSheetContents);
215 }
216 }
217
218 void StyleEngine::collectScopedStyleFeaturesTo(RuleFeatureSet& features) const
219 {
220 HashSet<const StyleSheetContents*> visitedSharedStyleSheetContents;
221 collectFeatures(*m_document, features, visitedSharedStyleSheetContents);
222 }
223
224 void StyleEngine::fontsNeedUpdate(CSSFontSelector*) 207 void StyleEngine::fontsNeedUpdate(CSSFontSelector*)
225 { 208 {
226 if (m_resolver) 209 if (m_resolver)
227 m_resolver->invalidateMatchedPropertiesCache(); 210 m_resolver->invalidateMatchedPropertiesCache();
228 m_document->setNeedsStyleRecalc(SubtreeStyleChange); 211 m_document->setNeedsStyleRecalc(SubtreeStyleChange);
229 } 212 }
230 213
231 } 214 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698