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

Unified Diff: third_party/WebKit/Source/core/css/ActiveStyleSheets.cpp

Issue 2650743002: Return ActiveSheetsChanged when rulesets change in common prefix. (Closed)
Patch Set: Documentation and more descriptive variable name. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/ActiveStyleSheets.cpp
diff --git a/third_party/WebKit/Source/core/css/ActiveStyleSheets.cpp b/third_party/WebKit/Source/core/css/ActiveStyleSheets.cpp
index cca65e7a1cc18a19e12f776f23d716ee70dfc917..4f3f6195d4004b18950542da32979cf6ef331ff1 100644
--- a/third_party/WebKit/Source/core/css/ActiveStyleSheets.cpp
+++ b/third_party/WebKit/Source/core/css/ActiveStyleSheets.cpp
@@ -38,18 +38,19 @@ ActiveSheetsChange compareActiveStyleSheets(
}
if (index == oldStyleSheetCount) {
- if (index == newStyleSheetCount) {
- return changedRuleSets.isEmpty() ? NoActiveSheetsChanged
- : ActiveSheetsChanged;
- }
-
- // Sheets added at the end.
+ // The old stylesheet vector is a prefix of the new vector in terms of
+ // StyleSheets. If none of the RuleSets changed, we only need to add the new
+ // sheets to the ScopedStyleResolver (ActiveSheetsAppended).
+ bool ruleSetsChangedInCommonPrefix = !changedRuleSets.isEmpty();
for (; index < newStyleSheetCount; index++) {
if (newStyleSheets[index].second)
changedRuleSets.add(newStyleSheets[index].second);
}
- return changedRuleSets.isEmpty() ? NoActiveSheetsChanged
- : ActiveSheetsAppended;
+ if (ruleSetsChangedInCommonPrefix)
+ return ActiveSheetsChanged;
+ if (changedRuleSets.isEmpty())
+ return NoActiveSheetsChanged;
+ return ActiveSheetsAppended;
}
if (index == newStyleSheetCount) {

Powered by Google App Engine
This is Rietveld 408576698