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

Unified Diff: third_party/WebKit/LayoutTests/shadow-dom/link-title.html

Issue 2177163002: Allow <link rel=stylesheet> in a connected shadow tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split tests Created 4 years, 4 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/LayoutTests/shadow-dom/link-title.html
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/link-title.html b/third_party/WebKit/LayoutTests/shadow-dom/link-title.html
new file mode 100644
index 0000000000000000000000000000000000000000..1e191c3a0ac85e9b70a80e59cc0a5b621237c9c5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/shadow-dom/link-title.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="resources/shadow-dom.js"></script>
+<body>
+ <div id="host">
+ <template mode-data="open">
+ <link rel="stylesheet" title="preferred1" href="data:text/css,#shadowChild1 { color: green }">
+ <link rel="stylesheet" title="title1" href="data:text/css,#shadowChild2 { color: green }">
+ <link rel="alternate stylesheet" title="prefered1" href="data:text/css,#shadowChild3 { color: green }">
+ <link rel="alternate stylesheet" title="title1" href="data:text/css,#shadowChild4 { color: green }">
+ <div id="shadowChild1"></div>
+ <div id="shadowChild2"></div>
+ <div id="shadowChild3"></div>
+ <div id="shadowChild4"></div>
+ </template>
+ </div>
+ <div id="bodyChild1"></div>
+ <div id="bodyChild2"></div>
+ <script>convertTemplatesToShadowRootsWithin(host);</script>
+ <link rel="stylesheet" title="preferred1" href="data:text/css,#bodyChild1 { color: green }">
+ <link rel="stylesheet" title="non-preferred" href="data:text/css,#bodyChild2 { color: green }">
+</body>
+<script>
+function colorFor(elem) {
+ return document.defaultView.getComputedStyle(elem, '').color;
+}
+
+test(() => {
+ assert_equals(colorFor(bodyChild1), 'rgb(0, 128, 0)', 'A link in a shadow tree does not have any effect on the preferred stylesheet on a document tree.');
+ assert_equals(colorFor(bodyChild2), 'rgb(0, 0, 0)', 'A non-preferred stylesheet should not be used.');
+}, '<link rel="stylesheet" title="xxx"> in a document tree should work without interference from a shadow tree.');
+
+test(() => {
+ assert_equals(colorFor(host.shadowRoot.querySelector('#shadowChild1')), 'rgb(0, 128, 0)');
+ assert_equals(colorFor(host.shadowRoot.querySelector('#shadowChild2')), 'rgb(0, 128, 0)');
+}, '<link rel="stylesheet" title="xxx"> shoule behave as <link rel="stylesheet"> (always enabled because title is ignored) in a connected shadow tree.');
+
+test(() => {
+ assert_equals(colorFor(host.shadowRoot.querySelector('#shadowChild3')), 'rgb(0, 0, 0)');
+ assert_equals(colorFor(host.shadowRoot.querySelector('#shadowChild4')), 'rgb(0, 0, 0)');
+}, '<link rel="alternate stylesheet" title="xxx"> shoule behave as <link rel="alternate stylesheet"> (never enabled because title is ignored) in a connected shadow tree.');
+
+</script>
« no previous file with comments | « third_party/WebKit/LayoutTests/shadow-dom/link.html ('k') | third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698