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

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

Issue 2456753003: Use StyleEngine::resetAuthorStyle instead of clearScopedStyleResolver. (Closed)
Patch Set: Rebased 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
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 2bd50f808ca48327badfb29223c54a495427d841..9bd366506938c98ac67e6bc41efc1fc25de0f4f5 100644
--- a/third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp
+++ b/third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp
@@ -7,7 +7,9 @@
#include "core/css/CSSStyleSheet.h"
#include "core/css/MediaQueryEvaluator.h"
#include "core/css/StyleSheetContents.h"
+#include "core/css/StyleSheetList.h"
#include "core/css/parser/CSSParserMode.h"
+#include "core/dom/StyleEngine.h"
#include "core/dom/shadow/ShadowRoot.h"
#include "core/dom/shadow/ShadowRootInit.h"
#include "core/frame/FrameView.h"
@@ -403,4 +405,31 @@ TEST_F(ApplyRulesetsTest, AddFontFaceRuleToShadowTree) {
EXPECT_FALSE(document().needsLayoutTreeUpdate());
}
+TEST_F(ApplyRulesetsTest, RemoveSheetFromShadowTree) {
+ document().body()->setInnerHTML("<div id=host></div>", ASSERT_NO_EXCEPTION);
+ Element* host = document().getElementById("host");
+ ASSERT_TRUE(host);
+
+ ShadowRoot& shadowRoot = attachShadow(*host);
+ shadowRoot.setInnerHTML("<style>::slotted(#dummy){color:pink}</style>",
+ ASSERT_NO_EXCEPTION);
+ document().view()->updateAllLifecyclePhases();
+
+ EXPECT_EQ(1u, styleEngine().treeBoundaryCrossingScopes().size());
+ ASSERT_EQ(1u, shadowRoot.styleSheets().length());
+
+ StyleSheet* sheet = shadowRoot.styleSheets().item(0);
+ ASSERT_TRUE(sheet);
+ ASSERT_TRUE(sheet->isCSSStyleSheet());
+
+ CSSStyleSheet* cssSheet = toCSSStyleSheet(sheet);
+ ActiveStyleSheetVector oldStyleSheets;
+ oldStyleSheets.append(
+ std::make_pair(cssSheet, &cssSheet->contents()->ruleSet()));
+ applyRuleSetChanges(styleEngine(), shadowRoot, oldStyleSheets,
+ ActiveStyleSheetVector());
+
+ EXPECT_TRUE(styleEngine().treeBoundaryCrossingScopes().isEmpty());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/css/ActiveStyleSheets.cpp ('k') | third_party/WebKit/Source/core/css/StyleSheetList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698