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

Side by Side Diff: third_party/WebKit/Source/core/css/ActiveStyleSheets.cpp

Issue 2456753003: Use StyleEngine::resetAuthorStyle instead of clearScopedStyleResolver. (Closed)
Patch Set: Rebased Created 4 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698