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

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

Issue 82583005: Use removeFontFace to avoid resetting fontSelector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Modified resetFontSelector Created 6 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 | Annotate | Revision Log
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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 m_didCalculateResolver = true; 520 m_didCalculateResolver = true;
521 if (m_document.didLayoutWithPendingStylesheets() && !hasPendingSheets()) 521 if (m_document.didLayoutWithPendingStylesheets() && !hasPendingSheets())
522 change.setNeedsRepaint(); 522 change.setNeedsRepaint();
523 523
524 if (updateActiveStyleSheets(mode)) 524 if (updateActiveStyleSheets(mode))
525 change.setNeedsStyleRecalc(); 525 change.setNeedsStyleRecalc();
526 526
527 return change; 527 return change;
528 } 528 }
529 529
530 void StyleEngine::resetFontSelector() 530 void StyleEngine::resetFontSelector()
dglazkov 2014/01/23 19:15:06 Add a fixme to rename the method?
tasak 2014/01/28 07:16:57 I renamed the method. Now it is clearFontCache().
531 { 531 {
532 // We should not recreate FontSelector. Instead, clear fontFaceCache.
533 if (m_fontSelector)
534 m_fontSelector->fontFaceCache()->clear();
535 if (m_resolver)
536 m_resolver->invalidateMatchedPropertiesCache();
537 }
538
539 void StyleEngine::removeFontFaceRules(const Vector<const StyleRuleFontFace*>& fo ntFaceRules)
540 {
532 if (!m_fontSelector) 541 if (!m_fontSelector)
533 return; 542 return;
534 543
535 m_fontSelector->clearDocument(); 544 CSSSegmentedFontFaceCache* cache = m_fontSelector->fontFaceCache();
536 if (m_resolver) { 545 for (unsigned i = 0; i < fontFaceRules.size(); ++i)
537 m_fontSelector->unregisterForInvalidationCallbacks(m_resolver.get()); 546 cache->remove(fontFaceRules[i]);
547 if (m_resolver)
538 m_resolver->invalidateMatchedPropertiesCache(); 548 m_resolver->invalidateMatchedPropertiesCache();
539 }
540
541 // If the document has been already detached, we don't need to recreate
542 // CSSFontSelector.
543 if (m_document.isActive()) {
544 m_fontSelector = CSSFontSelector::create(&m_document);
545 if (m_resolver)
546 m_fontSelector->registerForInvalidationCallbacks(m_resolver.get());
547 } else {
548 m_fontSelector = 0;
549 }
550 } 549 }
551 550
552 void StyleEngine::markTreeScopeDirty(TreeScope& scope) 551 void StyleEngine::markTreeScopeDirty(TreeScope& scope)
553 { 552 {
554 if (scope == m_document) { 553 if (scope == m_document) {
555 markDocumentDirty(); 554 markDocumentDirty();
556 return; 555 return;
557 } 556 }
558 557
559 m_dirtyTreeScopes.add(&scope); 558 m_dirtyTreeScopes.add(&scope);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 { 607 {
609 HashMap<StyleSheetContents*, AtomicString>::iterator it = sheetToTextCache() .find(contents); 608 HashMap<StyleSheetContents*, AtomicString>::iterator it = sheetToTextCache() .find(contents);
610 if (it == sheetToTextCache().end()) 609 if (it == sheetToTextCache().end())
611 return; 610 return;
612 611
613 textToSheetCache().remove(it->value); 612 textToSheetCache().remove(it->value);
614 sheetToTextCache().remove(contents); 613 sheetToTextCache().remove(contents);
615 } 614 }
616 615
617 } 616 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698