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

Side by Side Diff: third_party/WebKit/LayoutTests/shadow-dom/css-style-inherit.html

Issue 2266353004: Make Document::styleForElementIgnoringPendingStyleSheets() be aware of a flat tree structure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/js-test.js"></script> 2 <!DOCTYPE html>
3 <script src='../resources/testharness.js'></script>
4 <script src='../resources/testharnessreport.js'></script>
5 <script src='resources/shadow-dom.js'></script>
6 <style>
7 #host {
8 color: red;
9 }
10 </style>
3 <div id="host"> 11 <div id="host">
4 <div slot="s1">This text should be green</div> 12 <template data-mode="open">
13 <style>
14 div {
15 color: green;
16 }
17 div.p1 {
18 color: blue;
19 }
20 </style>
21 <div>
22 <slot name="s1"></slot>
23 </div>
24 </template>
25 <div slot="no-assign"><span id="span0"></span></div>
26 <div slot="s1"><span id="span1"></span></div>
5 </div> 27 </div>
6 <script> 28 <script>
7 description("A changed inherited property on a slot parent should propagate down to slotted elements."); 29 test(() => {
30 convertTemplatesToShadowRootsWithin(host);
8 31
9 var root = host.attachShadow({mode:"open"}); 32 assert_equals(getComputedStyle(span0).color, 'rgb(0, 0, 0)',
10 root.innerHTML = '<style>.p1 { color: green }</style><div id="p1"><slot name ="s1"></slot></div>'; 33 'An element which is not assigned to any slot should not inherit a style from the parent.');
11 var p1 = root.querySelector("#p1"); 34 assert_equals(getComputedStyle(host.shadowRoot.querySelector('slot')).color, ' rgb(0, 0, 0)',
12 var s1 = host.querySelector("[slot]"); 35 'A slot should not inherit a style from the parent because Blink does not support "slots in the flat tree".');
13 shouldBeEqualToString("getComputedStyle(s1).color", "rgb(0, 0, 0)"); 36
14 p1.className = "p1"; 37 assert_equals(getComputedStyle(span1).color, 'rgb(0, 128, 0)',
15 shouldBeEqualToString("getComputedStyle(s1).color", "rgb(0, 128, 0)"); 38 'An element which is assigned to a slot should inherit a style f rom the slot.');
rune 2016/08/23 12:36:12 Here, the span gets the green color from the light
hayato 2016/08/24 03:34:58 It gets the green color from the parent of the slo
rune 2016/08/24 12:38:44 Doesn't #span1 inherit from <div slot="s1"> ?
hayato 2016/08/25 02:01:19 Yeah, it actually inherits from <div slot="s1"> in
rune 2016/08/25 07:49:39 No, my point is that <div slot="s1"> is #span1's p
39 host.shadowRoot.querySelector('div').className = 'p1';
40 assert_equals(getComputedStyle(span1).color, 'rgb(0, 0, 255)',
41 'The style change should propagate down to a slotted element.');
42 }, 'CSS inheritance tests for assigned nodes, not-assigned nodes, and slots');
16 </script> 43 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698