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

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

Issue 1106313003: Null check collection handling dirty scopes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed review issues Created 5 years, 7 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 | « LayoutTests/fast/dom/shadow/remove-stylesheet-from-shadow-crash-expected.txt ('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 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 void StyleEngine::addPendingSheet() 236 void StyleEngine::addPendingSheet()
237 { 237 {
238 m_pendingStylesheets++; 238 m_pendingStylesheets++;
239 } 239 }
240 240
241 // This method is called whenever a top-level stylesheet has finished loading. 241 // This method is called whenever a top-level stylesheet has finished loading.
242 void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode) 242 void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode)
243 { 243 {
244 ASSERT(styleSheetCandidateNode); 244 ASSERT(styleSheetCandidateNode);
245 TreeScope* treeScope = isStyleElement(*styleSheetCandidateNode) ? &styleShee tCandidateNode->treeScope() : m_document.get(); 245 TreeScope* treeScope = isStyleElement(*styleSheetCandidateNode) ? &styleShee tCandidateNode->treeScope() : m_document.get();
246 markTreeScopeDirty(*treeScope); 246 if (styleSheetCandidateNode->inDocument())
247 markTreeScopeDirty(*treeScope);
247 248
248 // Make sure we knew this sheet was pending, and that our count isn't out of sync. 249 // Make sure we knew this sheet was pending, and that our count isn't out of sync.
249 ASSERT(m_pendingStylesheets > 0); 250 ASSERT(m_pendingStylesheets > 0);
250 251
251 m_pendingStylesheets--; 252 m_pendingStylesheets--;
252 if (m_pendingStylesheets) 253 if (m_pendingStylesheets)
253 return; 254 return;
254 255
255 // FIXME: We can't call addedStyleSheet or removedStyleSheet here because we don't know 256 // FIXME: We can't call addedStyleSheet or removedStyleSheet here because we don't know
256 // what's new. We should track that to tell the style system what changed. 257 // what's new. We should track that to tell the style system what changed.
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 m_resolver->invalidateMatchedPropertiesCache(); 573 m_resolver->invalidateMatchedPropertiesCache();
573 } 574 }
574 575
575 void StyleEngine::markTreeScopeDirty(TreeScope& scope) 576 void StyleEngine::markTreeScopeDirty(TreeScope& scope)
576 { 577 {
577 if (scope == m_document) { 578 if (scope == m_document) {
578 markDocumentDirty(); 579 markDocumentDirty();
579 return; 580 return;
580 } 581 }
581 582
583 ASSERT(m_styleSheetCollectionMap.contains(&scope));
582 m_dirtyTreeScopes.add(&scope); 584 m_dirtyTreeScopes.add(&scope);
583 } 585 }
584 586
585 void StyleEngine::markDocumentDirty() 587 void StyleEngine::markDocumentDirty()
586 { 588 {
587 m_documentScopeDirty = true; 589 m_documentScopeDirty = true;
588 if (document().importLoader()) 590 if (document().importLoader())
589 document().importsController()->master()->styleEngine().markDocumentDirt y(); 591 document().importsController()->master()->styleEngine().markDocumentDirt y();
590 } 592 }
591 593
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 visitor->trace(m_dirtyTreeScopes); 707 visitor->trace(m_dirtyTreeScopes);
706 visitor->trace(m_activeTreeScopes); 708 visitor->trace(m_activeTreeScopes);
707 visitor->trace(m_fontSelector); 709 visitor->trace(m_fontSelector);
708 visitor->trace(m_textToSheetCache); 710 visitor->trace(m_textToSheetCache);
709 visitor->trace(m_sheetToTextCache); 711 visitor->trace(m_sheetToTextCache);
710 #endif 712 #endif
711 CSSFontSelectorClient::trace(visitor); 713 CSSFontSelectorClient::trace(visitor);
712 } 714 }
713 715
714 } 716 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/shadow/remove-stylesheet-from-shadow-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698