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

Side by Side Diff: Source/core/dom/TreeScopeStyleSheetCollection.cpp

Issue 1313443003: Fix crash when removing stylesheets from shadow tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed review issues and added test. Created 5 years, 4 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
« no previous file with comments | « Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, 2010, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 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) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2013 Google Inc. All rights reserved. 9 * Copyright (C) 2013 Google Inc. All rights reserved.
10 * 10 *
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 // No point in doing the analysis work if we're just going to recalc the who le document anyways. 152 // No point in doing the analysis work if we're just going to recalc the who le document anyways.
153 // This needs to be done after the compareStyleSheets calls above to ensure we don't throw away 153 // This needs to be done after the compareStyleSheets calls above to ensure we don't throw away
154 // the StyleResolver if we don't need to. 154 // the StyleResolver if we don't need to.
155 if (document().hasPendingForcedStyleRecalc()) 155 if (document().hasPendingForcedStyleRecalc())
156 return; 156 return;
157 157
158 // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs. 158 // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs.
159 if (!document().body() || document().hasNodesWithPlaceholderStyle()) 159 if (!document().body() || document().hasNodesWithPlaceholderStyle())
160 return; 160 return;
161 StyleSheetInvalidationAnalysis invalidationAnalysis(addedSheets); 161 StyleSheetInvalidationAnalysis invalidationAnalysis(*m_treeScope, addedSheet s);
162 if (invalidationAnalysis.dirtiesAllStyle()) 162 if (invalidationAnalysis.dirtiesAllStyle())
163 return; 163 return;
164 invalidationAnalysis.invalidateStyle(document()); 164 invalidationAnalysis.invalidateStyle();
165 change.requiresFullStyleRecalc = false; 165 change.requiresFullStyleRecalc = false;
166 return; 166 return;
167 } 167 }
168 168
169 void TreeScopeStyleSheetCollection::clearMediaQueryRuleSetStyleSheets() 169 void TreeScopeStyleSheetCollection::clearMediaQueryRuleSetStyleSheets()
170 { 170 {
171 for (size_t i = 0; i < m_activeAuthorStyleSheets.size(); ++i) { 171 for (size_t i = 0; i < m_activeAuthorStyleSheets.size(); ++i) {
172 StyleSheetContents* contents = m_activeAuthorStyleSheets[i]->contents(); 172 StyleSheetContents* contents = m_activeAuthorStyleSheets[i]->contents();
173 if (contents->hasMediaQueries()) 173 if (contents->hasMediaQueries())
174 contents->clearRuleSet(); 174 contents->clearRuleSet();
175 } 175 }
176 } 176 }
177 177
178 DEFINE_TRACE(TreeScopeStyleSheetCollection) 178 DEFINE_TRACE(TreeScopeStyleSheetCollection)
179 { 179 {
180 visitor->trace(m_treeScope); 180 visitor->trace(m_treeScope);
181 visitor->trace(m_styleSheetCandidateNodes); 181 visitor->trace(m_styleSheetCandidateNodes);
182 StyleSheetCollection::trace(visitor); 182 StyleSheetCollection::trace(visitor);
183 } 183 }
184 184
185 } 185 }
OLDNEW
« no previous file with comments | « Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698