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

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

Issue 1998503002: CSS: Checked downcast for ShadowTreeStyleSheetCollection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 239
240 bool StyleEngine::shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdate Mode updateMode) const 240 bool StyleEngine::shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdate Mode updateMode) const
241 { 241 {
242 return !m_dirtyTreeScopes.isEmpty() || updateMode == FullStyleUpdate; 242 return !m_dirtyTreeScopes.isEmpty() || updateMode == FullStyleUpdate;
243 } 243 }
244 244
245 void StyleEngine::clearMediaQueryRuleSetOnTreeScopeStyleSheets(UnorderedTreeScop eSet& treeScopes) 245 void StyleEngine::clearMediaQueryRuleSetOnTreeScopeStyleSheets(UnorderedTreeScop eSet& treeScopes)
246 { 246 {
247 for (TreeScope* treeScope : treeScopes) { 247 for (TreeScope* treeScope : treeScopes) {
248 DCHECK(treeScope != m_document); 248 DCHECK(treeScope != m_document);
249 ShadowTreeStyleSheetCollection* collection = static_cast<ShadowTreeStyle SheetCollection*>(styleSheetCollectionFor(*treeScope)); 249 ShadowTreeStyleSheetCollection* collection = toShadowTreeStyleSheetColle ction(styleSheetCollectionFor(*treeScope));
250 DCHECK(collection); 250 DCHECK(collection);
251 collection->clearMediaQueryRuleSetStyleSheets(); 251 collection->clearMediaQueryRuleSetStyleSheets();
252 } 252 }
253 } 253 }
254 254
255 void StyleEngine::clearMediaQueryRuleSetStyleSheets() 255 void StyleEngine::clearMediaQueryRuleSetStyleSheets()
256 { 256 {
257 resolverChanged(FullStyleUpdate); 257 resolverChanged(FullStyleUpdate);
258 documentStyleSheetCollection()->clearMediaQueryRuleSetStyleSheets(); 258 documentStyleSheetCollection()->clearMediaQueryRuleSetStyleSheets();
259 clearMediaQueryRuleSetOnTreeScopeStyleSheets(m_activeTreeScopes); 259 clearMediaQueryRuleSetOnTreeScopeStyleSheets(m_activeTreeScopes);
260 } 260 }
261 261
262 void StyleEngine::updateStyleSheetsInImport(DocumentStyleSheetCollector& parentC ollector) 262 void StyleEngine::updateStyleSheetsInImport(DocumentStyleSheetCollector& parentC ollector)
263 { 263 {
264 DCHECK(!isMaster()); 264 DCHECK(!isMaster());
265 HeapVector<Member<StyleSheet>> sheetsForList; 265 HeapVector<Member<StyleSheet>> sheetsForList;
266 ImportedDocumentStyleSheetCollector subcollector(parentCollector, sheetsForL ist); 266 ImportedDocumentStyleSheetCollector subcollector(parentCollector, sheetsForL ist);
267 documentStyleSheetCollection()->collectStyleSheets(*this, subcollector); 267 documentStyleSheetCollection()->collectStyleSheets(*this, subcollector);
268 documentStyleSheetCollection()->swapSheetsForSheetList(sheetsForList); 268 documentStyleSheetCollection()->swapSheetsForSheetList(sheetsForList);
269 } 269 }
270 270
271 void StyleEngine::updateActiveStyleSheetsInShadow(StyleResolverUpdateMode update Mode, TreeScope* treeScope, UnorderedTreeScopeSet& treeScopesRemoved) 271 void StyleEngine::updateActiveStyleSheetsInShadow(StyleResolverUpdateMode update Mode, TreeScope* treeScope, UnorderedTreeScopeSet& treeScopesRemoved)
272 { 272 {
273 DCHECK_NE(treeScope, m_document); 273 DCHECK_NE(treeScope, m_document);
274 ShadowTreeStyleSheetCollection* collection = static_cast<ShadowTreeStyleShee tCollection*>(styleSheetCollectionFor(*treeScope)); 274 ShadowTreeStyleSheetCollection* collection = toShadowTreeStyleSheetCollectio n(styleSheetCollectionFor(*treeScope));
275 DCHECK(collection); 275 DCHECK(collection);
276 collection->updateActiveStyleSheets(*this, updateMode); 276 collection->updateActiveStyleSheets(*this, updateMode);
277 if (!collection->hasStyleSheetCandidateNodes()) { 277 if (!collection->hasStyleSheetCandidateNodes()) {
278 treeScopesRemoved.add(treeScope); 278 treeScopesRemoved.add(treeScope);
279 // When removing TreeScope from ActiveTreeScopes, 279 // When removing TreeScope from ActiveTreeScopes,
280 // its resolver should be destroyed by invoking resetAuthorStyle. 280 // its resolver should be destroyed by invoking resetAuthorStyle.
281 DCHECK(!treeScope->scopedStyleResolver()); 281 DCHECK(!treeScope->scopedStyleResolver());
282 } 282 }
283 } 283 }
284 284
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 visitor->trace(m_styleInvalidator); 759 visitor->trace(m_styleInvalidator);
760 visitor->trace(m_dirtyTreeScopes); 760 visitor->trace(m_dirtyTreeScopes);
761 visitor->trace(m_activeTreeScopes); 761 visitor->trace(m_activeTreeScopes);
762 visitor->trace(m_fontSelector); 762 visitor->trace(m_fontSelector);
763 visitor->trace(m_textToSheetCache); 763 visitor->trace(m_textToSheetCache);
764 visitor->trace(m_sheetToTextCache); 764 visitor->trace(m_sheetToTextCache);
765 CSSFontSelectorClient::trace(visitor); 765 CSSFontSelectorClient::trace(visitor);
766 } 766 }
767 767
768 } // namespace blink 768 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698