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

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

Issue 2700943003: Invalidate custom pseudo elements for RuleSet invalidations. (Closed)
Patch Set: 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"> 11 <div id="found">
12 <div></div> 12 <div></div>
13 </div> 13 </div>
14 <span></span> 14 <span></span>
15 </div> 15 </div>
16 <div id="placeholderWrapper">
17 <textarea placeholder="Placeholder text"></textarea>
18 </div>
19 <textarea placeholder="Placeholder text"></textarea>
16 <script> 20 <script>
17 test(() => { 21 test(() => {
18 assert_true(!!window.internals, "Tests require window.internals."); 22 assert_true(!!window.internals, "Tests require window.internals.");
19 }, "Test for prerequisites."); 23 }, "Test for prerequisites.");
20 24
21 function applyRuleAndReturnAffectedElementCount(ruleString) { 25 function applyRuleAndReturnAffectedElementCount(ruleString) {
22 document.body.offsetTop; 26 document.body.offsetTop;
23 document.styleSheets[0].insertRule(ruleString, 0); 27 document.styleSheets[0].insertRule(ruleString, 0);
24 var recalcCount = internals.updateStyleAndReturnAffectedElementCount(); 28 var recalcCount = internals.updateStyleAndReturnAffectedElementCount();
25 document.styleSheets[0].removeRule(); 29 document.styleSheets[0].removeRule();
(...skipping 10 matching lines...) Expand all
36 assert_equals(applyRuleAndReturnAffectedElementCount( 40 assert_equals(applyRuleAndReturnAffectedElementCount(
37 "#notfound div { background: red }"), 0, 41 "#notfound div { background: red }"), 0,
38 "Check that none of divs are recalculated."); 42 "Check that none of divs are recalculated.");
39 }, "A type selector scoped in an unknown id should not invalidate any elemen ts."); 43 }, "A type selector scoped in an unknown id should not invalidate any elemen ts.");
40 44
41 test(() => { 45 test(() => {
42 assert_equals(applyRuleAndReturnAffectedElementCount( 46 assert_equals(applyRuleAndReturnAffectedElementCount(
43 "#found div { background: red }"), 1, 47 "#found div { background: red }"), 1,
44 "Check that only one of the divs is recalculated."); 48 "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."); 49 }, "A type selector scoped by a known id should only invalidate descendants of the element with that id.");
50
51 test(() => {
52 assert_equals(applyRuleAndReturnAffectedElementCount(
53 "::-webkit-input-placeholder { background: green }"), 2,
54 "Check that only custom pseudo elements are recalculated.");
55 }, "A style rule with a custom pseudo element should only invalidate custom pseudo elements.");
56
57 test(() => {
58 assert_equals(applyRuleAndReturnAffectedElementCount(
59 "#notfound ::-webkit-input-placeholder { background: green }"), 0,
60 "Check that no elements are recalculated.");
61 }, "A custom pseudo element scoped in an unknown id should not invalidate an y elements.");
62
63 test(() => {
64 assert_equals(applyRuleAndReturnAffectedElementCount(
65 "#placeholderWrapper ::-webkit-input-placeholder { background: green }"), 1,
66 "Check that only the scoped custom pseudo element is recalculated.") ;
67 }, "A custom pseudo element scoped in a known id should only invalidate desc endants of the element with that id.");
46 </script> 68 </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