| 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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 m_fontSelector->registerForInvalidationCallbacks(this); | 620 m_fontSelector->registerForInvalidationCallbacks(this); |
| 621 } | 621 } |
| 622 | 622 |
| 623 void StyleEngine::platformColorsChanged() | 623 void StyleEngine::platformColorsChanged() |
| 624 { | 624 { |
| 625 if (m_resolver) | 625 if (m_resolver) |
| 626 m_resolver->invalidateMatchedPropertiesCache(); | 626 m_resolver->invalidateMatchedPropertiesCache(); |
| 627 document().setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTraci
ng::create(StyleChangeReason::PlatformColorChange)); | 627 document().setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTraci
ng::create(StyleChangeReason::PlatformColorChange)); |
| 628 } | 628 } |
| 629 | 629 |
| 630 bool StyleEngine::shouldSkipInvalidationFor(const Element& element) const |
| 631 { |
| 632 if (!resolver()) |
| 633 return true; |
| 634 if (!element.inActiveDocument()) |
| 635 return true; |
| 636 if (!element.parentNode()) |
| 637 return true; |
| 638 return element.parentNode()->styleChangeType() >= SubtreeStyleChange; |
| 639 } |
| 640 |
| 630 void StyleEngine::classChangedForElement(const SpaceSplitString& changedClasses,
Element& element) | 641 void StyleEngine::classChangedForElement(const SpaceSplitString& changedClasses,
Element& element) |
| 631 { | 642 { |
| 632 ASSERT(isMaster()); | 643 if (shouldSkipInvalidationFor(element)) |
| 644 return; |
| 633 InvalidationLists invalidationLists; | 645 InvalidationLists invalidationLists; |
| 634 unsigned changedSize = changedClasses.size(); | 646 unsigned changedSize = changedClasses.size(); |
| 635 RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSe
t(); | 647 RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSe
t(); |
| 636 for (unsigned i = 0; i < changedSize; ++i) | 648 for (unsigned i = 0; i < changedSize; ++i) |
| 637 ruleFeatureSet.collectInvalidationSetsForClass(invalidationLists, elemen
t, changedClasses[i]); | 649 ruleFeatureSet.collectInvalidationSetsForClass(invalidationLists, elemen
t, changedClasses[i]); |
| 638 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); | 650 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); |
| 639 } | 651 } |
| 640 | 652 |
| 641 void StyleEngine::classChangedForElement(const SpaceSplitString& oldClasses, con
st SpaceSplitString& newClasses, Element& element) | 653 void StyleEngine::classChangedForElement(const SpaceSplitString& oldClasses, con
st SpaceSplitString& newClasses, Element& element) |
| 642 { | 654 { |
| 643 ASSERT(isMaster()); | 655 if (shouldSkipInvalidationFor(element)) |
| 656 return; |
| 657 |
| 644 if (!oldClasses.size()) { | 658 if (!oldClasses.size()) { |
| 645 classChangedForElement(newClasses, element); | 659 classChangedForElement(newClasses, element); |
| 646 return; | 660 return; |
| 647 } | 661 } |
| 648 | 662 |
| 649 // Class vectors tend to be very short. This is faster than using a hash tab
le. | 663 // Class vectors tend to be very short. This is faster than using a hash tab
le. |
| 650 BitVector remainingClassBits; | 664 BitVector remainingClassBits; |
| 651 remainingClassBits.ensureSize(oldClasses.size()); | 665 remainingClassBits.ensureSize(oldClasses.size()); |
| 652 | 666 |
| 653 InvalidationLists invalidationLists; | 667 InvalidationLists invalidationLists; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 674 continue; | 688 continue; |
| 675 // Class was removed. | 689 // Class was removed. |
| 676 ruleFeatureSet.collectInvalidationSetsForClass(invalidationLists, elemen
t, oldClasses[i]); | 690 ruleFeatureSet.collectInvalidationSetsForClass(invalidationLists, elemen
t, oldClasses[i]); |
| 677 } | 691 } |
| 678 | 692 |
| 679 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); | 693 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); |
| 680 } | 694 } |
| 681 | 695 |
| 682 void StyleEngine::attributeChangedForElement(const QualifiedName& attributeName,
Element& element) | 696 void StyleEngine::attributeChangedForElement(const QualifiedName& attributeName,
Element& element) |
| 683 { | 697 { |
| 684 ASSERT(isMaster()); | 698 if (shouldSkipInvalidationFor(element)) |
| 699 return; |
| 700 |
| 685 InvalidationLists invalidationLists; | 701 InvalidationLists invalidationLists; |
| 686 ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForAtt
ribute(invalidationLists, element, attributeName); | 702 ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForAtt
ribute(invalidationLists, element, attributeName); |
| 687 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); | 703 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); |
| 688 } | 704 } |
| 689 | 705 |
| 690 void StyleEngine::idChangedForElement(const AtomicString& oldId, const AtomicStr
ing& newId, Element& element) | 706 void StyleEngine::idChangedForElement(const AtomicString& oldId, const AtomicStr
ing& newId, Element& element) |
| 691 { | 707 { |
| 692 ASSERT(isMaster()); | 708 if (shouldSkipInvalidationFor(element)) |
| 709 return; |
| 710 |
| 693 InvalidationLists invalidationLists; | 711 InvalidationLists invalidationLists; |
| 694 RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSe
t(); | 712 RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSe
t(); |
| 695 if (!oldId.isEmpty()) | 713 if (!oldId.isEmpty()) |
| 696 ruleFeatureSet.collectInvalidationSetsForId(invalidationLists, element,
oldId); | 714 ruleFeatureSet.collectInvalidationSetsForId(invalidationLists, element,
oldId); |
| 697 if (!newId.isEmpty()) | 715 if (!newId.isEmpty()) |
| 698 ruleFeatureSet.collectInvalidationSetsForId(invalidationLists, element,
newId); | 716 ruleFeatureSet.collectInvalidationSetsForId(invalidationLists, element,
newId); |
| 699 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); | 717 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); |
| 700 } | 718 } |
| 701 | 719 |
| 702 void StyleEngine::pseudoStateChangedForElement(CSSSelector::PseudoType pseudoTyp
e, Element& element) | 720 void StyleEngine::pseudoStateChangedForElement(CSSSelector::PseudoType pseudoTyp
e, Element& element) |
| 703 { | 721 { |
| 704 ASSERT(isMaster()); | 722 if (shouldSkipInvalidationFor(element)) |
| 723 return; |
| 724 |
| 705 InvalidationLists invalidationLists; | 725 InvalidationLists invalidationLists; |
| 706 ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForPse
udoClass(invalidationLists, element, pseudoType); | 726 ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForPse
udoClass(invalidationLists, element, pseudoType); |
| 707 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); | 727 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); |
| 708 } | 728 } |
| 709 | 729 |
| 710 DEFINE_TRACE(StyleEngine) | 730 DEFINE_TRACE(StyleEngine) |
| 711 { | 731 { |
| 712 #if ENABLE(OILPAN) | 732 #if ENABLE(OILPAN) |
| 713 visitor->trace(m_document); | 733 visitor->trace(m_document); |
| 714 visitor->trace(m_injectedAuthorStyleSheets); | 734 visitor->trace(m_injectedAuthorStyleSheets); |
| 715 visitor->trace(m_documentStyleSheetCollection); | 735 visitor->trace(m_documentStyleSheetCollection); |
| 716 visitor->trace(m_styleSheetCollectionMap); | 736 visitor->trace(m_styleSheetCollectionMap); |
| 717 visitor->trace(m_resolver); | 737 visitor->trace(m_resolver); |
| 718 visitor->trace(m_styleInvalidator); | 738 visitor->trace(m_styleInvalidator); |
| 719 visitor->trace(m_dirtyTreeScopes); | 739 visitor->trace(m_dirtyTreeScopes); |
| 720 visitor->trace(m_activeTreeScopes); | 740 visitor->trace(m_activeTreeScopes); |
| 721 visitor->trace(m_fontSelector); | 741 visitor->trace(m_fontSelector); |
| 722 visitor->trace(m_textToSheetCache); | 742 visitor->trace(m_textToSheetCache); |
| 723 visitor->trace(m_sheetToTextCache); | 743 visitor->trace(m_sheetToTextCache); |
| 724 #endif | 744 #endif |
| 725 CSSFontSelectorClient::trace(visitor); | 745 CSSFontSelectorClient::trace(visitor); |
| 726 } | 746 } |
| 727 | 747 |
| 728 } | 748 } |
| OLD | NEW |