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

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: Fix fast/text/international/ regression 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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 m_didCalculateResolver = true; 528 m_didCalculateResolver = true;
529 if (m_document.didLayoutWithPendingStylesheets() && !hasPendingSheets()) 529 if (m_document.didLayoutWithPendingStylesheets() && !hasPendingSheets())
530 change.setNeedsRepaint(); 530 change.setNeedsRepaint();
531 531
532 if (updateActiveStyleSheets(mode)) 532 if (updateActiveStyleSheets(mode))
533 change.setNeedsStyleRecalc(); 533 change.setNeedsStyleRecalc();
534 534
535 return change; 535 return change;
536 } 536 }
537 537
538 void StyleEngine::resetFontSelector() 538 void StyleEngine::clearFontCache()
539 {
540 // We should not recreate FontSelector. Instead, clear fontFaceCache.
541 if (m_fontSelector)
542 m_fontSelector->fontFaceCache()->clear();
543 if (m_resolver)
544 m_resolver->invalidateMatchedPropertiesCache();
545 }
546
547 void StyleEngine::updateGenericFontFamilySettings()
dglazkov 2014/01/29 05:11:50 Why do we need a separate function for this? When
tasak 2014/01/29 10:13:43 The updateGenericFontFamilySettings will be invoke
539 { 548 {
540 if (!m_fontSelector) 549 if (!m_fontSelector)
541 return; 550 return;
542 551
543 m_fontSelector->clearDocument(); 552 m_fontSelector->updateGenericFontFamilySettings(m_document);
544 if (m_resolver) { 553 if (m_resolver)
545 m_fontSelector->unregisterForInvalidationCallbacks(m_resolver.get());
546 m_resolver->invalidateMatchedPropertiesCache(); 554 m_resolver->invalidateMatchedPropertiesCache();
547 } 555 }
548 556
549 // If the document has been already detached, we don't need to recreate 557 void StyleEngine::removeFontFaceRules(const Vector<const StyleRuleFontFace*>& fo ntFaceRules)
550 // CSSFontSelector. 558 {
551 if (m_document.isActive()) { 559 if (!m_fontSelector)
552 m_fontSelector = CSSFontSelector::create(&m_document); 560 return;
553 if (m_resolver) 561
554 m_fontSelector->registerForInvalidationCallbacks(m_resolver.get()); 562 CSSSegmentedFontFaceCache* cache = m_fontSelector->fontFaceCache();
555 } else { 563 for (unsigned i = 0; i < fontFaceRules.size(); ++i)
556 m_fontSelector = 0; 564 cache->remove(fontFaceRules[i]);
557 } 565 if (m_resolver)
566 m_resolver->invalidateMatchedPropertiesCache();
558 } 567 }
559 568
560 void StyleEngine::markTreeScopeDirty(TreeScope& scope) 569 void StyleEngine::markTreeScopeDirty(TreeScope& scope)
561 { 570 {
562 if (scope == m_document) { 571 if (scope == m_document) {
563 markDocumentDirty(); 572 markDocumentDirty();
564 return; 573 return;
565 } 574 }
566 575
567 m_dirtyTreeScopes.add(&scope); 576 m_dirtyTreeScopes.add(&scope);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 { 625 {
617 HashMap<StyleSheetContents*, AtomicString>::iterator it = sheetToTextCache() .find(contents); 626 HashMap<StyleSheetContents*, AtomicString>::iterator it = sheetToTextCache() .find(contents);
618 if (it == sheetToTextCache().end()) 627 if (it == sheetToTextCache().end())
619 return; 628 return;
620 629
621 textToSheetCache().remove(it->value); 630 textToSheetCache().remove(it->value);
622 sheetToTextCache().remove(contents); 631 sheetToTextCache().remove(contents);
623 } 632 }
624 633
625 } 634 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698