| 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 | 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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 element, id); | 825 element, id); |
| 826 if (classNames) { | 826 if (classNames) { |
| 827 unsigned classNameCount = classNames->size(); | 827 unsigned classNameCount = classNames->size(); |
| 828 for (size_t i = 0; i < classNameCount; i++) | 828 for (size_t i = 0; i < classNameCount; i++) |
| 829 ruleSet->features().collectInvalidationSetsForClass( | 829 ruleSet->features().collectInvalidationSetsForClass( |
| 830 invalidationLists, element, (*classNames)[i]); | 830 invalidationLists, element, (*classNames)[i]); |
| 831 } | 831 } |
| 832 for (const Attribute& attribute : element.attributes()) | 832 for (const Attribute& attribute : element.attributes()) |
| 833 ruleSet->features().collectInvalidationSetsForAttribute( | 833 ruleSet->features().collectInvalidationSetsForAttribute( |
| 834 invalidationLists, element, attribute.name()); | 834 invalidationLists, element, attribute.name()); |
| 835 if (ruleSet->tagRules(element.localNameForSelectorMatching())) | |
| 836 element.setNeedsStyleRecalc(LocalStyleChange, | |
| 837 StyleChangeReasonForTracing::create( | |
| 838 StyleChangeReason::StyleSheetChange)); | |
| 839 } | 835 } |
| 840 m_styleInvalidator.scheduleInvalidationSetsForNode(invalidationLists, | 836 m_styleInvalidator.scheduleInvalidationSetsForNode(invalidationLists, |
| 841 element); | 837 element); |
| 842 } | 838 } |
| 843 | 839 |
| 840 void StyleEngine::scheduleTypeRuleSetInvalidations( |
| 841 ContainerNode& node, |
| 842 const HeapHashSet<Member<RuleSet>>& ruleSets) { |
| 843 InvalidationLists invalidationLists; |
| 844 for (const auto& ruleSet : ruleSets) |
| 845 ruleSet->features().collectTypeRuleInvalidationSet(invalidationLists, node); |
| 846 DCHECK(invalidationLists.siblings.isEmpty()); |
| 847 m_styleInvalidator.scheduleInvalidationSetsForNode(invalidationLists, node); |
| 848 } |
| 849 |
| 844 void StyleEngine::invalidateSlottedElements(HTMLSlotElement& slot) { | 850 void StyleEngine::invalidateSlottedElements(HTMLSlotElement& slot) { |
| 845 for (auto& node : slot.getDistributedNodes()) { | 851 for (auto& node : slot.getDistributedNodes()) { |
| 846 if (node->isElementNode()) | 852 if (node->isElementNode()) |
| 847 node->setNeedsStyleRecalc(LocalStyleChange, | 853 node->setNeedsStyleRecalc(LocalStyleChange, |
| 848 StyleChangeReasonForTracing::create( | 854 StyleChangeReasonForTracing::create( |
| 849 StyleChangeReason::StyleSheetChange)); | 855 StyleChangeReason::StyleSheetChange)); |
| 850 } | 856 } |
| 851 } | 857 } |
| 852 | 858 |
| 853 void StyleEngine::scheduleInvalidationsForRuleSets( | 859 void StyleEngine::scheduleInvalidationsForRuleSets( |
| 854 TreeScope& treeScope, | 860 TreeScope& treeScope, |
| 855 const HeapHashSet<Member<RuleSet>>& ruleSets) { | 861 const HeapHashSet<Member<RuleSet>>& ruleSets) { |
| 856 #if DCHECK_IS_ON() | 862 #if DCHECK_IS_ON() |
| 857 // Full scope recalcs should be handled while collecting the ruleSets before | 863 // Full scope recalcs should be handled while collecting the ruleSets before |
| 858 // calling this method. | 864 // calling this method. |
| 859 for (auto ruleSet : ruleSets) | 865 for (auto ruleSet : ruleSets) |
| 860 DCHECK(!ruleSet->features().needsFullRecalcForRuleSetInvalidation()); | 866 DCHECK(!ruleSet->features().needsFullRecalcForRuleSetInvalidation()); |
| 861 #endif // DCHECK_IS_ON() | 867 #endif // DCHECK_IS_ON() |
| 862 | 868 |
| 863 TRACE_EVENT0("blink,blink_style", | 869 TRACE_EVENT0("blink,blink_style", |
| 864 "StyleEngine::scheduleInvalidationsForRuleSets"); | 870 "StyleEngine::scheduleInvalidationsForRuleSets"); |
| 865 | 871 |
| 872 scheduleTypeRuleSetInvalidations(treeScope.rootNode(), ruleSets); |
| 873 |
| 866 bool invalidateSlotted = false; | 874 bool invalidateSlotted = false; |
| 867 if (treeScope.rootNode().isShadowRoot()) { | 875 if (treeScope.rootNode().isShadowRoot()) { |
| 868 Element& host = toShadowRoot(treeScope.rootNode()).host(); | 876 Element& host = toShadowRoot(treeScope.rootNode()).host(); |
| 869 scheduleRuleSetInvalidationsForElement(host, ruleSets); | 877 scheduleRuleSetInvalidationsForElement(host, ruleSets); |
| 870 if (host.getStyleChangeType() >= SubtreeStyleChange) | 878 if (host.getStyleChangeType() >= SubtreeStyleChange) |
| 871 return; | 879 return; |
| 872 for (auto ruleSet : ruleSets) { | 880 for (auto ruleSet : ruleSets) { |
| 873 if (ruleSet->hasSlottedRules()) { | 881 if (ruleSet->hasSlottedRules()) { |
| 874 invalidateSlotted = true; | 882 invalidateSlotted = true; |
| 875 break; | 883 break; |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 } | 1154 } |
| 1147 | 1155 |
| 1148 DEFINE_TRACE_WRAPPERS(StyleEngine) { | 1156 DEFINE_TRACE_WRAPPERS(StyleEngine) { |
| 1149 for (auto sheet : m_injectedAuthorStyleSheets) { | 1157 for (auto sheet : m_injectedAuthorStyleSheets) { |
| 1150 visitor->traceWrappers(sheet); | 1158 visitor->traceWrappers(sheet); |
| 1151 } | 1159 } |
| 1152 visitor->traceWrappers(m_documentStyleSheetCollection); | 1160 visitor->traceWrappers(m_documentStyleSheetCollection); |
| 1153 } | 1161 } |
| 1154 | 1162 |
| 1155 } // namespace blink | 1163 } // namespace blink |
| OLD | NEW |