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

Unified Diff: third_party/WebKit/Source/core/css/resolver/SharedStyleFinderTest.cpp

Issue 2613213002: Support Style Sharing for Shadow DOM V1 (Closed)
Patch Set: update 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/resolver/SharedStyleFinderTest.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/SharedStyleFinderTest.cpp b/third_party/WebKit/Source/core/css/resolver/SharedStyleFinderTest.cpp
index f5ff6bd5f6ae5d23b0ef3075ae774e921827dfe9..497d6db681e3287f6d0e169cadfed9442c9b2d6c 100644
--- a/third_party/WebKit/Source/core/css/resolver/SharedStyleFinderTest.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/SharedStyleFinderTest.cpp
@@ -9,6 +9,8 @@
#include "core/css/parser/CSSParser.h"
#include "core/css/parser/CSSParserContext.h"
#include "core/dom/Document.h"
+#include "core/dom/shadow/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRootInit.h"
#include "core/frame/FrameView.h"
#include "core/html/HTMLElement.h"
#include "core/testing/DummyPageHolder.h"
@@ -29,6 +31,16 @@ class SharedStyleFinderTest : public ::testing::Test {
document().view()->updateAllLifecyclePhases();
}
+ ShadowRoot& attachShadow(Element& host) {
+ ShadowRootInit init;
+ init.setMode("open");
+ ShadowRoot* shadowRoot =
+ host.attachShadow(ScriptState::forMainWorld(document().frame()), init,
+ ASSERT_NO_EXCEPTION);
+ EXPECT_TRUE(shadowRoot);
+ return *shadowRoot;
+ }
+
void addSelector(const String& selector) {
StyleRuleBase* newRule =
CSSParser::parseRule(CSSParserContext(HTMLStandardMode, nullptr),
@@ -182,4 +194,24 @@ TEST_F(SharedStyleFinderTest, AttributeAffectedByDrag) {
EXPECT_FALSE(matchesUncommonAttributeRuleSet(*b));
}
+TEST_F(SharedStyleFinderTest, SlottedPseudoWithAttribute) {
+ setBodyContent("<div id=host><div id=a></div><div id=b attr></div></div>");
+ Element* host = document().getElementById("host");
+ ShadowRoot& root = attachShadow(*host);
+ root.setInnerHTML("<slot></slot>");
+ document().updateDistribution();
+
+ addSelector("::slotted([attr])");
+ finishAddingSelectors();
+
+ Element* a = document().getElementById("a");
+ Element* b = document().getElementById("b");
+
+ EXPECT_TRUE(a->assignedSlot());
+ EXPECT_TRUE(b->assignedSlot());
+
+ EXPECT_FALSE(matchesUncommonAttributeRuleSet(*a));
+ EXPECT_TRUE(matchesUncommonAttributeRuleSet(*b));
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp ('k') | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698