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

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

Issue 157853002: Revert of Use removeFontFace to avoid resetting fontSelector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/StyleEngine.h ('k') | Source/core/dom/TreeScopeStyleSheetCollection.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 14 matching lines...) Expand all
25 * Boston, MA 02110-1301, USA. 25 * Boston, MA 02110-1301, USA.
26 */ 26 */
27 27
28 #include "config.h" 28 #include "config.h"
29 #include "core/dom/StyleEngine.h" 29 #include "core/dom/StyleEngine.h"
30 30
31 #include "HTMLNames.h" 31 #include "HTMLNames.h"
32 #include "SVGNames.h" 32 #include "SVGNames.h"
33 #include "core/css/CSSFontSelector.h" 33 #include "core/css/CSSFontSelector.h"
34 #include "core/css/CSSStyleSheet.h" 34 #include "core/css/CSSStyleSheet.h"
35 #include "core/css/FontFaceCache.h"
36 #include "core/css/StyleInvalidationAnalysis.h" 35 #include "core/css/StyleInvalidationAnalysis.h"
37 #include "core/css/StyleSheetContents.h" 36 #include "core/css/StyleSheetContents.h"
38 #include "core/dom/DocumentStyleSheetCollector.h" 37 #include "core/dom/DocumentStyleSheetCollector.h"
39 #include "core/dom/Element.h" 38 #include "core/dom/Element.h"
40 #include "core/dom/ProcessingInstruction.h" 39 #include "core/dom/ProcessingInstruction.h"
41 #include "core/dom/ShadowTreeStyleSheetCollection.h" 40 #include "core/dom/ShadowTreeStyleSheetCollection.h"
42 #include "core/dom/shadow/ShadowRoot.h" 41 #include "core/dom/shadow/ShadowRoot.h"
43 #include "core/html/HTMLIFrameElement.h" 42 #include "core/html/HTMLIFrameElement.h"
44 #include "core/html/HTMLImport.h" 43 #include "core/html/HTMLImport.h"
45 #include "core/html/HTMLLinkElement.h" 44 #include "core/html/HTMLLinkElement.h"
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 m_didCalculateResolver = true; 512 m_didCalculateResolver = true;
514 if (m_document.didLayoutWithPendingStylesheets() && !hasPendingSheets()) 513 if (m_document.didLayoutWithPendingStylesheets() && !hasPendingSheets())
515 change.setNeedsRepaint(); 514 change.setNeedsRepaint();
516 515
517 if (updateActiveStyleSheets(mode)) 516 if (updateActiveStyleSheets(mode))
518 change.setNeedsStyleRecalc(); 517 change.setNeedsStyleRecalc();
519 518
520 return change; 519 return change;
521 } 520 }
522 521
523 void StyleEngine::clearFontCache() 522 void StyleEngine::resetFontSelector()
524 {
525 // We should not recreate FontSelector. Instead, clear fontFaceCache.
526 if (m_fontSelector)
527 m_fontSelector->fontFaceCache()->clear();
528 if (m_resolver)
529 m_resolver->invalidateMatchedPropertiesCache();
530 }
531
532 void StyleEngine::updateGenericFontFamilySettings()
533 { 523 {
534 if (!m_fontSelector) 524 if (!m_fontSelector)
535 return; 525 return;
536 526
537 m_fontSelector->updateGenericFontFamilySettings(m_document); 527 m_fontSelector->clearDocument();
538 if (m_resolver) 528 if (m_resolver) {
529 m_fontSelector->unregisterForInvalidationCallbacks(m_resolver.get());
539 m_resolver->invalidateMatchedPropertiesCache(); 530 m_resolver->invalidateMatchedPropertiesCache();
540 } 531 }
541 532
542 void StyleEngine::removeFontFaceRules(const Vector<const StyleRuleFontFace*>& fo ntFaceRules) 533 // If the document has been already detached, we don't need to recreate
543 { 534 // CSSFontSelector.
544 if (!m_fontSelector) 535 if (m_document.isActive()) {
545 return; 536 m_fontSelector = CSSFontSelector::create(&m_document);
546 537 if (m_resolver)
547 FontFaceCache* cache = m_fontSelector->fontFaceCache(); 538 m_fontSelector->registerForInvalidationCallbacks(m_resolver.get());
548 for (unsigned i = 0; i < fontFaceRules.size(); ++i) 539 } else {
549 cache->remove(fontFaceRules[i]); 540 m_fontSelector = 0;
550 if (m_resolver) 541 }
551 m_resolver->invalidateMatchedPropertiesCache();
552 } 542 }
553 543
554 void StyleEngine::markTreeScopeDirty(TreeScope& scope) 544 void StyleEngine::markTreeScopeDirty(TreeScope& scope)
555 { 545 {
556 if (scope == m_document) { 546 if (scope == m_document) {
557 markDocumentDirty(); 547 markDocumentDirty();
558 return; 548 return;
559 } 549 }
560 550
561 m_dirtyTreeScopes.add(&scope); 551 m_dirtyTreeScopes.add(&scope);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 { 600 {
611 HashMap<StyleSheetContents*, AtomicString>::iterator it = sheetToTextCache() .find(contents); 601 HashMap<StyleSheetContents*, AtomicString>::iterator it = sheetToTextCache() .find(contents);
612 if (it == sheetToTextCache().end()) 602 if (it == sheetToTextCache().end())
613 return; 603 return;
614 604
615 textToSheetCache().remove(it->value); 605 textToSheetCache().remove(it->value);
616 sheetToTextCache().remove(contents); 606 sheetToTextCache().remove(contents);
617 } 607 }
618 608
619 } 609 }
OLDNEW
« no previous file with comments | « Source/core/dom/StyleEngine.h ('k') | Source/core/dom/TreeScopeStyleSheetCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698