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

Unified Diff: LayoutTests/fast/css/invalidation/valid-invalid-pseudo.html

Issue 620333002: Use invalidation sets for :invalid/:valid/:required/:optional. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 2 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
Index: LayoutTests/fast/css/invalidation/valid-invalid-pseudo.html
diff --git a/LayoutTests/fast/css/invalidation/valid-invalid-pseudo.html b/LayoutTests/fast/css/invalidation/valid-invalid-pseudo.html
new file mode 100644
index 0000000000000000000000000000000000000000..b39c788043c72edfecdcecf782b93921c24897c1
--- /dev/null
+++ b/LayoutTests/fast/css/invalidation/valid-invalid-pseudo.html
@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<script src="../../../resources/js-test.js"></script>
+<style>
+input { background-color: transparent }
+#inputValid:valid,
+#inputInvalid:invalid,
+#formValid:valid,
+#formInvalid:invalid {
+ background-color: green
+}
+
+form + div,
+input + div {
+ color: pink
+}
+</style>
+<input id="inputValid" required></input>
+<div>
+ <div></div>
+ <div></div>
+</div>
+<input id="inputInvalid"></input>
+<div>
+ <div></div>
+ <div></div>
+</div>
+<form id="formValid">
+ <input id="inputInFormValid" type="text" required></input>
+ <input type="text"></input>
+ <input type="text"></input>
+</form>
+<div>
+ <div></div>
+ <div></div>
+</div>
+<form id="formInvalid">
+ <input id="inputInFormInvalid" type="text"></input>
+ <input type="text"></input>
+ <input type="text"></input>
+</form>
+<div>
+ <div></div>
+ <div></div>
+</div>
+
+<script>
+description("Use descendant invalidation sets for :valid and :invalid pseudo classes.")
+
+var transparent = "rgba(0, 0, 0, 0)";
+var green = "rgb(0, 128, 0)";
+
+shouldBe("getComputedStyle(inputValid, '').backgroundColor", "transparent");
+document.body.offsetTop; // Force recalc.
+inputValid.removeAttribute("required");
+if (window.internals)
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
+shouldBe("getComputedStyle(inputValid, '').backgroundColor", "green");
+
+shouldBe("getComputedStyle(inputInvalid, '').backgroundColor", "transparent");
+document.body.offsetTop; // Force recalc.
+inputInvalid.setAttribute("required", "");
+if (window.internals)
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
+shouldBe("getComputedStyle(inputInvalid, '').backgroundColor", "green");
+
+shouldBe("getComputedStyle(formInvalid, '').backgroundColor", "transparent");
+document.body.offsetTop; // Force recalc.
+inputInFormValid.removeAttribute("required");
+if (window.internals)
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2");
+shouldBe("getComputedStyle(formValid, '').backgroundColor", "green");
+
+shouldBe("getComputedStyle(formInvalid, '').backgroundColor", "transparent");
+document.body.offsetTop; // Force recalc.
+inputInFormInvalid.setAttribute("required", "");
+if (window.internals)
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2");
+shouldBe("getComputedStyle(formInvalid, '').backgroundColor", "green");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698