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

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

Issue 2624893003: Move the FontFaceCache stored in CSSFontSelector to be stored in Document. (Closed)
Patch Set: Add a helper function Created 3 years, 11 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 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 m_treeBoundaryCrossingScopes.clear(); 449 m_treeBoundaryCrossingScopes.clear();
450 m_dirtyTreeScopes.clear(); 450 m_dirtyTreeScopes.clear();
451 m_activeTreeScopes.clear(); 451 m_activeTreeScopes.clear();
452 m_viewportResolver = nullptr; 452 m_viewportResolver = nullptr;
453 m_mediaQueryEvaluator = nullptr; 453 m_mediaQueryEvaluator = nullptr;
454 clearFontCache(); 454 clearFontCache();
455 } 455 }
456 456
457 void StyleEngine::clearFontCache() { 457 void StyleEngine::clearFontCache() {
458 if (m_fontSelector) 458 if (m_fontSelector)
459 m_fontSelector->fontFaceCache()->clearCSSConnected(); 459 m_document->fontFaceCache()->clearCSSConnected();
460 if (m_resolver) 460 if (m_resolver)
461 m_resolver->invalidateMatchedPropertiesCache(); 461 m_resolver->invalidateMatchedPropertiesCache();
462 } 462 }
463 463
464 void StyleEngine::updateGenericFontFamilySettings() { 464 void StyleEngine::updateGenericFontFamilySettings() {
465 // FIXME: we should not update generic font family settings when 465 // FIXME: we should not update generic font family settings when
466 // document is inactive. 466 // document is inactive.
467 DCHECK(document().isActive()); 467 DCHECK(document().isActive());
468 468
469 if (!m_fontSelector) 469 if (!m_fontSelector)
470 return; 470 return;
471 471
472 m_fontSelector->updateGenericFontFamilySettings(*m_document); 472 m_fontSelector->updateGenericFontFamilySettings(*m_document);
473 if (m_resolver) 473 if (m_resolver)
474 m_resolver->invalidateMatchedPropertiesCache(); 474 m_resolver->invalidateMatchedPropertiesCache();
475 FontCache::fontCache()->invalidateShapeCache(); 475 FontCache::fontCache()->invalidateShapeCache();
476 } 476 }
477 477
478 void StyleEngine::removeFontFaceRules( 478 void StyleEngine::removeFontFaceRules(
479 const HeapVector<Member<const StyleRuleFontFace>>& fontFaceRules) { 479 const HeapVector<Member<const StyleRuleFontFace>>& fontFaceRules) {
480 if (!m_fontSelector) 480 if (!m_fontSelector)
481 return; 481 return;
482 482
483 FontFaceCache* cache = m_fontSelector->fontFaceCache(); 483 FontFaceCache* cache = m_document->fontFaceCache();
484 for (const auto& rule : fontFaceRules) 484 for (const auto& rule : fontFaceRules)
485 cache->remove(rule); 485 cache->remove(rule);
486 if (m_resolver) 486 if (m_resolver)
487 m_resolver->invalidateMatchedPropertiesCache(); 487 m_resolver->invalidateMatchedPropertiesCache();
488 } 488 }
489 489
490 void StyleEngine::markTreeScopeDirty(TreeScope& scope) { 490 void StyleEngine::markTreeScopeDirty(TreeScope& scope) {
491 if (scope == m_document) { 491 if (scope == m_document) {
492 markDocumentDirty(); 492 markDocumentDirty();
493 return; 493 return;
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 } 1132 }
1133 1133
1134 DEFINE_TRACE_WRAPPERS(StyleEngine) { 1134 DEFINE_TRACE_WRAPPERS(StyleEngine) {
1135 for (auto sheet : m_injectedAuthorStyleSheets) { 1135 for (auto sheet : m_injectedAuthorStyleSheets) {
1136 visitor->traceWrappers(sheet); 1136 visitor->traceWrappers(sheet);
1137 } 1137 }
1138 visitor->traceWrappers(m_documentStyleSheetCollection); 1138 visitor->traceWrappers(m_documentStyleSheetCollection);
1139 } 1139 }
1140 1140
1141 } // namespace blink 1141 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698