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

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

Issue 2401573002: Allow active sheets to have nullptr for RuleSet. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 27da8417ba632798c4eb0d955c89389aecc0bc86..262510f80da0b129ddbc5833dd927e46e0edd622 100644
--- a/third_party/WebKit/Source/core/css/ActiveStyleSheets.cpp
+++ b/third_party/WebKit/Source/core/css/ActiveStyleSheets.cpp
@@ -27,8 +27,10 @@ ActiveSheetsChange compareActiveStyleSheets(
if (newStyleSheets[index].second == oldStyleSheets[index].second)
continue;
- changedRuleSets.append(newStyleSheets[index].second);
- changedRuleSets.append(oldStyleSheets[index].second);
+ if (newStyleSheets[index].second)
+ changedRuleSets.append(newStyleSheets[index].second);
+ if (oldStyleSheets[index].second)
+ changedRuleSets.append(oldStyleSheets[index].second);
}
if (index == oldStyleSheetCount) {
@@ -37,16 +39,21 @@ ActiveSheetsChange compareActiveStyleSheets(
: NoActiveSheetsChanged;
// Sheets added at the end.
- for (; index < newStyleSheetCount; index++)
- changedRuleSets.append(newStyleSheets[index].second);
- return ActiveSheetsAppended;
+ for (; index < newStyleSheetCount; index++) {
+ if (newStyleSheets[index].second)
+ changedRuleSets.append(newStyleSheets[index].second);
+ }
+ return changedRuleSets.size() ? ActiveSheetsAppended
+ : NoActiveSheetsChanged;
}
if (index == newStyleSheetCount) {
// Sheets removed from the end.
- for (; index < oldStyleSheetCount; index++)
- changedRuleSets.append(oldStyleSheets[index].second);
- return ActiveSheetsChanged;
+ for (; index < oldStyleSheetCount; index++) {
+ if (oldStyleSheets[index].second)
+ changedRuleSets.append(oldStyleSheets[index].second);
+ }
+ return changedRuleSets.size() ? ActiveSheetsChanged : NoActiveSheetsChanged;
}
DCHECK(index < oldStyleSheetCount && index < newStyleSheetCount);
@@ -71,7 +78,8 @@ ActiveSheetsChange compareActiveStyleSheets(
if (mergedIterator == mergedSorted.end() ||
(*mergedIterator).first != sheet1.first) {
// Sheet either removed or inserted.
- changedRuleSets.append(sheet1.second);
+ if (sheet1.second)
+ changedRuleSets.append(sheet1.second);
continue;
}
@@ -83,10 +91,12 @@ ActiveSheetsChange compareActiveStyleSheets(
// Active rules for the given stylesheet changed.
// DOM, CSSOM, or media query changes.
- changedRuleSets.append(sheet1.second);
- changedRuleSets.append(sheet2.second);
+ if (sheet1.second)
+ changedRuleSets.append(sheet1.second);
+ if (sheet2.second)
+ changedRuleSets.append(sheet2.second);
}
- return ActiveSheetsChanged;
+ return changedRuleSets.size() ? ActiveSheetsChanged : NoActiveSheetsChanged;
}
} // namespace blink
« 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