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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/RuleFeature.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/css/invalidation/sheet-ruleset-invalidation.html
diff --git a/third_party/WebKit/LayoutTests/fast/css/invalidation/sheet-ruleset-invalidation.html b/third_party/WebKit/LayoutTests/fast/css/invalidation/sheet-ruleset-invalidation.html
index e8a7c780b3a0342601fd4fb64d166c0e87864d34..d513ff27d29d9da3dd2c5aa4918d3c1c7578b5b8 100644
--- a/third_party/WebKit/LayoutTests/fast/css/invalidation/sheet-ruleset-invalidation.html
+++ b/third_party/WebKit/LayoutTests/fast/css/invalidation/sheet-ruleset-invalidation.html
@@ -8,13 +8,39 @@
<div></div>
<div></div>
<div></div>
+ <div id="found">
+ <div></div>
+ </div>
<span></span>
</div>
<script>
test(() => {
- assert_true(!!window.internals, "Test requires window.internals.");
+ assert_true(!!window.internals, "Tests require window.internals.");
+ }, "Test for prerequisites.");
+
+ function applyRuleAndReturnAffectedElementCount(ruleString) {
document.body.offsetTop;
- document.styleSheets[0].insertRule("span{background:green}", 0);
- assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "Check that only the span is affected.");
- }, "Inserting a style rule with a type selector should only invalidate elements with that type.");
+ document.styleSheets[0].insertRule(ruleString, 0);
+ var recalcCount = internals.updateStyleAndReturnAffectedElementCount();
+ document.styleSheets[0].removeRule();
+ return recalcCount;
+ }
+
+ test(() => {
+ assert_equals(applyRuleAndReturnAffectedElementCount(
+ "span { background: green }"), 1,
+ "Check that only the span is affected.");
+ }, "A style rule with a type selector should only invalidate elements with that type.");
+
+ test(() => {
+ assert_equals(applyRuleAndReturnAffectedElementCount(
+ "#notfound div { background: red }"), 0,
+ "Check that none of divs are recalculated.");
+ }, "A type selector scoped in an unknown id should not invalidate any elements.");
+
+ test(() => {
+ assert_equals(applyRuleAndReturnAffectedElementCount(
+ "#found div { background: red }"), 1,
+ "Check that only one of the divs is recalculated.");
+ }, "A type selector scoped by a known id should only invalidate descendants of the element with that id.");
</script>
« 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