| 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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 | 600 |
| 601 void StyleEngine::classChangedForElement(const SpaceSplitString& changedClasses,
Element& element) | 601 void StyleEngine::classChangedForElement(const SpaceSplitString& changedClasses,
Element& element) |
| 602 { | 602 { |
| 603 if (shouldSkipInvalidationFor(element)) | 603 if (shouldSkipInvalidationFor(element)) |
| 604 return; | 604 return; |
| 605 InvalidationLists invalidationLists; | 605 InvalidationLists invalidationLists; |
| 606 unsigned changedSize = changedClasses.size(); | 606 unsigned changedSize = changedClasses.size(); |
| 607 RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSe
t(); | 607 RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSe
t(); |
| 608 for (unsigned i = 0; i < changedSize; ++i) | 608 for (unsigned i = 0; i < changedSize; ++i) |
| 609 ruleFeatureSet.collectInvalidationSetsForClass(invalidationLists, elemen
t, changedClasses[i]); | 609 ruleFeatureSet.collectInvalidationSetsForClass(invalidationLists, elemen
t, changedClasses[i]); |
| 610 m_styleInvalidator.scheduleInvalidationSetsForNode(invalidationLists, elemen
t); | 610 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); |
| 611 } | 611 } |
| 612 | 612 |
| 613 void StyleEngine::classChangedForElement(const SpaceSplitString& oldClasses, con
st SpaceSplitString& newClasses, Element& element) | 613 void StyleEngine::classChangedForElement(const SpaceSplitString& oldClasses, con
st SpaceSplitString& newClasses, Element& element) |
| 614 { | 614 { |
| 615 if (shouldSkipInvalidationFor(element)) | 615 if (shouldSkipInvalidationFor(element)) |
| 616 return; | 616 return; |
| 617 | 617 |
| 618 if (!oldClasses.size()) { | 618 if (!oldClasses.size()) { |
| 619 classChangedForElement(newClasses, element); | 619 classChangedForElement(newClasses, element); |
| 620 return; | 620 return; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 643 ruleFeatureSet.collectInvalidationSetsForClass(invalidationLists, el
ement, newClasses[i]); | 643 ruleFeatureSet.collectInvalidationSetsForClass(invalidationLists, el
ement, newClasses[i]); |
| 644 } | 644 } |
| 645 | 645 |
| 646 for (unsigned i = 0; i < oldClasses.size(); ++i) { | 646 for (unsigned i = 0; i < oldClasses.size(); ++i) { |
| 647 if (remainingClassBits.quickGet(i)) | 647 if (remainingClassBits.quickGet(i)) |
| 648 continue; | 648 continue; |
| 649 // Class was removed. | 649 // Class was removed. |
| 650 ruleFeatureSet.collectInvalidationSetsForClass(invalidationLists, elemen
t, oldClasses[i]); | 650 ruleFeatureSet.collectInvalidationSetsForClass(invalidationLists, elemen
t, oldClasses[i]); |
| 651 } | 651 } |
| 652 | 652 |
| 653 m_styleInvalidator.scheduleInvalidationSetsForNode(invalidationLists, elemen
t); | 653 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); |
| 654 } | 654 } |
| 655 | 655 |
| 656 void StyleEngine::attributeChangedForElement(const QualifiedName& attributeName,
Element& element) | 656 void StyleEngine::attributeChangedForElement(const QualifiedName& attributeName,
Element& element) |
| 657 { | 657 { |
| 658 if (shouldSkipInvalidationFor(element)) | 658 if (shouldSkipInvalidationFor(element)) |
| 659 return; | 659 return; |
| 660 | 660 |
| 661 InvalidationLists invalidationLists; | 661 InvalidationLists invalidationLists; |
| 662 ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForAtt
ribute(invalidationLists, element, attributeName); | 662 ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForAtt
ribute(invalidationLists, element, attributeName); |
| 663 m_styleInvalidator.scheduleInvalidationSetsForNode(invalidationLists, elemen
t); | 663 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); |
| 664 } | 664 } |
| 665 | 665 |
| 666 void StyleEngine::idChangedForElement(const AtomicString& oldId, const AtomicStr
ing& newId, Element& element) | 666 void StyleEngine::idChangedForElement(const AtomicString& oldId, const AtomicStr
ing& newId, Element& element) |
| 667 { | 667 { |
| 668 if (shouldSkipInvalidationFor(element)) | 668 if (shouldSkipInvalidationFor(element)) |
| 669 return; | 669 return; |
| 670 | 670 |
| 671 InvalidationLists invalidationLists; | 671 InvalidationLists invalidationLists; |
| 672 RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSe
t(); | 672 RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSe
t(); |
| 673 if (!oldId.isEmpty()) | 673 if (!oldId.isEmpty()) |
| 674 ruleFeatureSet.collectInvalidationSetsForId(invalidationLists, element,
oldId); | 674 ruleFeatureSet.collectInvalidationSetsForId(invalidationLists, element,
oldId); |
| 675 if (!newId.isEmpty()) | 675 if (!newId.isEmpty()) |
| 676 ruleFeatureSet.collectInvalidationSetsForId(invalidationLists, element,
newId); | 676 ruleFeatureSet.collectInvalidationSetsForId(invalidationLists, element,
newId); |
| 677 m_styleInvalidator.scheduleInvalidationSetsForNode(invalidationLists, elemen
t); | 677 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); |
| 678 } | 678 } |
| 679 | 679 |
| 680 void StyleEngine::pseudoStateChangedForElement(CSSSelector::PseudoType pseudoTyp
e, Element& element) | 680 void StyleEngine::pseudoStateChangedForElement(CSSSelector::PseudoType pseudoTyp
e, Element& element) |
| 681 { | 681 { |
| 682 if (shouldSkipInvalidationFor(element)) | 682 if (shouldSkipInvalidationFor(element)) |
| 683 return; | 683 return; |
| 684 | 684 |
| 685 InvalidationLists invalidationLists; | 685 InvalidationLists invalidationLists; |
| 686 ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForPse
udoClass(invalidationLists, element, pseudoType); | 686 ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForPse
udoClass(invalidationLists, element, pseudoType); |
| 687 m_styleInvalidator.scheduleInvalidationSetsForNode(invalidationLists, elemen
t); | 687 m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, ele
ment); |
| 688 } | 688 } |
| 689 | 689 |
| 690 void StyleEngine::scheduleSiblingInvalidationsForElement(Element& element, Conta
inerNode& schedulingParent, unsigned minDirectAdjacent) | 690 void StyleEngine::scheduleSiblingInvalidationsForElement(Element& element, Conta
inerNode& schedulingParent, unsigned minDirectAdjacent) |
| 691 { | 691 { |
| 692 DCHECK(minDirectAdjacent); | 692 DCHECK(minDirectAdjacent); |
| 693 | 693 |
| 694 InvalidationLists invalidationLists; | 694 InvalidationLists invalidationLists; |
| 695 | 695 |
| 696 RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSe
t(); | 696 RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSe
t(); |
| 697 | 697 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 ContainerNode* schedulingParent = afterElement.parentElementOrShadowRoot(); | 733 ContainerNode* schedulingParent = afterElement.parentElementOrShadowRoot(); |
| 734 if (!schedulingParent) | 734 if (!schedulingParent) |
| 735 return; | 735 return; |
| 736 | 736 |
| 737 scheduleSiblingInvalidationsForElement(removedElement, *schedulingParent, 1)
; | 737 scheduleSiblingInvalidationsForElement(removedElement, *schedulingParent, 1)
; |
| 738 | 738 |
| 739 for (unsigned i = 2; beforeElement && i <= affectedSiblings; i++, beforeElem
ent = ElementTraversal::previousSibling(*beforeElement)) | 739 for (unsigned i = 2; beforeElement && i <= affectedSiblings; i++, beforeElem
ent = ElementTraversal::previousSibling(*beforeElement)) |
| 740 scheduleSiblingInvalidationsForElement(*beforeElement, *schedulingParent
, i); | 740 scheduleSiblingInvalidationsForElement(*beforeElement, *schedulingParent
, i); |
| 741 } | 741 } |
| 742 | 742 |
| 743 void StyleEngine::scheduleNthPseudoInvalidations(ContainerNode& nthParent) | |
| 744 { | |
| 745 InvalidationLists invalidationLists; | |
| 746 ensureResolver().ensureUpdatedRuleFeatureSet().collectNthInvalidationSet(inv
alidationLists); | |
| 747 m_styleInvalidator.scheduleInvalidationSetsForNode(invalidationLists, nthPar
ent); | |
| 748 } | |
| 749 | |
| 750 void StyleEngine::setStatsEnabled(bool enabled) | 743 void StyleEngine::setStatsEnabled(bool enabled) |
| 751 { | 744 { |
| 752 if (!enabled) { | 745 if (!enabled) { |
| 753 m_styleResolverStats = nullptr; | 746 m_styleResolverStats = nullptr; |
| 754 return; | 747 return; |
| 755 } | 748 } |
| 756 if (!m_styleResolverStats) | 749 if (!m_styleResolverStats) |
| 757 m_styleResolverStats = StyleResolverStats::create(); | 750 m_styleResolverStats = StyleResolverStats::create(); |
| 758 else | 751 else |
| 759 m_styleResolverStats->reset(); | 752 m_styleResolverStats->reset(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 | 822 |
| 830 DEFINE_TRACE_WRAPPERS(StyleEngine) | 823 DEFINE_TRACE_WRAPPERS(StyleEngine) |
| 831 { | 824 { |
| 832 for (auto sheet : m_injectedAuthorStyleSheets) { | 825 for (auto sheet : m_injectedAuthorStyleSheets) { |
| 833 visitor->traceWrappers(sheet); | 826 visitor->traceWrappers(sheet); |
| 834 } | 827 } |
| 835 visitor->traceWrappers(m_documentStyleSheetCollection); | 828 visitor->traceWrappers(m_documentStyleSheetCollection); |
| 836 } | 829 } |
| 837 | 830 |
| 838 } // namespace blink | 831 } // namespace blink |
| OLD | NEW |