OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/css/ActiveStyleSheets.h" | 5 #include "core/css/ActiveStyleSheets.h" |
6 | 6 |
7 #include "core/css/CSSStyleSheet.h" | 7 #include "core/css/CSSStyleSheet.h" |
8 #include "core/css/RuleSet.h" | 8 #include "core/css/RuleSet.h" |
9 #include "core/css/resolver/ScopedStyleResolver.h" | 9 #include "core/css/resolver/ScopedStyleResolver.h" |
10 #include "core/dom/ContainerNode.h" | 10 #include "core/dom/ContainerNode.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 if (fontsChanged && change == ActiveSheetsChanged) | 149 if (fontsChanged && change == ActiveSheetsChanged) |
150 engine.clearFontCache(); | 150 engine.clearFontCache(); |
151 | 151 |
152 // - If all sheets were removed, we remove the ScopedStyleResolver. | 152 // - If all sheets were removed, we remove the ScopedStyleResolver. |
153 // - If new sheets were appended to existing ones, start appending after the | 153 // - If new sheets were appended to existing ones, start appending after the |
154 // common prefix. | 154 // common prefix. |
155 // - For other diffs, reset author style and re-add all sheets for the | 155 // - For other diffs, reset author style and re-add all sheets for the |
156 // TreeScope. | 156 // TreeScope. |
157 if (treeScope.scopedStyleResolver()) { | 157 if (treeScope.scopedStyleResolver()) { |
158 if (newStyleSheets.isEmpty()) | 158 if (newStyleSheets.isEmpty()) |
159 treeScope.clearScopedStyleResolver(); | 159 engine.resetAuthorStyle(treeScope); |
160 else if (change == ActiveSheetsAppended) | 160 else if (change == ActiveSheetsAppended) |
161 appendStartIndex = oldStyleSheets.size(); | 161 appendStartIndex = oldStyleSheets.size(); |
162 else | 162 else |
163 treeScope.scopedStyleResolver()->resetAuthorStyle(); | 163 treeScope.scopedStyleResolver()->resetAuthorStyle(); |
164 } | 164 } |
165 | 165 |
166 if (!newStyleSheets.isEmpty()) { | 166 if (!newStyleSheets.isEmpty()) { |
167 treeScope.ensureScopedStyleResolver().appendActiveStyleSheets( | 167 treeScope.ensureScopedStyleResolver().appendActiveStyleSheets( |
168 appendStartIndex, newStyleSheets); | 168 appendStartIndex, newStyleSheets); |
169 } | 169 } |
(...skipping 17 matching lines...) Expand all Loading... |
187 .setNeedsStyleRecalc(SubtreeStyleChange, | 187 .setNeedsStyleRecalc(SubtreeStyleChange, |
188 StyleChangeReasonForTracing::create( | 188 StyleChangeReasonForTracing::create( |
189 StyleChangeReason::ActiveStylesheetsUpdate)); | 189 StyleChangeReason::ActiveStylesheetsUpdate)); |
190 return; | 190 return; |
191 } | 191 } |
192 | 192 |
193 engine.scheduleInvalidationsForRuleSets(treeScope, changedRuleSets); | 193 engine.scheduleInvalidationsForRuleSets(treeScope, changedRuleSets); |
194 } | 194 } |
195 | 195 |
196 } // namespace blink | 196 } // namespace blink |
OLD | NEW |