| 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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 // TODO(rune@opera.com): ensureResolver() can be removed once stylesheet | 888 // TODO(rune@opera.com): ensureResolver() can be removed once stylesheet |
| 889 // updates are async. https://crbug.com/567021 | 889 // updates are async. https://crbug.com/567021 |
| 890 ensureResolver(); | 890 ensureResolver(); |
| 891 ruleFeatureSet().collectNthInvalidationSet(invalidationLists); | 891 ruleFeatureSet().collectNthInvalidationSet(invalidationLists); |
| 892 m_styleInvalidator.scheduleInvalidationSetsForNode(invalidationLists, | 892 m_styleInvalidator.scheduleInvalidationSetsForNode(invalidationLists, |
| 893 nthParent); | 893 nthParent); |
| 894 } | 894 } |
| 895 | 895 |
| 896 void StyleEngine::scheduleRuleSetInvalidationsForElement( | 896 void StyleEngine::scheduleRuleSetInvalidationsForElement( |
| 897 Element& element, | 897 Element& element, |
| 898 const HeapVector<Member<RuleSet>>& ruleSets) { | 898 const HeapHashSet<Member<RuleSet>>& ruleSets) { |
| 899 AtomicString id; | 899 AtomicString id; |
| 900 const SpaceSplitString* classNames = nullptr; | 900 const SpaceSplitString* classNames = nullptr; |
| 901 | 901 |
| 902 if (element.hasID()) | 902 if (element.hasID()) |
| 903 id = element.idForStyleResolution(); | 903 id = element.idForStyleResolution(); |
| 904 if (element.hasClass()) | 904 if (element.hasClass()) |
| 905 classNames = &element.classNames(); | 905 classNames = &element.classNames(); |
| 906 | 906 |
| 907 InvalidationLists invalidationLists; | 907 InvalidationLists invalidationLists; |
| 908 for (const auto& ruleSet : ruleSets) { | 908 for (const auto& ruleSet : ruleSets) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 931 for (auto& node : slot.getDistributedNodes()) { | 931 for (auto& node : slot.getDistributedNodes()) { |
| 932 if (node->isElementNode()) | 932 if (node->isElementNode()) |
| 933 node->setNeedsStyleRecalc(LocalStyleChange, | 933 node->setNeedsStyleRecalc(LocalStyleChange, |
| 934 StyleChangeReasonForTracing::create( | 934 StyleChangeReasonForTracing::create( |
| 935 StyleChangeReason::StyleSheetChange)); | 935 StyleChangeReason::StyleSheetChange)); |
| 936 } | 936 } |
| 937 } | 937 } |
| 938 | 938 |
| 939 void StyleEngine::scheduleInvalidationsForRuleSets( | 939 void StyleEngine::scheduleInvalidationsForRuleSets( |
| 940 TreeScope& treeScope, | 940 TreeScope& treeScope, |
| 941 const HeapVector<Member<RuleSet>>& ruleSets) { | 941 const HeapHashSet<Member<RuleSet>>& ruleSets) { |
| 942 #if DCHECK_IS_ON() | 942 #if DCHECK_IS_ON() |
| 943 // Full scope recalcs should be handled while collecting the ruleSets before | 943 // Full scope recalcs should be handled while collecting the ruleSets before |
| 944 // calling this method. | 944 // calling this method. |
| 945 for (auto ruleSet : ruleSets) | 945 for (auto ruleSet : ruleSets) |
| 946 DCHECK(!ruleSet->features().needsFullRecalcForRuleSetInvalidation()); | 946 DCHECK(!ruleSet->features().needsFullRecalcForRuleSetInvalidation()); |
| 947 #endif // DCHECK_IS_ON() | 947 #endif // DCHECK_IS_ON() |
| 948 | 948 |
| 949 bool invalidateSlotted = false; | 949 bool invalidateSlotted = false; |
| 950 if (treeScope.rootNode().isShadowRoot()) { | 950 if (treeScope.rootNode().isShadowRoot()) { |
| 951 Element& host = toShadowRoot(treeScope.rootNode()).host(); | 951 Element& host = toShadowRoot(treeScope.rootNode()).host(); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 .findSharedStyle(); | 1090 .findSharedStyle(); |
| 1091 } | 1091 } |
| 1092 namespace { | 1092 namespace { |
| 1093 | 1093 |
| 1094 enum RuleSetFlags { | 1094 enum RuleSetFlags { |
| 1095 FontFaceRules = 1 << 0, | 1095 FontFaceRules = 1 << 0, |
| 1096 KeyframesRules = 1 << 1, | 1096 KeyframesRules = 1 << 1, |
| 1097 FullRecalcRules = 1 << 2 | 1097 FullRecalcRules = 1 << 2 |
| 1098 }; | 1098 }; |
| 1099 | 1099 |
| 1100 unsigned getRuleSetFlags(const HeapVector<Member<RuleSet>> ruleSets) { | 1100 unsigned getRuleSetFlags(const HeapHashSet<Member<RuleSet>> ruleSets) { |
| 1101 unsigned flags = 0; | 1101 unsigned flags = 0; |
| 1102 for (auto& ruleSet : ruleSets) { | 1102 for (auto& ruleSet : ruleSets) { |
| 1103 ruleSet->compactRulesIfNeeded(); | 1103 ruleSet->compactRulesIfNeeded(); |
| 1104 if (!ruleSet->keyframesRules().isEmpty()) | 1104 if (!ruleSet->keyframesRules().isEmpty()) |
| 1105 flags |= KeyframesRules; | 1105 flags |= KeyframesRules; |
| 1106 if (!ruleSet->fontFaceRules().isEmpty()) | 1106 if (!ruleSet->fontFaceRules().isEmpty()) |
| 1107 flags |= FontFaceRules; | 1107 flags |= FontFaceRules; |
| 1108 if (ruleSet->needsFullRecalcForRuleSetInvalidation()) | 1108 if (ruleSet->needsFullRecalcForRuleSetInvalidation()) |
| 1109 flags |= FullRecalcRules; | 1109 flags |= FullRecalcRules; |
| 1110 } | 1110 } |
| 1111 return flags; | 1111 return flags; |
| 1112 } | 1112 } |
| 1113 | 1113 |
| 1114 } // namespace | 1114 } // namespace |
| 1115 | 1115 |
| 1116 void StyleEngine::applyRuleSetChanges( | 1116 void StyleEngine::applyRuleSetChanges( |
| 1117 TreeScope& treeScope, | 1117 TreeScope& treeScope, |
| 1118 const ActiveStyleSheetVector& oldStyleSheets, | 1118 const ActiveStyleSheetVector& oldStyleSheets, |
| 1119 const ActiveStyleSheetVector& newStyleSheets) { | 1119 const ActiveStyleSheetVector& newStyleSheets) { |
| 1120 HeapVector<Member<RuleSet>> changedRuleSets; | 1120 HeapHashSet<Member<RuleSet>> changedRuleSets; |
| 1121 | 1121 |
| 1122 ScopedStyleResolver* scopedResolver = treeScope.scopedStyleResolver(); | 1122 ScopedStyleResolver* scopedResolver = treeScope.scopedStyleResolver(); |
| 1123 bool appendAllSheets = | 1123 bool appendAllSheets = |
| 1124 scopedResolver && scopedResolver->needsAppendAllSheets(); | 1124 scopedResolver && scopedResolver->needsAppendAllSheets(); |
| 1125 | 1125 |
| 1126 ActiveSheetsChange change = | 1126 ActiveSheetsChange change = |
| 1127 compareActiveStyleSheets(oldStyleSheets, newStyleSheets, changedRuleSets); | 1127 compareActiveStyleSheets(oldStyleSheets, newStyleSheets, changedRuleSets); |
| 1128 if (change == NoActiveSheetsChanged && !appendAllSheets) | 1128 if (change == NoActiveSheetsChanged && !appendAllSheets) |
| 1129 return; | 1129 return; |
| 1130 | 1130 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 } | 1238 } |
| 1239 | 1239 |
| 1240 DEFINE_TRACE_WRAPPERS(StyleEngine) { | 1240 DEFINE_TRACE_WRAPPERS(StyleEngine) { |
| 1241 for (auto sheet : m_injectedAuthorStyleSheets) { | 1241 for (auto sheet : m_injectedAuthorStyleSheets) { |
| 1242 visitor->traceWrappers(sheet); | 1242 visitor->traceWrappers(sheet); |
| 1243 } | 1243 } |
| 1244 visitor->traceWrappers(m_documentStyleSheetCollection); | 1244 visitor->traceWrappers(m_documentStyleSheetCollection); |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 } // namespace blink | 1247 } // namespace blink |
| OLD | NEW |