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

Side by Side Diff: third_party/WebKit/Source/core/dom/StyleEngine.cpp

Issue 2611053004: Use setNeedsActiveStyleUpdate instead of markTreeScopeDirty. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/shadow/move-shadow-host-to-child-iframe-crash.html ('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, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 context.addingPendingSheet(document()); 163 context.addingPendingSheet(document());
164 if (context.addedPendingSheetBeforeBody()) 164 if (context.addedPendingSheetBeforeBody())
165 m_pendingRenderBlockingStylesheets++; 165 m_pendingRenderBlockingStylesheets++;
166 } 166 }
167 167
168 // This method is called whenever a top-level stylesheet has finished loading. 168 // This method is called whenever a top-level stylesheet has finished loading.
169 void StyleEngine::removePendingSheet(Node& styleSheetCandidateNode, 169 void StyleEngine::removePendingSheet(Node& styleSheetCandidateNode,
170 const StyleEngineContext& context) { 170 const StyleEngineContext& context) {
171 if (styleSheetCandidateNode.isConnected()) 171 if (styleSheetCandidateNode.isConnected())
172 markTreeScopeDirty(styleSheetCandidateNode.treeScope()); 172 setNeedsActiveStyleUpdate(styleSheetCandidateNode.treeScope());
173 173
174 if (context.addedPendingSheetBeforeBody()) { 174 if (context.addedPendingSheetBeforeBody()) {
175 DCHECK_GT(m_pendingRenderBlockingStylesheets, 0); 175 DCHECK_GT(m_pendingRenderBlockingStylesheets, 0);
176 m_pendingRenderBlockingStylesheets--; 176 m_pendingRenderBlockingStylesheets--;
177 } 177 }
178 178
179 // Make sure we knew this sheet was pending, and that our count isn't out of 179 // Make sure we knew this sheet was pending, and that our count isn't out of
180 // sync. 180 // sync.
181 DCHECK_GT(m_pendingScriptBlockingStylesheets, 0); 181 DCHECK_GT(m_pendingScriptBlockingStylesheets, 0);
182 182
(...skipping 13 matching lines...) Expand all
196 if (!node.isConnected() || document().isDetached()) 196 if (!node.isConnected() || document().isDetached())
197 return; 197 return;
198 198
199 DCHECK(!isXSLStyleSheet(node)); 199 DCHECK(!isXSLStyleSheet(node));
200 TreeScope& treeScope = node.treeScope(); 200 TreeScope& treeScope = node.treeScope();
201 TreeScopeStyleSheetCollection* collection = 201 TreeScopeStyleSheetCollection* collection =
202 ensureStyleSheetCollectionFor(treeScope); 202 ensureStyleSheetCollectionFor(treeScope);
203 DCHECK(collection); 203 DCHECK(collection);
204 collection->addStyleSheetCandidateNode(node); 204 collection->addStyleSheetCandidateNode(node);
205 205
206 markTreeScopeDirty(treeScope); 206 setNeedsActiveStyleUpdate(treeScope);
207 if (treeScope != m_document) 207 if (treeScope != m_document)
208 m_activeTreeScopes.add(&treeScope); 208 m_activeTreeScopes.add(&treeScope);
209 } 209 }
210 210
211 void StyleEngine::removeStyleSheetCandidateNode(Node& node, 211 void StyleEngine::removeStyleSheetCandidateNode(Node& node,
212 ContainerNode& insertionPoint) { 212 ContainerNode& insertionPoint) {
213 DCHECK(!isXSLStyleSheet(node)); 213 DCHECK(!isXSLStyleSheet(node));
214 DCHECK(insertionPoint.isConnected()); 214 DCHECK(insertionPoint.isConnected());
215 215
216 ShadowRoot* shadowRoot = node.containingShadowRoot(); 216 ShadowRoot* shadowRoot = node.containingShadowRoot();
217 if (!shadowRoot) 217 if (!shadowRoot)
218 shadowRoot = insertionPoint.containingShadowRoot(); 218 shadowRoot = insertionPoint.containingShadowRoot();
219 219
220 TreeScope& treeScope = 220 TreeScope& treeScope =
221 shadowRoot ? *toTreeScope(shadowRoot) : toTreeScope(document()); 221 shadowRoot ? *toTreeScope(shadowRoot) : toTreeScope(document());
222 TreeScopeStyleSheetCollection* collection = 222 TreeScopeStyleSheetCollection* collection =
223 styleSheetCollectionFor(treeScope); 223 styleSheetCollectionFor(treeScope);
224 // After detaching document, collection could be null. In the case, 224 // After detaching document, collection could be null. In the case,
225 // we should not update anything. Instead, just return. 225 // we should not update anything. Instead, just return.
226 if (!collection) 226 if (!collection)
227 return; 227 return;
228 collection->removeStyleSheetCandidateNode(node); 228 collection->removeStyleSheetCandidateNode(node);
229 229
230 markTreeScopeDirty(treeScope); 230 setNeedsActiveStyleUpdate(treeScope);
231 } 231 }
232 232
233 void StyleEngine::modifiedStyleSheetCandidateNode(Node& node) { 233 void StyleEngine::modifiedStyleSheetCandidateNode(Node& node) {
234 if (node.isConnected()) 234 if (node.isConnected())
235 markTreeScopeDirty(node.treeScope()); 235 setNeedsActiveStyleUpdate(node.treeScope());
236 } 236 }
237 237
238 void StyleEngine::mediaQueriesChangedInScope(TreeScope& treeScope) { 238 void StyleEngine::mediaQueriesChangedInScope(TreeScope& treeScope) {
239 if (ScopedStyleResolver* resolver = treeScope.scopedStyleResolver()) 239 if (ScopedStyleResolver* resolver = treeScope.scopedStyleResolver())
240 resolver->setNeedsAppendAllSheets(); 240 resolver->setNeedsAppendAllSheets();
241 setNeedsActiveStyleUpdate(treeScope); 241 setNeedsActiveStyleUpdate(treeScope);
242 } 242 }
243 243
244 void StyleEngine::watchedSelectorsChanged() { 244 void StyleEngine::watchedSelectorsChanged() {
245 m_globalRuleSet.initWatchedSelectorsRuleSet(document()); 245 m_globalRuleSet.initWatchedSelectorsRuleSet(document());
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 } 1131 }
1132 1132
1133 DEFINE_TRACE_WRAPPERS(StyleEngine) { 1133 DEFINE_TRACE_WRAPPERS(StyleEngine) {
1134 for (auto sheet : m_injectedAuthorStyleSheets) { 1134 for (auto sheet : m_injectedAuthorStyleSheets) {
1135 visitor->traceWrappers(sheet); 1135 visitor->traceWrappers(sheet);
1136 } 1136 }
1137 visitor->traceWrappers(m_documentStyleSheetCollection); 1137 visitor->traceWrappers(m_documentStyleSheetCollection);
1138 } 1138 }
1139 1139
1140 } // namespace blink 1140 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/shadow/move-shadow-host-to-child-iframe-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698