| 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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 687     m_fontSelector = fontSelector; | 687     m_fontSelector = fontSelector; | 
| 688 } | 688 } | 
| 689 | 689 | 
| 690 void StyleEngine::platformColorsChanged() | 690 void StyleEngine::platformColorsChanged() | 
| 691 { | 691 { | 
| 692     if (m_resolver) | 692     if (m_resolver) | 
| 693         m_resolver->invalidateMatchedPropertiesCache(); | 693         m_resolver->invalidateMatchedPropertiesCache(); | 
| 694     document().setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTraci
     ng::create(StyleChangeReason::PlatformColorChange)); | 694     document().setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTraci
     ng::create(StyleChangeReason::PlatformColorChange)); | 
| 695 } | 695 } | 
| 696 | 696 | 
|  | 697 void StyleEngine::classChangedForElement(const SpaceSplitString& changedClasses,
      Element& element) | 
|  | 698 { | 
|  | 699     ASSERT(isMaster()); | 
|  | 700     InvalidationSetVector invalidationSets; | 
|  | 701     unsigned changedSize = changedClasses.size(); | 
|  | 702     RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSe
     t(); | 
|  | 703     for (unsigned i = 0; i < changedSize; ++i) | 
|  | 704         ruleFeatureSet.collectInvalidationSetsForClass(invalidationSets, element
     , changedClasses[i]); | 
|  | 705     scheduleInvalidationSetsForElement(invalidationSets, element); | 
|  | 706 } | 
|  | 707 | 
|  | 708 void StyleEngine::classChangedForElement(const SpaceSplitString& oldClasses, con
     st SpaceSplitString& newClasses, Element& element) | 
|  | 709 { | 
|  | 710     ASSERT(isMaster()); | 
|  | 711     InvalidationSetVector invalidationSets; | 
|  | 712     if (!oldClasses.size()) { | 
|  | 713         classChangedForElement(newClasses, element); | 
|  | 714         return; | 
|  | 715     } | 
|  | 716 | 
|  | 717     // Class vectors tend to be very short. This is faster than using a hash tab
     le. | 
|  | 718     BitVector remainingClassBits; | 
|  | 719     remainingClassBits.ensureSize(oldClasses.size()); | 
|  | 720 | 
|  | 721     RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSe
     t(); | 
|  | 722 | 
|  | 723     for (unsigned i = 0; i < newClasses.size(); ++i) { | 
|  | 724         bool found = false; | 
|  | 725         for (unsigned j = 0; j < oldClasses.size(); ++j) { | 
|  | 726             if (newClasses[i] == oldClasses[j]) { | 
|  | 727                 // Mark each class that is still in the newClasses so we can ski
     p doing | 
|  | 728                 // an n^2 search below when looking for removals. We can't break
      from | 
|  | 729                 // this loop early since a class can appear more than once. | 
|  | 730                 remainingClassBits.quickSet(j); | 
|  | 731                 found = true; | 
|  | 732             } | 
|  | 733         } | 
|  | 734         // Class was added. | 
|  | 735         if (!found) | 
|  | 736             ruleFeatureSet.collectInvalidationSetsForClass(invalidationSets, ele
     ment, newClasses[i]); | 
|  | 737     } | 
|  | 738 | 
|  | 739     for (unsigned i = 0; i < oldClasses.size(); ++i) { | 
|  | 740         if (remainingClassBits.quickGet(i)) | 
|  | 741             continue; | 
|  | 742         // Class was removed. | 
|  | 743         ruleFeatureSet.collectInvalidationSetsForClass(invalidationSets, element
     , oldClasses[i]); | 
|  | 744     } | 
|  | 745 | 
|  | 746     scheduleInvalidationSetsForElement(invalidationSets, element); | 
|  | 747 } | 
|  | 748 | 
|  | 749 void StyleEngine::attributeChangedForElement(const QualifiedName& attributeName,
      Element& element) | 
|  | 750 { | 
|  | 751     ASSERT(isMaster()); | 
|  | 752     InvalidationSetVector invalidationSets; | 
|  | 753     ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForAtt
     ribute(invalidationSets, element, attributeName); | 
|  | 754     scheduleInvalidationSetsForElement(invalidationSets, element); | 
|  | 755 } | 
|  | 756 | 
|  | 757 void StyleEngine::idChangedForElement(const AtomicString& oldId, const AtomicStr
     ing& newId, Element& element) | 
|  | 758 { | 
|  | 759     ASSERT(isMaster()); | 
|  | 760     InvalidationSetVector invalidationSets; | 
|  | 761     RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSe
     t(); | 
|  | 762     if (!oldId.isEmpty()) | 
|  | 763         ruleFeatureSet.collectInvalidationSetsForId(invalidationSets, element, o
     ldId); | 
|  | 764     if (!newId.isEmpty()) | 
|  | 765         ruleFeatureSet.collectInvalidationSetsForId(invalidationSets, element, n
     ewId); | 
|  | 766     scheduleInvalidationSetsForElement(invalidationSets, element); | 
|  | 767 } | 
|  | 768 | 
|  | 769 void StyleEngine::pseudoStateChangedForElement(CSSSelector::PseudoType pseudoTyp
     e, Element& element) | 
|  | 770 { | 
|  | 771     ASSERT(isMaster()); | 
|  | 772     InvalidationSetVector invalidationSets; | 
|  | 773     ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForPse
     udoClass(invalidationSets, element, pseudoType); | 
|  | 774     scheduleInvalidationSetsForElement(invalidationSets, element); | 
|  | 775 } | 
|  | 776 | 
|  | 777 void StyleEngine::scheduleInvalidationSetsForElement(const InvalidationSetVector
     & invalidationSets, Element& element) | 
|  | 778 { | 
|  | 779     for (auto invalidationSet : invalidationSets) | 
|  | 780         m_styleInvalidator.scheduleInvalidation(invalidationSet, element); | 
|  | 781 } | 
|  | 782 | 
| 697 DEFINE_TRACE(StyleEngine) | 783 DEFINE_TRACE(StyleEngine) | 
| 698 { | 784 { | 
| 699 #if ENABLE(OILPAN) | 785 #if ENABLE(OILPAN) | 
| 700     visitor->trace(m_document); | 786     visitor->trace(m_document); | 
| 701     visitor->trace(m_authorStyleSheets); | 787     visitor->trace(m_authorStyleSheets); | 
| 702     visitor->trace(m_documentStyleSheetCollection); | 788     visitor->trace(m_documentStyleSheetCollection); | 
| 703     visitor->trace(m_styleSheetCollectionMap); | 789     visitor->trace(m_styleSheetCollectionMap); | 
| 704     visitor->trace(m_resolver); | 790     visitor->trace(m_resolver); | 
|  | 791     visitor->trace(m_styleInvalidator); | 
| 705     visitor->trace(m_dirtyTreeScopes); | 792     visitor->trace(m_dirtyTreeScopes); | 
| 706     visitor->trace(m_activeTreeScopes); | 793     visitor->trace(m_activeTreeScopes); | 
| 707     visitor->trace(m_fontSelector); | 794     visitor->trace(m_fontSelector); | 
| 708     visitor->trace(m_textToSheetCache); | 795     visitor->trace(m_textToSheetCache); | 
| 709     visitor->trace(m_sheetToTextCache); | 796     visitor->trace(m_sheetToTextCache); | 
| 710 #endif | 797 #endif | 
| 711     CSSFontSelectorClient::trace(visitor); | 798     CSSFontSelectorClient::trace(visitor); | 
| 712 } | 799 } | 
| 713 | 800 | 
| 714 } | 801 } | 
| OLD | NEW | 
|---|