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

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

Issue 2519393002: Force adding sheets and recalc for html import re-ordering. (Closed)
Patch Set: Missing reset in resetAuthorStyle() 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp
diff --git a/third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp b/third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp
index eab5ee5a47dc489cdb8a3a22aae662d521bee814..2b57155e06be0e743174d526c5f4d635aa0b280c 100644
--- a/third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp
+++ b/third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp
@@ -302,6 +302,32 @@ TEST_F(ActiveStyleSheetsTest,
EXPECT_EQ(&sheet3->contents()->ruleSet(), changedRuleSets[0]);
}
+TEST_F(ActiveStyleSheetsTest, CompareActiveStyleSheets_ReorderedImportSheets) {
+ ActiveStyleSheetVector oldSheets;
+ ActiveStyleSheetVector newSheets;
+ HeapVector<Member<RuleSet>> changedRuleSets;
+
+ CSSStyleSheet* sheet1 = createSheet();
+ CSSStyleSheet* sheet2 = createSheet();
+
+ // It is possible to have CSSStyleSheet pointers re-orderered for html imports
+ // because their documents, and hence their stylesheets are persisted on
+ // remove / insert. This test is here to show that the active sheet comparison
+ // is not able to see that anything changed.
+ //
+ // Imports are handled by forcing re-append and recalc of the document scope
+ // when html imports are removed.
+ oldSheets.append(std::make_pair(sheet1, &sheet1->contents()->ruleSet()));
+ oldSheets.append(std::make_pair(sheet2, &sheet2->contents()->ruleSet()));
+
+ newSheets.append(std::make_pair(sheet2, &sheet2->contents()->ruleSet()));
+ newSheets.append(std::make_pair(sheet1, &sheet1->contents()->ruleSet()));
+
+ EXPECT_EQ(NoActiveSheetsChanged,
+ compareActiveStyleSheets(oldSheets, newSheets, changedRuleSets));
+ EXPECT_EQ(0u, changedRuleSets.size());
+}
+
TEST_F(ApplyRulesetsTest, AddUniversalRuleToDocument) {
document().view()->updateAllLifecyclePhases();
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698