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

Side by Side Diff: LayoutTests/fast/css/readwrite-contenteditable-recalc.html

Issue 148223004: Improve support for :read-only and :read-write pseudoclasses. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove html, head and body tags from test. Created 6 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
OLDNEW
(Empty)
1 <!doctype html>
2
3 <script src='../../resources/js-test.js'></script>
4
5 <style>
6 div:read-only, span:read-only { background-color: rgb(204, 255, 255); }
7 div:read-write, span:read-write { background-color: rgb(255, 204, 204); }
8 </style>
9
10 <div id="p1" contenteditable>Some parent text. <span id="c1a">Some <span id="c1b ">child text.</span></span></div>
11 <div id="p2">Some parent text. <span id="c2a">Some <span id="c2b">child text.</s pan></span></div>
12
13 <script>
14
15 var readOnlyColor = '"rgb(204, 255, 255)"';
16 var readWriteColor = '"rgb(255, 204, 204)"';
17
18 var p1 = document.getElementById('p1');
19 var c1a = document.getElementById('c1a');
20 var c1b = document.getElementById('c1b');
21
22 var p2 = document.getElementById('p2');
23 var c2a = document.getElementById('c2a');
24 var c2b = document.getElementById('c2b');
25
26 var backgroundColorOf = function(elmName) {
27 return 'getComputedStyle('+elmName+')["background-color"]';
28 };
29
30 // Check initial computed style.
31
32 shouldBe(backgroundColorOf('p1'), readWriteColor);
33 shouldBe(backgroundColorOf('c1a'), readWriteColor);
34 shouldBe(backgroundColorOf('c1b'), readWriteColor);
35
36 shouldBe(backgroundColorOf('p2'), readOnlyColor);
37 shouldBe(backgroundColorOf('c2a'), readOnlyColor);
38 shouldBe(backgroundColorOf('c2b'), readOnlyColor);
39
40 p1.setAttribute("contenteditable", "false");
41 p2.setAttribute("contenteditable", "true");
42
43 // Check computed style after changing attribute.
44
45 shouldBe(backgroundColorOf('p1'), readOnlyColor);
46 shouldBe(backgroundColorOf('c1a'), readOnlyColor);
47 shouldBe(backgroundColorOf('c1b'), readOnlyColor);
48
49 shouldBe(backgroundColorOf('p2'), readWriteColor);
50 shouldBe(backgroundColorOf('c2a'), readWriteColor);
51 shouldBe(backgroundColorOf('c2b'), readWriteColor);
52
53 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698