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