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

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

Issue 653423003: Support style invalidation for scrollbar pseudo elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git/+/master
Patch Set: 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
« no previous file with comments | « no previous file | LayoutTests/fast/css/invalidation/scrollbar-pseudo-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/css/invalidation/scrollbar-pseudo.html
diff --git a/LayoutTests/fast/css/invalidation/scrollbar-pseudo.html b/LayoutTests/fast/css/invalidation/scrollbar-pseudo.html
new file mode 100644
index 0000000000000000000000000000000000000000..ddf2b7de18c4e996b82da5d2967137fb0ee627d9
--- /dev/null
+++ b/LayoutTests/fast/css/invalidation/scrollbar-pseudo.html
@@ -0,0 +1,113 @@
+<!DOCTYPE html>
+<script src="../../../resources/js-test.js"></script>
+<style>
+.scroller::-webkit-scrollbar {
+ height: 5px;
+}
+
+.scroller {
+ width: 200px;
+ height: 10px;
+ overflow-x: scroll;
+}
+
+.scroller > div {
+ width: 400px;
+}
+
+.t1 .scroller::-webkit-scrollbar,
+.t2 + .scroller::-webkit-scrollbar,
+.t3 .scroller::-webkit-scrollbar-button,
+.t4 + .scroller::-webkit-scrollbar-button,
+.t5 .scroller::-webkit-scrollbar-corner,
+.t6 + .scroller::-webkit-scrollbar-corner,
+.t7 .scroller::-webkit-scrollbar-thumb,
+.t8 + .scroller::-webkit-scrollbar-thumb,
+.t9 .scroller::-webkit-scrollbar-track,
+.t10 + .scroller::-webkit-scrollbar-track,
+.t11 .scroller::-webkit-scrollbar-track-piece,
+.t12 + .scroller::-webkit-scrollbar-track-piece {
+ background-color: green;
+}
+</style>
+<div>
+ <div id="scrollerParent">
+ <div>
+ <div id="scroller1" class="scroller">
+ <div>
+ <span></span>
+ <span></span>
+ <span></span>
+ <span></span>
+ </div>
+ </div>
+ <div></div>
+ </div>
+ </div>
+</div>
+<div>
+ <div id="scrollerSibling"></div>
+ <div id="scroller2" class="scroller">
+ <div>
+ <span></span>
+ <span></span>
+ <span></span>
+ <span></span>
+ </div>
+ </div>
+ <div>
+ <div></div>
+ </div>
+<script>
+description("Style invalidation for scrollbar pseudo elements.");
+
+var transparent = "rgba(0, 0, 0, 0)";
+var green = "rgb(0, 128, 0)";
+
+function testScrollbarPseudo(pseudoElm, scroller, classElement, testClass, expectedCount) {
+
+ var computedString = "getComputedStyle(" + scroller + ", '" + pseudoElm + "').backgroundColor";
+
+ shouldBe(computedString, "transparent");
+
+ document.body.offsetTop; // force recalc
+ classElement.className = testClass;
+
+ if (window.internals)
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "" + expectedCount);
+
+ shouldBe(computedString, "green");
+ classElement.className = "";
+}
+
+// The expected affected element counts below need an explanation:
+//
+// The descendant selector tests invalidate 2 normal dom elements:
+// #scrollerParent, #scroller1
+//
+// The sibling selector tests invalidate 7 normal dom elements:
+// #scrollerSibling, #scroller2, the div child of #scroller2 and its 4 spans
+//
+// In addition there the pseudo element selectors add the following pseudo elements
+// on the #scroller1 and #scroller2 elements:
+//
+// ::-webkit-scrollbar: 1 scrollbar pseudo element (in total 3 and 8)
+// ::-webkit-scrollbar-button: 1 scrollbar + 4 buttons (in total 7 and 12)
+// ::-webkit-scrollbar-corner: 1 scrollbar + 1 corner (in total 4 and 9)
+// ::-webkit-scrollbar-thumb: 1 scrollbar + 1 thumb (in total 4 and 9)
+// ::-webkit-scrollbar-track: 1 scrollbar + 1 track (in total 4 and 9)
+// ::-webkit-scrollbar-track-piece: 1 scrollbar + 2 track pieces (in total 5 and 12)
+
+testScrollbarPseudo("::-webkit-scrollbar", "scroller1", scrollerParent, "t1", 3);
+testScrollbarPseudo("::-webkit-scrollbar", "scroller2", scrollerSibling, "t2", 8);
+testScrollbarPseudo("::-webkit-scrollbar-button", "scroller1", scrollerParent, "t3", 7);
+testScrollbarPseudo("::-webkit-scrollbar-button", "scroller2", scrollerSibling, "t4", 12);
+testScrollbarPseudo("::-webkit-scrollbar-corner", "scroller1", scrollerParent, "t5", 4);
+testScrollbarPseudo("::-webkit-scrollbar-corner", "scroller2", scrollerSibling, "t6", 9);
+testScrollbarPseudo("::-webkit-scrollbar-thumb", "scroller1", scrollerParent, "t7", 4);
+testScrollbarPseudo("::-webkit-scrollbar-thumb", "scroller2", scrollerSibling, "t8", 9);
+testScrollbarPseudo("::-webkit-scrollbar-track", "scroller1", scrollerParent, "t9", 4);
+testScrollbarPseudo("::-webkit-scrollbar-track", "scroller2", scrollerSibling, "t10", 9);
+testScrollbarPseudo("::-webkit-scrollbar-track-piece", "scroller1", scrollerParent, "t11", 5);
+testScrollbarPseudo("::-webkit-scrollbar-track-piece", "scroller2", scrollerSibling, "t12", 10);
+</script>
« no previous file with comments | « no previous file | LayoutTests/fast/css/invalidation/scrollbar-pseudo-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698