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

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

Issue 2546393002: Make setNeedsActiveStyleUpdate mark treescope dirty only. (Closed)
Patch Set: Created 4 years 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 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // sync. 178 // sync.
179 DCHECK_GT(m_pendingScriptBlockingStylesheets, 0); 179 DCHECK_GT(m_pendingScriptBlockingStylesheets, 0);
180 180
181 m_pendingScriptBlockingStylesheets--; 181 m_pendingScriptBlockingStylesheets--;
182 if (m_pendingScriptBlockingStylesheets) 182 if (m_pendingScriptBlockingStylesheets)
183 return; 183 return;
184 184
185 document().didRemoveAllPendingStylesheet(); 185 document().didRemoveAllPendingStylesheet();
186 } 186 }
187 187
188 void StyleEngine::setNeedsActiveStyleUpdate( 188 void StyleEngine::setNeedsActiveStyleUpdate(TreeScope& treeScope) {
189 StyleSheet* sheet,
190 StyleResolverUpdateMode updateMode) {
191 // resolverChanged() is called for inactive non-master documents because
192 // import documents are inactive documents. resolverChanged() for imports
193 // will call resolverChanged() for the master document and update the active
194 // stylesheets including the ones from the import.
195 if (!document().isActive() && isMaster()) 189 if (!document().isActive() && isMaster())
196 return; 190 return;
197 191
198 if (sheet && document().isActive()) { 192 markTreeScopeDirty(treeScope);
199 Node* node = sheet->ownerNode();
200 if (node && node->isConnected())
201 markTreeScopeDirty(node->treeScope());
202 }
203
204 resolverChanged(updateMode);
205 } 193 }
206 194
207 void StyleEngine::addStyleSheetCandidateNode(Node& node) { 195 void StyleEngine::addStyleSheetCandidateNode(Node& node) {
208 if (!node.isConnected() || document().isDetached()) 196 if (!node.isConnected() || document().isDetached())
209 return; 197 return;
210 198
211 DCHECK(!isXSLStyleSheet(node)); 199 DCHECK(!isXSLStyleSheet(node));
212 TreeScope& treeScope = node.treeScope(); 200 TreeScope& treeScope = node.treeScope();
213 TreeScopeStyleSheetCollection* collection = 201 TreeScopeStyleSheetCollection* collection =
214 ensureStyleSheetCollectionFor(treeScope); 202 ensureStyleSheetCollectionFor(treeScope);
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 if (m_resolver) 552 if (m_resolver)
565 m_resolver->invalidateMatchedPropertiesCache(); 553 m_resolver->invalidateMatchedPropertiesCache();
566 } 554 }
567 555
568 void StyleEngine::markTreeScopeDirty(TreeScope& scope) { 556 void StyleEngine::markTreeScopeDirty(TreeScope& scope) {
569 if (scope == m_document) { 557 if (scope == m_document) {
570 markDocumentDirty(); 558 markDocumentDirty();
571 return; 559 return;
572 } 560 }
573 561
574 DCHECK(m_styleSheetCollectionMap.contains(&scope)); 562 DCHECK(m_styleSheetCollectionMap.contains(&scope));
meade_UTC10 2016/12/05 23:57:22 It looks like this change is causing this DCHECK t
575 m_dirtyTreeScopes.add(&scope); 563 m_dirtyTreeScopes.add(&scope);
576 document().scheduleLayoutTreeUpdateIfNeeded(); 564 document().scheduleLayoutTreeUpdateIfNeeded();
577 } 565 }
578 566
579 void StyleEngine::markDocumentDirty() { 567 void StyleEngine::markDocumentDirty() {
580 m_documentScopeDirty = true; 568 m_documentScopeDirty = true;
581 if (RuntimeEnabledFeatures::cssViewportEnabled()) 569 if (RuntimeEnabledFeatures::cssViewportEnabled())
582 viewportRulesChanged(); 570 viewportRulesChanged();
583 if (document().importLoader()) 571 if (document().importLoader())
584 document().importsController()->master()->styleEngine().markDocumentDirty(); 572 document().importsController()->master()->styleEngine().markDocumentDirty();
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 } 1229 }
1242 1230
1243 DEFINE_TRACE_WRAPPERS(StyleEngine) { 1231 DEFINE_TRACE_WRAPPERS(StyleEngine) {
1244 for (auto sheet : m_injectedAuthorStyleSheets) { 1232 for (auto sheet : m_injectedAuthorStyleSheets) {
1245 visitor->traceWrappers(sheet); 1233 visitor->traceWrappers(sheet);
1246 } 1234 }
1247 visitor->traceWrappers(m_documentStyleSheetCollection); 1235 visitor->traceWrappers(m_documentStyleSheetCollection);
1248 } 1236 }
1249 1237
1250 } // namespace blink 1238 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698