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

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: Alternative fix checking for collection in markTreeScopeDirty 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 markTreeScopeDirty(*treeScope);
tasak 2015/04/30 08:16:20 I think, we should check the styleSheetCandidateNo
rune 2015/04/30 08:35:45 Done.
247 247
248 // Make sure we knew this sheet was pending, and that our count isn't out of sync. 248 // Make sure we knew this sheet was pending, and that our count isn't out of sync.
249 ASSERT(m_pendingStylesheets > 0); 249 ASSERT(m_pendingStylesheets > 0);
250 250
251 m_pendingStylesheets--; 251 m_pendingStylesheets--;
252 if (m_pendingStylesheets) 252 if (m_pendingStylesheets)
253 return; 253 return;
254 254
255 // FIXME: We can't call addedStyleSheet or removedStyleSheet here because we don't know 255 // 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. 256 // 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(); 572 m_resolver->invalidateMatchedPropertiesCache();
573 } 573 }
574 574
575 void StyleEngine::markTreeScopeDirty(TreeScope& scope) 575 void StyleEngine::markTreeScopeDirty(TreeScope& scope)
576 { 576 {
577 if (scope == m_document) { 577 if (scope == m_document) {
578 markDocumentDirty(); 578 markDocumentDirty();
579 return; 579 return;
580 } 580 }
581 581
582 m_dirtyTreeScopes.add(&scope); 582 if (m_styleSheetCollectionMap.contains(&scope))
tasak 2015/04/30 08:16:20 I think, it would be better to use ASSERT here, i.
rune 2015/04/30 08:35:45 Done.
583 m_dirtyTreeScopes.add(&scope);
583 } 584 }
584 585
585 void StyleEngine::markDocumentDirty() 586 void StyleEngine::markDocumentDirty()
586 { 587 {
587 m_documentScopeDirty = true; 588 m_documentScopeDirty = true;
588 if (document().importLoader()) 589 if (document().importLoader())
589 document().importsController()->master()->styleEngine().markDocumentDirt y(); 590 document().importsController()->master()->styleEngine().markDocumentDirt y();
590 } 591 }
591 592
592 static bool isCacheableForStyleElement(const StyleSheetContents& contents) 593 static bool isCacheableForStyleElement(const StyleSheetContents& contents)
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 visitor->trace(m_dirtyTreeScopes); 706 visitor->trace(m_dirtyTreeScopes);
706 visitor->trace(m_activeTreeScopes); 707 visitor->trace(m_activeTreeScopes);
707 visitor->trace(m_fontSelector); 708 visitor->trace(m_fontSelector);
708 visitor->trace(m_textToSheetCache); 709 visitor->trace(m_textToSheetCache);
709 visitor->trace(m_sheetToTextCache); 710 visitor->trace(m_sheetToTextCache);
710 #endif 711 #endif
711 CSSFontSelectorClient::trace(visitor); 712 CSSFontSelectorClient::trace(visitor);
712 } 713 }
713 714
714 } 715 }
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