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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "platform/TraceEvent.h" | 49 #include "platform/TraceEvent.h" |
50 #include "platform/fonts/FontCache.h" | 50 #include "platform/fonts/FontCache.h" |
51 | 51 |
52 namespace blink { | 52 namespace blink { |
53 | 53 |
54 using namespace HTMLNames; | 54 using namespace HTMLNames; |
55 | 55 |
56 StyleEngine::StyleEngine(Document& document) | 56 StyleEngine::StyleEngine(Document& document) |
57 : m_document(&document) | 57 : m_document(&document) |
58 , m_isMaster(!document.importsController() || document.importsController()->
master() == &document) | 58 , m_isMaster(!document.importsController() || document.importsController()->
master() == &document) |
59 , m_pendingStylesheets(0) | |
60 , m_documentStyleSheetCollection(DocumentStyleSheetCollection::create(docume
nt)) | 59 , m_documentStyleSheetCollection(DocumentStyleSheetCollection::create(docume
nt)) |
61 , m_documentScopeDirty(true) | |
62 , m_usesSiblingRules(false) | |
63 , m_usesFirstLineRules(false) | |
64 , m_usesWindowInactiveSelector(false) | |
65 , m_usesRemUnits(false) | |
66 , m_maxDirectAdjacentSelectors(0) | |
67 , m_ignorePendingStylesheets(false) | |
68 , m_didCalculateResolver(false) | |
69 // We don't need to create CSSFontSelector for imported document or | 60 // We don't need to create CSSFontSelector for imported document or |
70 // HTMLTemplateElement's document, because those documents have no frame. | 61 // HTMLTemplateElement's document, because those documents have no frame. |
71 , m_fontSelector(document.frame() ? CSSFontSelector::create(&document) : nul
lptr) | 62 , m_fontSelector(document.frame() ? CSSFontSelector::create(&document) : nul
lptr) |
72 { | 63 { |
73 if (m_fontSelector) | 64 if (m_fontSelector) |
74 m_fontSelector->registerForInvalidationCallbacks(this); | 65 m_fontSelector->registerForInvalidationCallbacks(this); |
75 } | 66 } |
76 | 67 |
77 StyleEngine::~StyleEngine() | 68 StyleEngine::~StyleEngine() |
78 { | 69 { |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 m_resolver.clear(); | 418 m_resolver.clear(); |
428 } | 419 } |
429 } | 420 } |
430 | 421 |
431 void StyleEngine::clearMasterResolver() | 422 void StyleEngine::clearMasterResolver() |
432 { | 423 { |
433 if (Document* master = this->master()) | 424 if (Document* master = this->master()) |
434 master->styleEngine().clearResolver(); | 425 master->styleEngine().clearResolver(); |
435 } | 426 } |
436 | 427 |
437 unsigned StyleEngine::resolverAccessCount() const | |
438 { | |
439 return m_resolver ? m_resolver->accessCount() : 0; | |
440 } | |
441 | |
442 void StyleEngine::didDetach() | 428 void StyleEngine::didDetach() |
443 { | 429 { |
444 clearResolver(); | 430 clearResolver(); |
445 } | 431 } |
446 | 432 |
447 bool StyleEngine::shouldClearResolver() const | 433 bool StyleEngine::shouldClearResolver() const |
448 { | 434 { |
449 return !m_didCalculateResolver && !haveStylesheetsLoaded(); | 435 return !m_didCalculateResolver && !haveStylesheetsLoaded(); |
450 } | 436 } |
451 | 437 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 void StyleEngine::pseudoStateChangedForElement(CSSSelector::PseudoType pseudoTyp
e, Element& element) | 705 void StyleEngine::pseudoStateChangedForElement(CSSSelector::PseudoType pseudoTyp
e, Element& element) |
720 { | 706 { |
721 if (shouldSkipInvalidationFor(element)) | 707 if (shouldSkipInvalidationFor(element)) |
722 return; | 708 return; |
723 | 709 |
724 InvalidationLists invalidationLists; | 710 InvalidationLists invalidationLists; |
725 ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForPse
udoClass(invalidationLists, element, pseudoType); | 711 ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForPse
udoClass(invalidationLists, element, pseudoType); |
726 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); | 712 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); |
727 } | 713 } |
728 | 714 |
| 715 void StyleEngine::setStatsEnabled(bool enabled) |
| 716 { |
| 717 if (!enabled) { |
| 718 m_styleResolverStats = nullptr; |
| 719 return; |
| 720 } |
| 721 if (!m_styleResolverStats) |
| 722 m_styleResolverStats = StyleResolverStats::create(); |
| 723 else |
| 724 m_styleResolverStats->reset(); |
| 725 } |
| 726 |
729 DEFINE_TRACE(StyleEngine) | 727 DEFINE_TRACE(StyleEngine) |
730 { | 728 { |
731 #if ENABLE(OILPAN) | 729 #if ENABLE(OILPAN) |
732 visitor->trace(m_document); | 730 visitor->trace(m_document); |
733 visitor->trace(m_injectedAuthorStyleSheets); | 731 visitor->trace(m_injectedAuthorStyleSheets); |
734 visitor->trace(m_documentStyleSheetCollection); | 732 visitor->trace(m_documentStyleSheetCollection); |
735 visitor->trace(m_styleSheetCollectionMap); | 733 visitor->trace(m_styleSheetCollectionMap); |
736 visitor->trace(m_resolver); | 734 visitor->trace(m_resolver); |
737 visitor->trace(m_styleInvalidator); | 735 visitor->trace(m_styleInvalidator); |
738 visitor->trace(m_dirtyTreeScopes); | 736 visitor->trace(m_dirtyTreeScopes); |
739 visitor->trace(m_activeTreeScopes); | 737 visitor->trace(m_activeTreeScopes); |
740 visitor->trace(m_fontSelector); | 738 visitor->trace(m_fontSelector); |
741 visitor->trace(m_textToSheetCache); | 739 visitor->trace(m_textToSheetCache); |
742 visitor->trace(m_sheetToTextCache); | 740 visitor->trace(m_sheetToTextCache); |
743 #endif | 741 #endif |
744 CSSFontSelectorClient::trace(visitor); | 742 CSSFontSelectorClient::trace(visitor); |
745 } | 743 } |
746 | 744 |
747 } // namespace blink | 745 } // namespace blink |
OLD | NEW |