Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(787)

Side by Side Diff: third_party/WebKit/Source/core/dom/StyleEngine.cpp

Issue 2394353003: Apply RuleSet changes for active stylesheet changes. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 void StyleEngine::scheduleNthPseudoInvalidations(ContainerNode& nthParent) { 808 void StyleEngine::scheduleNthPseudoInvalidations(ContainerNode& nthParent) {
809 InvalidationLists invalidationLists; 809 InvalidationLists invalidationLists;
810 ensureResolver().ensureUpdatedRuleFeatureSet().collectNthInvalidationSet( 810 ensureResolver().ensureUpdatedRuleFeatureSet().collectNthInvalidationSet(
811 invalidationLists); 811 invalidationLists);
812 m_styleInvalidator.scheduleInvalidationSetsForNode(invalidationLists, 812 m_styleInvalidator.scheduleInvalidationSetsForNode(invalidationLists,
813 nthParent); 813 nthParent);
814 } 814 }
815 815
816 void StyleEngine::scheduleRuleSetInvalidationsForElement( 816 void StyleEngine::scheduleRuleSetInvalidationsForElement(
817 Element& element, 817 Element& element,
818 const HeapVector<Member<const RuleSet>>& ruleSets) { 818 const HeapVector<Member<RuleSet>>& ruleSets) {
819 AtomicString id; 819 AtomicString id;
820 const SpaceSplitString* classNames = nullptr; 820 const SpaceSplitString* classNames = nullptr;
821 821
822 if (element.hasID()) 822 if (element.hasID())
823 id = element.idForStyleResolution(); 823 id = element.idForStyleResolution();
824 if (element.hasClass()) 824 if (element.hasClass())
825 classNames = &element.classNames(); 825 classNames = &element.classNames();
826 826
827 InvalidationLists invalidationLists; 827 InvalidationLists invalidationLists;
828 for (const auto& ruleSet : ruleSets) { 828 for (const auto& ruleSet : ruleSets) {
(...skipping 22 matching lines...) Expand all
851 for (auto& node : slot.getDistributedNodes()) { 851 for (auto& node : slot.getDistributedNodes()) {
852 if (node->isElementNode()) 852 if (node->isElementNode())
853 node->setNeedsStyleRecalc(LocalStyleChange, 853 node->setNeedsStyleRecalc(LocalStyleChange,
854 StyleChangeReasonForTracing::create( 854 StyleChangeReasonForTracing::create(
855 StyleChangeReason::StyleSheetChange)); 855 StyleChangeReason::StyleSheetChange));
856 } 856 }
857 } 857 }
858 858
859 void StyleEngine::scheduleInvalidationsForRuleSets( 859 void StyleEngine::scheduleInvalidationsForRuleSets(
860 TreeScope& treeScope, 860 TreeScope& treeScope,
861 const HeapVector<Member<const RuleSet>>& ruleSets) { 861 const HeapVector<Member<RuleSet>>& ruleSets) {
862 #if DCHECK_IS_ON() 862 #if DCHECK_IS_ON()
863 // Full scope recalcs should be handled while collecting the ruleSets before 863 // Full scope recalcs should be handled while collecting the ruleSets before
864 // calling this method. 864 // calling this method.
865 for (auto ruleSet : ruleSets) 865 for (auto ruleSet : ruleSets)
866 DCHECK(!ruleSet->features().needsFullRecalcForRuleSetInvalidation()); 866 DCHECK(!ruleSet->features().needsFullRecalcForRuleSetInvalidation());
867 #endif // DCHECK_IS_ON() 867 #endif // DCHECK_IS_ON()
868 868
869 bool invalidateSlotted = false; 869 bool invalidateSlotted = false;
870 if (treeScope.rootNode().isShadowRoot()) { 870 if (treeScope.rootNode().isShadowRoot()) {
871 Element& host = toShadowRoot(treeScope.rootNode()).host(); 871 Element& host = toShadowRoot(treeScope.rootNode()).host();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 } 965 }
966 966
967 DEFINE_TRACE_WRAPPERS(StyleEngine) { 967 DEFINE_TRACE_WRAPPERS(StyleEngine) {
968 for (auto sheet : m_injectedAuthorStyleSheets) { 968 for (auto sheet : m_injectedAuthorStyleSheets) {
969 visitor->traceWrappers(sheet); 969 visitor->traceWrappers(sheet);
970 } 970 }
971 visitor->traceWrappers(m_documentStyleSheetCollection); 971 visitor->traceWrappers(m_documentStyleSheetCollection);
972 } 972 }
973 973
974 } // namespace blink 974 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | third_party/WebKit/Source/core/dom/StyleEngineTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698