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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/shadow/import-rule-in-shadow-tree-needs-document-style-recalc.html

Issue 1896793002: Rename (updateLayout/updateStyle).*.() to updateStyleAndLayout.*.() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/run-after-layout-and-paint.js"></script> 2 <script src="../../../resources/run-after-layout-and-paint.js"></script>
3 <script> 3 <script>
4 onload = function() { 4 onload = function() {
5 var host = document.getElementById('host'); 5 var host = document.getElementById('host');
6 var sr = host.createShadowRoot(); 6 var sr = host.createShadowRoot();
7 // To make documentScopeDirty clean, add fake style element to document. 7 // To make documentScopeDirty clean, add fake style element to document.
8 document.head.appendChild(document.createElement('style')); 8 document.head.appendChild(document.createElement('style'));
9 // Should invoke style recalc here. 9 // Should invoke style recalc here.
10 document.body.offsetLeft; 10 document.body.offsetLeft;
11 11
12 // Need a parent element of a shadow host. 12 // Need a parent element of a shadow host.
13 // Shadow hosts' styles are recalc-ed by updating styles in shadow trees, bu t 13 // Shadow hosts' styles are recalc-ed by updating styles in shadow trees, bu t
14 // Their parents are not recalc-ed. 14 // Their parents are not recalc-ed.
15 var parentOfHostInShadow = document.createElement('div'); 15 var parentOfHostInShadow = document.createElement('div');
16 var hostInShadow = document.createElement('div'); 16 var hostInShadow = document.createElement('div');
17 parentOfHostInShadow.appendChild(hostInShadow); 17 parentOfHostInShadow.appendChild(hostInShadow);
18 18
19 // Create shadow tree with style which has @import. 19 // Create shadow tree with style which has @import.
20 var sr2 = hostInShadow.createShadowRoot(); 20 var sr2 = hostInShadow.createShadowRoot();
21 sr2.innerHTML = '<style>@import url("../../css/resources/green.css");</style ><div>PASS</div></style>'; 21 sr2.innerHTML = '<style>@import url("../../css/resources/green.css");</style ><div>PASS</div></style>';
22 sr.appendChild(parentOfHostInShadow); 22 sr.appendChild(parentOfHostInShadow);
23 23
24 // Force style recalc before sheetLoaded here. 24 // Force style recalc before sheetLoaded here.
25 // document.body.offset is slow. It causes style recalc after sheetLoaded. 25 // document.body.offset is slow. It causes style recalc after sheetLoaded.
26 // Instead, use internals.updateStyleAndReturnAffectedElementCount 26 // Instead, use internals.updateStyleAndLayoutAndReturnAffectedElementCount
27 // (to emulate @import's network delay). 27 // (to emulate @import's network delay).
28 internals.updateStyleAndReturnAffectedElementCount(); 28 internals.updateStyleAndLayoutAndReturnAffectedElementCount();
29 29
30 if (window.testRunner) 30 if (window.testRunner)
31 testRunner.waitUntilDone(); 31 testRunner.waitUntilDone();
32 runAfterLayoutAndPaint(function() { 32 runAfterLayoutAndPaint(function() {
33 if (window.testRunner) 33 if (window.testRunner)
34 testRunner.notifyDone(); 34 testRunner.notifyDone();
35 }); 35 });
36 } 36 }
37 </script> 37 </script>
38 <div id="host"></div> 38 <div id="host"></div>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698