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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/css/invalidation/sheet-ruleset-invalidation.html

Issue 2703643003: Schedule a type selector invalidation set for RuleSet invalidations. (Closed)
Patch Set: Corrected expectation text. Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/RuleFeature.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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></style> 4 <style></style>
5 <div> 5 <div>
6 <div></div> 6 <div></div>
7 <div></div> 7 <div></div>
8 <div></div> 8 <div></div>
9 <div></div> 9 <div></div>
10 <div></div> 10 <div></div>
11 <div id="found">
12 <div></div>
13 </div>
11 <span></span> 14 <span></span>
12 </div> 15 </div>
13 <script> 16 <script>
14 test(() => { 17 test(() => {
15 assert_true(!!window.internals, "Test requires window.internals."); 18 assert_true(!!window.internals, "Tests require window.internals.");
19 }, "Test for prerequisites.");
20
21 function applyRuleAndReturnAffectedElementCount(ruleString) {
16 document.body.offsetTop; 22 document.body.offsetTop;
17 document.styleSheets[0].insertRule("span{background:green}", 0); 23 document.styleSheets[0].insertRule(ruleString, 0);
18 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, " Check that only the span is affected."); 24 var recalcCount = internals.updateStyleAndReturnAffectedElementCount();
19 }, "Inserting a style rule with a type selector should only invalidate eleme nts with that type."); 25 document.styleSheets[0].removeRule();
26 return recalcCount;
27 }
28
29 test(() => {
30 assert_equals(applyRuleAndReturnAffectedElementCount(
31 "span { background: green }"), 1,
32 "Check that only the span is affected.");
33 }, "A style rule with a type selector should only invalidate elements with t hat type.");
34
35 test(() => {
36 assert_equals(applyRuleAndReturnAffectedElementCount(
37 "#notfound div { background: red }"), 0,
38 "Check that none of divs are recalculated.");
39 }, "A type selector scoped in an unknown id should not invalidate any elemen ts.");
40
41 test(() => {
42 assert_equals(applyRuleAndReturnAffectedElementCount(
43 "#found div { background: red }"), 1,
44 "Check that only one of the divs is recalculated.");
45 }, "A type selector scoped by a known id should only invalidate descendants of the element with that id.");
20 </script> 46 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/RuleFeature.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698