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

Side by Side Diff: LayoutTests/fast/css/invalidation/compound.html

Issue 1349543004: CSS: Avoid invalidating style when only descendants need updating (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: invalidatesSelf Created 5 years, 3 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/testharness.js"></script> 2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script> 3 <script src="../../../resources/testharnessreport.js"></script>
4 <style> 4 <style>
5 .t1 span.c#r1, 5 .t1 span.c#r1,
6 .t2 *.c#r2, 6 .t2 *.c#r2,
7 .t3 span.c, 7 .t3 span.c,
8 .t4 *.ca.cb, 8 .t4 *.ca.cb,
9 .t5 :-webkit-any(div.ca.cb, *.cc.cd#r5b), 9 .t5 :-webkit-any(div.ca.cb, *.cc.cd#r5b),
10 .t6 ~ div > span.c#r6, 10 .t6 ~ div > span.c#r6,
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 document.body.offsetTop; 123 document.body.offsetTop;
124 124
125 test(function() { 125 test(function() {
126 assert_true(!!window.internals, "This test only works with internals exposed present"); 126 assert_true(!!window.internals, "This test only works with internals exposed present");
127 }, "internals are exposed"); 127 }, "internals are exposed");
128 128
129 test(function() { 129 test(function() {
130 assert_equals(getComputedStyle(r1).backgroundColor, "rgba(0, 0, 0, 0)", "Bac kground color should initially be transparent"); 130 assert_equals(getComputedStyle(r1).backgroundColor, "rgba(0, 0, 0, 0)", "Bac kground color should initially be transparent");
131 131
132 t1.className = "t1"; 132 t1.className = "t1";
133 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 5, "Subt ree style recalc"); 133 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subt ree style recalc");
134 assert_equals(getComputedStyle(r1).backgroundColor, "rgb(0, 128, 0)", "Backg round color is green after class change"); 134 assert_equals(getComputedStyle(r1).backgroundColor, "rgb(0, 128, 0)", "Backg round color is green after class change");
135 }, "Descendant with compound selector containing id"); 135 }, "Descendant with compound selector containing id");
136 136
137 test(function() { 137 test(function() {
138 assert_equals(getComputedStyle(r2).backgroundColor, "rgba(0, 0, 0, 0)", "Bac kground color should initially be transparent"); 138 assert_equals(getComputedStyle(r2).backgroundColor, "rgba(0, 0, 0, 0)", "Bac kground color should initially be transparent");
139 139
140 t2.className = "t2"; 140 t2.className = "t2";
141 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt ree style recalc"); 141 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2, "Subt ree style recalc");
142 assert_equals(getComputedStyle(r2).backgroundColor, "rgb(0, 128, 0)", "Backg round color is green after class change"); 142 assert_equals(getComputedStyle(r2).backgroundColor, "rgb(0, 128, 0)", "Backg round color is green after class change");
143 }, "Descendant with compound selector containing universal and id"); 143 }, "Descendant with compound selector containing universal and id");
144 144
145 test(function() { 145 test(function() {
146 assert_equals(getComputedStyle(r3).backgroundColor, "rgba(0, 0, 0, 0)", "Bac kground color should initially be transparent"); 146 assert_equals(getComputedStyle(r3).backgroundColor, "rgba(0, 0, 0, 0)", "Bac kground color should initially be transparent");
147 147
148 t3.className = "t3"; 148 t3.className = "t3";
149 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subt ree style recalc"); 149 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt ree style recalc");
150 assert_equals(getComputedStyle(r3).backgroundColor, "rgb(0, 128, 0)", "Backg round color is green after class change"); 150 assert_equals(getComputedStyle(r3).backgroundColor, "rgb(0, 128, 0)", "Backg round color is green after class change");
151 }, "Descendant with compound selector"); 151 }, "Descendant with compound selector");
152 152
153 test(function() { 153 test(function() {
154 assert_equals(getComputedStyle(r4).backgroundColor, "rgba(0, 0, 0, 0)", "Bac kground color should initially be transparent"); 154 assert_equals(getComputedStyle(r4).backgroundColor, "rgba(0, 0, 0, 0)", "Bac kground color should initially be transparent");
155 155
156 t4.className = "t4"; 156 t4.className = "t4";
157 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subt ree style recalc"); 157 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt ree style recalc");
158 assert_equals(getComputedStyle(r4).backgroundColor, "rgb(0, 128, 0)", "Backg round color is green after class change"); 158 assert_equals(getComputedStyle(r4).backgroundColor, "rgb(0, 128, 0)", "Backg round color is green after class change");
159 }, "Descendant with compound selector containing universal"); 159 }, "Descendant with compound selector containing universal");
160 160
161 test(function() { 161 test(function() {
162 assert_equals(getComputedStyle(r5a).backgroundColor, "rgba(0, 0, 0, 0)", "Ba ckground color a should initially be transparent"); 162 assert_equals(getComputedStyle(r5a).backgroundColor, "rgba(0, 0, 0, 0)", "Ba ckground color a should initially be transparent");
163 assert_equals(getComputedStyle(r5b).backgroundColor, "rgba(0, 0, 0, 0)", "Ba ckground color b should initially be transparent"); 163 assert_equals(getComputedStyle(r5b).backgroundColor, "rgba(0, 0, 0, 0)", "Ba ckground color b should initially be transparent");
164 164
165 t5.className = "t5"; 165 t5.className = "t5";
166 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 6, "Subt ree style recalc"); 166 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 5, "Subt ree style recalc");
167 assert_equals(getComputedStyle(r5a).backgroundColor, "rgb(0, 128, 0)", "Back ground color a is green after class change"); 167 assert_equals(getComputedStyle(r5a).backgroundColor, "rgb(0, 128, 0)", "Back ground color a is green after class change");
168 assert_equals(getComputedStyle(r5b).backgroundColor, "rgb(0, 128, 0)", "Back ground color b is green after class change"); 168 assert_equals(getComputedStyle(r5b).backgroundColor, "rgb(0, 128, 0)", "Back ground color b is green after class change");
169 }, "Descendant with :-webkit-any containing compound selector"); 169 }, "Descendant with :-webkit-any containing compound selector");
170 170
171 test(function() { 171 test(function() {
172 assert_equals(getComputedStyle(r6).backgroundColor, "rgba(0, 0, 0, 0)", "Bac kground color should initially be transparent"); 172 assert_equals(getComputedStyle(r6).backgroundColor, "rgba(0, 0, 0, 0)", "Bac kground color should initially be transparent");
173 173
174 t6.className = "t6"; 174 t6.className = "t6";
175 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 6, "Subt ree style recalc"); 175 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 6, "Subt ree style recalc");
176 assert_equals(getComputedStyle(r6).backgroundColor, "rgb(0, 128, 0)", "Backg round color is green after class change"); 176 assert_equals(getComputedStyle(r6).backgroundColor, "rgb(0, 128, 0)", "Backg round color is green after class change");
(...skipping 28 matching lines...) Expand all
205 assert_equals(getComputedStyle(r10a).backgroundColor, "rgba(0, 0, 0, 0)", "B ackground color a should initially be transparent"); 205 assert_equals(getComputedStyle(r10a).backgroundColor, "rgba(0, 0, 0, 0)", "B ackground color a should initially be transparent");
206 assert_equals(getComputedStyle(r10b).backgroundColor, "rgba(0, 0, 0, 0)", "B ackground color b should initially be transparent"); 206 assert_equals(getComputedStyle(r10b).backgroundColor, "rgba(0, 0, 0, 0)", "B ackground color b should initially be transparent");
207 207
208 t10.className = "t10"; 208 t10.className = "t10";
209 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 9, "Subt ree style recalc"); 209 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 9, "Subt ree style recalc");
210 assert_equals(getComputedStyle(r10a).backgroundColor, "rgb(0, 128, 0)", "Bac kground color a is green after class change"); 210 assert_equals(getComputedStyle(r10a).backgroundColor, "rgb(0, 128, 0)", "Bac kground color a is green after class change");
211 assert_equals(getComputedStyle(r10b).backgroundColor, "rgb(0, 128, 0)", "Bac kground color b is green after class change"); 211 assert_equals(getComputedStyle(r10b).backgroundColor, "rgb(0, 128, 0)", "Bac kground color b is green after class change");
212 }, "Sibling with descendant :-webkit-any containing compound selector"); 212 }, "Sibling with descendant :-webkit-any containing compound selector");
213 213
214 </script> 214 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698