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

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

Issue 1006723003: Fix template angle bracket syntax in dom (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 | « Source/core/dom/StyleEngine.h ('k') | Source/core/dom/StyleSheetCollection.h » ('j') | 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 { 194 {
195 if (treeScope == m_document) 195 if (treeScope == m_document)
196 return documentStyleSheetCollection(); 196 return documentStyleSheetCollection();
197 197
198 StyleSheetCollectionMap::iterator it = m_styleSheetCollectionMap.find(&treeS cope); 198 StyleSheetCollectionMap::iterator it = m_styleSheetCollectionMap.find(&treeS cope);
199 if (it == m_styleSheetCollectionMap.end()) 199 if (it == m_styleSheetCollectionMap.end())
200 return 0; 200 return 0;
201 return it->value.get(); 201 return it->value.get();
202 } 202 }
203 203
204 const WillBeHeapVector<RefPtrWillBeMember<StyleSheet> >& StyleEngine::styleSheet sForStyleSheetList(TreeScope& treeScope) 204 const WillBeHeapVector<RefPtrWillBeMember<StyleSheet>>& StyleEngine::styleSheets ForStyleSheetList(TreeScope& treeScope)
205 { 205 {
206 if (treeScope == m_document) 206 if (treeScope == m_document)
207 return documentStyleSheetCollection()->styleSheetsForStyleSheetList(); 207 return documentStyleSheetCollection()->styleSheetsForStyleSheetList();
208 208
209 return ensureStyleSheetCollectionFor(treeScope)->styleSheetsForStyleSheetLis t(); 209 return ensureStyleSheetCollectionFor(treeScope)->styleSheetsForStyleSheetLis t();
210 } 210 }
211 211
212 const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> >& StyleEngine::activeA uthorStyleSheets() const 212 const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet>>& StyleEngine::activeAu thorStyleSheets() const
213 { 213 {
214 return documentStyleSheetCollection()->activeAuthorStyleSheets(); 214 return documentStyleSheetCollection()->activeAuthorStyleSheets();
215 } 215 }
216 216
217 void StyleEngine::combineCSSFeatureFlags(const RuleFeatureSet& features) 217 void StyleEngine::combineCSSFeatureFlags(const RuleFeatureSet& features)
218 { 218 {
219 // Delay resetting the flags until after next style recalc since unapplying the style may not work without these set (this is true at least with before/afte r). 219 // Delay resetting the flags until after next style recalc since unapplying the style may not work without these set (this is true at least with before/afte r).
220 m_usesSiblingRules = m_usesSiblingRules || features.usesSiblingRules(); 220 m_usesSiblingRules = m_usesSiblingRules || features.usesSiblingRules();
221 m_usesFirstLineRules = m_usesFirstLineRules || features.usesFirstLineRules() ; 221 m_usesFirstLineRules = m_usesFirstLineRules || features.usesFirstLineRules() ;
222 m_usesWindowInactiveSelector = m_usesWindowInactiveSelector || features.uses WindowInactiveSelector(); 222 m_usesWindowInactiveSelector = m_usesWindowInactiveSelector || features.uses WindowInactiveSelector();
223 m_maxDirectAdjacentSelectors = max(m_maxDirectAdjacentSelectors, features.ma xDirectAdjacentSelectors()); 223 m_maxDirectAdjacentSelectors = max(m_maxDirectAdjacentSelectors, features.ma xDirectAdjacentSelectors());
224 } 224 }
225 225
226 void StyleEngine::resetCSSFeatureFlags(const RuleFeatureSet& features) 226 void StyleEngine::resetCSSFeatureFlags(const RuleFeatureSet& features)
227 { 227 {
228 m_usesSiblingRules = features.usesSiblingRules(); 228 m_usesSiblingRules = features.usesSiblingRules();
229 m_usesFirstLineRules = features.usesFirstLineRules(); 229 m_usesFirstLineRules = features.usesFirstLineRules();
230 m_usesWindowInactiveSelector = features.usesWindowInactiveSelector(); 230 m_usesWindowInactiveSelector = features.usesWindowInactiveSelector();
231 m_maxDirectAdjacentSelectors = features.maxDirectAdjacentSelectors(); 231 m_maxDirectAdjacentSelectors = features.maxDirectAdjacentSelectors();
232 } 232 }
233 233
234 const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> >& StyleEngine::injecte dAuthorStyleSheets() const 234 const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet>>& StyleEngine::injected AuthorStyleSheets() const
235 { 235 {
236 updateInjectedStyleSheetCache(); 236 updateInjectedStyleSheetCache();
237 return m_injectedAuthorStyleSheets; 237 return m_injectedAuthorStyleSheets;
238 } 238 }
239 239
240 void StyleEngine::updateInjectedStyleSheetCache() const 240 void StyleEngine::updateInjectedStyleSheetCache() const
241 { 241 {
242 if (m_injectedStyleSheetCacheValid) 242 if (m_injectedStyleSheetCacheValid)
243 return; 243 return;
244 m_injectedStyleSheetCacheValid = true; 244 m_injectedStyleSheetCacheValid = true;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 void StyleEngine::clearMediaQueryRuleSetStyleSheets() 399 void StyleEngine::clearMediaQueryRuleSetStyleSheets()
400 { 400 {
401 documentStyleSheetCollection()->clearMediaQueryRuleSetStyleSheets(); 401 documentStyleSheetCollection()->clearMediaQueryRuleSetStyleSheets();
402 clearMediaQueryRuleSetOnTreeScopeStyleSheets(m_activeTreeScopes.beginUnorder ed(), m_activeTreeScopes.endUnordered()); 402 clearMediaQueryRuleSetOnTreeScopeStyleSheets(m_activeTreeScopes.beginUnorder ed(), m_activeTreeScopes.endUnordered());
403 clearMediaQueryRuleSetOnTreeScopeStyleSheets(m_dirtyTreeScopes.begin(), m_di rtyTreeScopes.end()); 403 clearMediaQueryRuleSetOnTreeScopeStyleSheets(m_dirtyTreeScopes.begin(), m_di rtyTreeScopes.end());
404 } 404 }
405 405
406 void StyleEngine::updateStyleSheetsInImport(DocumentStyleSheetCollector& parentC ollector) 406 void StyleEngine::updateStyleSheetsInImport(DocumentStyleSheetCollector& parentC ollector)
407 { 407 {
408 ASSERT(!isMaster()); 408 ASSERT(!isMaster());
409 WillBeHeapVector<RefPtrWillBeMember<StyleSheet> > sheetsForList; 409 WillBeHeapVector<RefPtrWillBeMember<StyleSheet>> sheetsForList;
410 ImportedDocumentStyleSheetCollector subcollector(parentCollector, sheetsForL ist); 410 ImportedDocumentStyleSheetCollector subcollector(parentCollector, sheetsForL ist);
411 documentStyleSheetCollection()->collectStyleSheets(*this, subcollector); 411 documentStyleSheetCollection()->collectStyleSheets(*this, subcollector);
412 documentStyleSheetCollection()->swapSheetsForSheetList(sheetsForList); 412 documentStyleSheetCollection()->swapSheetsForSheetList(sheetsForList);
413 } 413 }
414 414
415 void StyleEngine::updateActiveStyleSheetsInShadow(StyleResolverUpdateMode update Mode, TreeScope* treeScope, UnorderedTreeScopeSet& treeScopesRemoved) 415 void StyleEngine::updateActiveStyleSheetsInShadow(StyleResolverUpdateMode update Mode, TreeScope* treeScope, UnorderedTreeScopeSet& treeScopesRemoved)
416 { 416 {
417 ASSERT(treeScope != m_document); 417 ASSERT(treeScope != m_document);
418 ShadowTreeStyleSheetCollection* collection = static_cast<ShadowTreeStyleShee tCollection*>(styleSheetCollectionFor(*treeScope)); 418 ShadowTreeStyleSheetCollection* collection = static_cast<ShadowTreeStyleShee tCollection*>(styleSheetCollectionFor(*treeScope));
419 ASSERT(collection); 419 ASSERT(collection);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 m_activeTreeScopes.remove(*it); 452 m_activeTreeScopes.remove(*it);
453 } 453 }
454 454
455 InspectorInstrumentation::activeStyleSheetsUpdated(m_document); 455 InspectorInstrumentation::activeStyleSheetsUpdated(m_document);
456 m_usesRemUnits = documentStyleSheetCollection()->usesRemUnits(); 456 m_usesRemUnits = documentStyleSheetCollection()->usesRemUnits();
457 457
458 m_dirtyTreeScopes.clear(); 458 m_dirtyTreeScopes.clear();
459 m_documentScopeDirty = false; 459 m_documentScopeDirty = false;
460 } 460 }
461 461
462 const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> > StyleEngine::activeSt yleSheetsForInspector() const 462 const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet>> StyleEngine::activeSty leSheetsForInspector() const
463 { 463 {
464 if (m_activeTreeScopes.isEmpty()) 464 if (m_activeTreeScopes.isEmpty())
465 return documentStyleSheetCollection()->activeAuthorStyleSheets(); 465 return documentStyleSheetCollection()->activeAuthorStyleSheets();
466 466
467 WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> > activeStyleSheets; 467 WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet>> activeStyleSheets;
468 468
469 activeStyleSheets.appendVector(documentStyleSheetCollection()->activeAuthorS tyleSheets()); 469 activeStyleSheets.appendVector(documentStyleSheetCollection()->activeAuthorS tyleSheets());
470 for (unsigned i = 0; i < m_activeTreeScopes.size(); ++i) { 470 for (unsigned i = 0; i < m_activeTreeScopes.size(); ++i) {
471 TreeScope* treeScope = const_cast<TreeScope*>(m_activeTreeScopes[i]); 471 TreeScope* treeScope = const_cast<TreeScope*>(m_activeTreeScopes[i]);
472 if (TreeScopeStyleSheetCollection* collection = m_styleSheetCollectionMa p.get(treeScope)) 472 if (TreeScopeStyleSheetCollection* collection = m_styleSheetCollectionMa p.get(treeScope))
473 activeStyleSheets.appendVector(collection->activeAuthorStyleSheets() ); 473 activeStyleSheets.appendVector(collection->activeAuthorStyleSheets() );
474 } 474 }
475 475
476 // FIXME: Inspector needs a vector which has all active stylesheets. 476 // FIXME: Inspector needs a vector which has all active stylesheets.
477 // However, creating such a large vector might cause performance regression. 477 // However, creating such a large vector might cause performance regression.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 ASSERT(document().isActive()); 603 ASSERT(document().isActive());
604 604
605 if (!m_fontSelector) 605 if (!m_fontSelector)
606 return; 606 return;
607 607
608 m_fontSelector->updateGenericFontFamilySettings(*m_document); 608 m_fontSelector->updateGenericFontFamilySettings(*m_document);
609 if (m_resolver) 609 if (m_resolver)
610 m_resolver->invalidateMatchedPropertiesCache(); 610 m_resolver->invalidateMatchedPropertiesCache();
611 } 611 }
612 612
613 void StyleEngine::removeFontFaceRules(const WillBeHeapVector<RawPtrWillBeMember< const StyleRuleFontFace> >& fontFaceRules) 613 void StyleEngine::removeFontFaceRules(const WillBeHeapVector<RawPtrWillBeMember< const StyleRuleFontFace>>& fontFaceRules)
614 { 614 {
615 if (!m_fontSelector) 615 if (!m_fontSelector)
616 return; 616 return;
617 617
618 FontFaceCache* cache = m_fontSelector->fontFaceCache(); 618 FontFaceCache* cache = m_fontSelector->fontFaceCache();
619 for (unsigned i = 0; i < fontFaceRules.size(); ++i) 619 for (unsigned i = 0; i < fontFaceRules.size(); ++i)
620 cache->remove(fontFaceRules[i]); 620 cache->remove(fontFaceRules[i]);
621 if (m_resolver) 621 if (m_resolver)
622 m_resolver->invalidateMatchedPropertiesCache(); 622 m_resolver->invalidateMatchedPropertiesCache();
623 } 623 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 656
657 PassRefPtrWillBeRawPtr<CSSStyleSheet> StyleEngine::createSheet(Element* e, const String& text, TextPosition startPosition, bool createdByParser) 657 PassRefPtrWillBeRawPtr<CSSStyleSheet> StyleEngine::createSheet(Element* e, const String& text, TextPosition startPosition, bool createdByParser)
658 { 658 {
659 RefPtrWillBeRawPtr<CSSStyleSheet> styleSheet = nullptr; 659 RefPtrWillBeRawPtr<CSSStyleSheet> styleSheet = nullptr;
660 660
661 e->document().styleEngine().addPendingSheet(); 661 e->document().styleEngine().addPendingSheet();
662 662
663 if (!e->document().inQuirksMode()) { 663 if (!e->document().inQuirksMode()) {
664 AtomicString textContent(text); 664 AtomicString textContent(text);
665 665
666 WillBeHeapHashMap<AtomicString, RawPtrWillBeMember<StyleSheetContents> > ::AddResult result = m_textToSheetCache.add(textContent, nullptr); 666 WillBeHeapHashMap<AtomicString, RawPtrWillBeMember<StyleSheetContents>>: :AddResult result = m_textToSheetCache.add(textContent, nullptr);
667 if (result.isNewEntry || !result.storedValue->value) { 667 if (result.isNewEntry || !result.storedValue->value) {
668 styleSheet = StyleEngine::parseSheet(e, text, startPosition, created ByParser); 668 styleSheet = StyleEngine::parseSheet(e, text, startPosition, created ByParser);
669 if (result.isNewEntry && isCacheableForStyleElement(*styleSheet->con tents())) { 669 if (result.isNewEntry && isCacheableForStyleElement(*styleSheet->con tents())) {
670 result.storedValue->value = styleSheet->contents(); 670 result.storedValue->value = styleSheet->contents();
671 m_sheetToTextCache.add(styleSheet->contents(), textContent); 671 m_sheetToTextCache.add(styleSheet->contents(), textContent);
672 } 672 }
673 } else { 673 } else {
674 StyleSheetContents* contents = result.storedValue->value; 674 StyleSheetContents* contents = result.storedValue->value;
675 ASSERT(contents); 675 ASSERT(contents);
676 ASSERT(isCacheableForStyleElement(*contents)); 676 ASSERT(isCacheableForStyleElement(*contents));
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 visitor->trace(m_dirtyTreeScopes); 756 visitor->trace(m_dirtyTreeScopes);
757 visitor->trace(m_activeTreeScopes); 757 visitor->trace(m_activeTreeScopes);
758 visitor->trace(m_fontSelector); 758 visitor->trace(m_fontSelector);
759 visitor->trace(m_textToSheetCache); 759 visitor->trace(m_textToSheetCache);
760 visitor->trace(m_sheetToTextCache); 760 visitor->trace(m_sheetToTextCache);
761 #endif 761 #endif
762 CSSFontSelectorClient::trace(visitor); 762 CSSFontSelectorClient::trace(visitor);
763 } 763 }
764 764
765 } 765 }
OLDNEW
« no previous file with comments | « Source/core/dom/StyleEngine.h ('k') | Source/core/dom/StyleSheetCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698