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

Side by Side Diff: LayoutTests/fast/css/invalidation/selection-pseudo.html

Issue 669873003: Avoid sub-tree style recalc for ::selection. (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 unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/css/invalidation/selection-pseudo-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../../resources/js-test.js"></script>
3 <style>
4 .select::selection {
5 background-color: red;
6 }
7
8 .t1 .select::selection,
9 .t2 .select::selection:window-inactive {
10 background-color: green;
11 }
12 </style>
13 <div id="t1">
14 <div>
15 <div class="select">
16 1
17 <span></span>
18 <span></span>
19 </div>
20 <div></div>
21 </div>
22 </div>
23 <div id="t2">
24 <div>
25 <div class="select">
26 2
27 <span></span>
28 <span></span>
29 </div>
30 <div></div>
31 </div>
32 </div>
33 <script>
34 description("Style invalidation for ::selection");
35
36 var red = "rgb(255, 0, 0)";
37 var green = "rgb(0, 128, 0)";
38
39 function setSelection(textNode) {
40 var range = document.createRange();
41 range.setStart(textNode, 0);
42 range.setEnd(textNode, 1);
43 window.getSelection().addRange(range);
44 }
45
46 var select = document.querySelectorAll(".select");
47
48 setSelection(select[0].firstChild);
49 shouldBe("getComputedStyle(select[0], '::selection').backgroundColor", "red");
50
51 document.body.offsetTop; // Force recalc.
52 t1.className = "t1";
53 if (window.internals)
54 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2");
55 shouldBe("getComputedStyle(select[0], '::selection').backgroundColor", "green");
56
57 shouldBeDefined(window.testRunner);
58 testRunner.setWindowIsKey(false);
59
60 setSelection(select[1].firstChild);
61 shouldBe("getComputedStyle(select[1], '::selection').backgroundColor", "red");
62
63 document.body.offsetTop; // Force recalc.
64 t2.className = "t2";
65 if (window.internals)
66 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2");
67 shouldBe("getComputedStyle(select[1], '::selection').backgroundColor", "green");
68 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/css/invalidation/selection-pseudo-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698