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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <script src="resources/shadow-dom.js"></script>
5 <body>
6 <div id="host">
7 <template mode-data="open">
8 <link rel="stylesheet" title="preferred1" href="data:text/css,#shadowChild 1 { color: green }">
9 <link rel="stylesheet" title="title1" href="data:text/css,#shadowChild2 { color: green }">
10 <link rel="alternate stylesheet" title="prefered1" href="data:text/css,#sh adowChild3 { color: green }">
11 <link rel="alternate stylesheet" title="title1" href="data:text/css,#shado wChild4 { color: green }">
12 <div id="shadowChild1"></div>
13 <div id="shadowChild2"></div>
14 <div id="shadowChild3"></div>
15 <div id="shadowChild4"></div>
16 </template>
17 </div>
18 <div id="bodyChild1"></div>
19 <div id="bodyChild2"></div>
20 <script>convertTemplatesToShadowRootsWithin(host);</script>
21 <link rel="stylesheet" title="preferred1" href="data:text/css,#bodyChild1 { co lor: green }">
22 <link rel="stylesheet" title="non-preferred" href="data:text/css,#bodyChild2 { color: green }">
23 </body>
24 <script>
25 function colorFor(elem) {
26 return document.defaultView.getComputedStyle(elem, '').color;
27 }
28
29 test(() => {
30 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.');
31 assert_equals(colorFor(bodyChild2), 'rgb(0, 0, 0)', 'A non-preferred styleshee t should not be used.');
32 }, '<link rel="stylesheet" title="xxx"> in a document tree should work without i nterference from a shadow tree.');
33
34 test(() => {
35 assert_equals(colorFor(host.shadowRoot.querySelector('#shadowChild1')), 'rgb(0 , 128, 0)');
36 assert_equals(colorFor(host.shadowRoot.querySelector('#shadowChild2')), 'rgb(0 , 128, 0)');
37 }, '<link rel="stylesheet" title="xxx"> shoule behave as <link rel="stylesheet"> (always enabled because title is ignored) in a connected shadow tree.');
38
39 test(() => {
40 assert_equals(colorFor(host.shadowRoot.querySelector('#shadowChild3')), 'rgb(0 , 0, 0)');
41 assert_equals(colorFor(host.shadowRoot.querySelector('#shadowChild4')), 'rgb(0 , 0, 0)');
42 }, '<link rel="alternate stylesheet" title="xxx"> shoule behave as <link rel="al ternate stylesheet"> (never enabled because title is ignored) in a connected sha dow tree.');
43
44 </script>
OLDNEW
« 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