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

Side by Side Diff: LayoutTests/fast/css/invalidation/targeted-class-style-invalidation.html

Issue 171513006: Support invalidation sets for simple class selectors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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 <script src="../../../resources/js-test.js"></script>
3 3
4 <style> 4 <style>
5 div { width: 100px } 5 div { width: 100px }
6 .outer .inner { width: 200px } 6 .outer .inner { width: 200px }
7 .outer2 { width: 150px }
7 </style> 8 </style>
8 9
9 <div id="outer"> 10 <div id="outer">
10 <div id="inner" class="inner"> 11 <div id="inner" class="inner">
11 <div id="innerChild"> 12 <div id="innerChild">
12 </div> 13 </div>
13 </div> 14 </div>
14 <div id="inner2"> 15 <div id="inner2">
15 </div> 16 </div>
16 </div> 17 </div>
18 <div id="outer2">
19 <div id="inner3"></div>
20 </div>
17 21
18 <script> 22 <script>
19 description("Test that adding and removing class names only updates the elements that are affected."); 23 description("Test that adding and removing class names only updates the elements that are affected.");
20 24
21 function insertStyleSheet(css) 25 function insertStyleSheet(css)
22 { 26 {
23 var styleElement = document.createElement("style"); 27 var styleElement = document.createElement("style");
24 styleElement.textContent = css; 28 styleElement.textContent = css;
25 (document.head || document.documentElement).appendChild(styleElement); 29 (document.head || document.documentElement).appendChild(styleElement);
26 } 30 }
27 31
28 var outer = document.getElementById('outer'); 32 var outer = document.getElementById('outer');
29 var inner = document.getElementById('inner'); 33 var inner = document.getElementById('inner');
34 var outer2 = document.getElementById('outer2');
30 35
31 var count; 36 var count;
32 if (internals.runtimeFlags.targetedStyleRecalcEnabled) 37 if (internals.runtimeFlags.targetedStyleRecalcEnabled)
33 count = 2; 38 count = 2;
34 else 39 else
35 count = 4; 40 count = 4;
36 41
37 // Style recalc should happen on "inner" and "outer", but not "inner2". 42 // Style recalc should happen on "inner" and "outer", but not "inner2".
38 outer.offsetTop; 43 outer.offsetTop;
39 outer.className = 'outer'; 44 outer.className = 'outer';
40 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", '' + count); 45 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", '' + count);
41 shouldBe("getComputedStyle(inner).width", '"200px"'); 46 shouldBe("getComputedStyle(inner).width", '"200px"');
42 47
43 if (internals.runtimeFlags.targetedStyleRecalcEnabled) 48 if (internals.runtimeFlags.targetedStyleRecalcEnabled)
44 count = 1; 49 count = 1;
45 else 50 else
46 count = 2; 51 count = 2;
47 52
48 // Style recalc should happen on "inner", but not "innerChild". 53 // Style recalc should happen on "inner", but not "innerChild".
49 inner.offsetTop; 54 inner.offsetTop;
50 inner.className = ''; 55 inner.className = '';
51 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", '' + count); 56 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", '' + count);
52 shouldBe("getComputedStyle(inner).width", '"100px"'); 57 shouldBe("getComputedStyle(inner).width", '"100px"');
53 58
59 if (internals.runtimeFlags.targetedStyleRecalcEnabled)
60 count = 1;
61 else
62 count = 2;
63
64 // Style recalc should happen on "outer2", but not "inner3".
65 outer2.offsetTop;
66 outer2.className = 'outer2';
67 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", '' + count);
68 shouldBe("getComputedStyle(outer2).width", '"150px"');
54 </script> 69 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698