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

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

Issue 195903002: Only process each StyleSheetContents once when collecting features during style resolution (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Only hash shared stylesheets Created 6 years, 9 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 | Annotate | Revision Log
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 { 71 {
72 m_authorStyleSheets.append(cssSheet); 72 m_authorStyleSheets.append(cssSheet);
73 StyleSheetContents* sheet = cssSheet->contents(); 73 StyleSheetContents* sheet = cssSheet->contents();
74 74
75 AddRuleFlags addRuleFlags = resolver->document().securityOrigin()->canReques t(sheet->baseURL()) ? RuleHasDocumentSecurityOrigin : RuleHasNoSpecialState; 75 AddRuleFlags addRuleFlags = resolver->document().securityOrigin()->canReques t(sheet->baseURL()) ? RuleHasDocumentSecurityOrigin : RuleHasNoSpecialState;
76 const RuleSet& ruleSet = sheet->ensureRuleSet(medium, addRuleFlags); 76 const RuleSet& ruleSet = sheet->ensureRuleSet(medium, addRuleFlags);
77 resolver->addMediaQueryResults(ruleSet.viewportDependentMediaQueryResults()) ; 77 resolver->addMediaQueryResults(ruleSet.viewportDependentMediaQueryResults()) ;
78 resolver->processScopedRules(ruleSet, sheet->baseURL(), &m_scopingNode); 78 resolver->processScopedRules(ruleSet, sheet->baseURL(), &m_scopingNode);
79 } 79 }
80 80
81 void ScopedStyleResolver::collectFeaturesTo(RuleFeatureSet& features) 81 void ScopedStyleResolver::collectFeaturesTo(RuleFeatureSet& features, HashSet<co nst StyleSheetContents*>& visitedSharedStyleSheetContents)
82 { 82 {
83 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) 83 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) {
84 features.add(m_authorStyleSheets[i]->contents()->ruleSet().features()); 84 StyleSheetContents* contents = m_authorStyleSheets[i]->contents();
85 if (contents->hasOneClient() || visitedSharedStyleSheetContents.add(cont ents).isNewEntry)
86 features.add(contents->ruleSet().features());
87 }
85 } 88 }
86 89
87 void ScopedStyleResolver::resetAuthorStyle() 90 void ScopedStyleResolver::resetAuthorStyle()
88 { 91 {
89 m_authorStyleSheets.clear(); 92 m_authorStyleSheets.clear();
90 m_keyframesRuleMap.clear(); 93 m_keyframesRuleMap.clear();
91 } 94 }
92 95
93 const StyleRuleKeyframes* ScopedStyleResolver::keyframeStylesForAnimation(const StringImpl* animationName) 96 const StyleRuleKeyframes* ScopedStyleResolver::keyframeStylesForAnimation(const StringImpl* animationName)
94 { 97 {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 149
147 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const 150 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const
148 { 151 {
149 if (!m_scopingNode.isDocumentNode()) 152 if (!m_scopingNode.isDocumentNode())
150 return; 153 return;
151 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) 154 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i)
152 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin); 155 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin);
153 } 156 }
154 157
155 } // namespace WebCore 158 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/ScopedStyleResolver.h ('k') | Source/core/css/resolver/ScopedStyleTree.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698