| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |