Regression(r188105): Seems to have caused crashes during PLT on some iPads
[WebKit-https.git] / LayoutTests / fast / css / named-colors.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Named Colors Test</title>
5 <script>
6
7     if (window.testRunner)
8         testRunner.dumpAsText();
9         
10     // Named colors and their rgb values as per the css3 specification.
11     // http://www.w3.org/TR/css3-color/#svg-color
12     var colors = [
13         ['aliceblue', '240,248,255'],
14         ['antiquewhite', '250,235,215'],
15         ['aqua', '0,255,255'],
16         ['aquamarine', '127,255,212'],
17         ['azure', '240,255,255'],
18         ['beige', '245,245,220'],
19         ['bisque', '255,228,196'],
20         ['black', '0,0,0'],
21         ['blanchedalmond', '255,235,205'],
22         ['blue', '0,0,255'],
23         ['blueviolet', '138,43,226'],
24         ['brown', '165,42,42'],
25         ['burlywood', '222,184,135'],
26         ['cadetblue', '95,158,160'],
27         ['chartreuse', '127,255,0'],
28         ['chocolate', '210,105,30'],
29         ['coral', '255,127,80'],
30         ['cornflowerblue', '100,149,237'],
31         ['cornsilk', '255,248,220'],
32         ['crimson', '220,20,60'],
33         ['cyan', '0,255,255'],
34         ['darkblue', '0,0,139'],
35         ['darkcyan', '0,139,139'],
36         ['darkgoldenrod', '184,134,11'],
37         ['darkgray', '169,169,169'],
38         ['darkgreen', '0,100,0'],
39         ['darkgrey', '169,169,169'],
40         ['darkkhaki', '189,183,107'],
41         ['darkmagenta', '139,0,139'],
42         ['darkolivegreen', '85,107,47'],
43         ['darkorange', '255,140,0'],
44         ['darkorchid', '153,50,204'],
45         ['darkred', '139,0,0'],
46         ['darksalmon', '233,150,122'],
47         ['darkseagreen', '143,188,143'],
48         ['darkslateblue', '72,61,139'],
49         ['darkslategray', '47,79,79'],
50         ['darkslategrey', '47,79,79'],
51         ['darkturquoise', '0,206,209'],
52         ['darkviolet', '148,0,211'],
53         ['deeppink', '255,20,147'],
54         ['deepskyblue', '0,191,255'],
55         ['dimgray', '105,105,105'],
56         ['dimgrey', '105,105,105'],
57         ['dodgerblue', '30,144,255'],
58         ['firebrick', '178,34,34'],
59         ['floralwhite', '255,250,240'],
60         ['forestgreen', '34,139,34'],
61         ['fuchsia', '255,0,255'],
62         ['gainsboro', '220,220,220'],
63         ['ghostwhite', '248,248,255'],
64         ['gold', '255,215,0'],
65         ['goldenrod', '218,165,32'],
66         ['gray', '128,128,128'],
67         ['green', '0,128,0'],
68         ['greenyellow', '173,255,47'],
69         ['grey', '128,128,128'],
70         ['honeydew', '240,255,240'],
71         ['hotpink', '255,105,180'],
72         ['indianred', '205,92,92'],
73         ['indigo', '75,0,130'],
74         ['ivory', '255,255,240'],
75         ['khaki', '240,230,140'],
76         ['lavender', '230,230,250'],
77         ['lavenderblush', '255,240,245'],
78         ['lawngreen', '124,252,0'],
79         ['lemonchiffon', '255,250,205'],
80         ['lightblue', '173,216,230'],
81         ['lightcoral', '240,128,128'],
82         ['lightcyan', '224,255,255'],
83         ['lightgoldenrodyellow', '250,250,210'],
84         ['lightgray', '211,211,211'],
85         ['lightgreen', '144,238,144'],
86         ['lightgrey', '211,211,211'],
87         ['lightpink', '255,182,193'],
88         ['lightsalmon', '255,160,122'],
89         ['lightseagreen', '32,178,170'],
90         ['lightskyblue', '135,206,250'],
91         ['lightslategray', '119,136,153'],
92         ['lightslategrey', '119,136,153'],
93         ['lightsteelblue', '176,196,222'],
94         ['lightyellow', '255,255,224'],
95         ['lime', '0,255,0'],
96         ['limegreen', '50,205,50'],
97         ['linen', '250,240,230'],
98         ['magenta', '255,0,255'],
99         ['maroon', '128,0,0'],
100         ['mediumaquamarine', '102,205,170'],
101         ['mediumblue', '0,0,205'],
102         ['mediumorchid', '186,85,211'],
103         ['mediumpurple', '147,112,219'],
104         ['mediumseagreen', '60,179,113'],
105         ['mediumslateblue', '123,104,238'],
106         ['mediumspringgreen', '0,250,154'],
107         ['mediumturquoise', '72,209,204'],
108         ['mediumvioletred', '199,21,133'],
109         ['midnightblue', '25,25,112'],
110         ['mintcream', '245,255,250'],
111         ['mistyrose', '255,228,225'],
112         ['moccasin', '255,228,181'],
113         ['navajowhite', '255,222,173'],
114         ['navy', '0,0,128'],
115         ['oldlace', '253,245,230'],
116         ['olive', '128,128,0'],
117         ['olivedrab', '107,142,35'],
118         ['orange', '255,165,0'],
119         ['orangered', '255,69,0'],
120         ['orchid', '218,112,214'],
121         ['palegoldenrod', '238,232,170'],
122         ['palegreen', '152,251,152'],
123         ['paleturquoise', '175,238,238'],
124         ['palevioletred', '219,112,147'],
125         ['papayawhip', '255,239,213'],
126         ['peachpuff', '255,218,185'],
127         ['peru', '205,133,63'],
128         ['pink', '255,192,203'],
129         ['plum', '221,160,221'],
130         ['powderblue', '176,224,230'],
131         ['purple', '128,0,128'],
132         ['rebeccapurple', '102,51,153'],
133         ['red', '255,0,0'],
134         ['rosybrown', '188,143,143'],
135         ['royalblue', '65,105,225'],
136         ['saddlebrown', '139,69,19'],
137         ['salmon', '250,128,114'],
138         ['sandybrown', '244,164,96'],
139         ['seagreen', '46,139,87'],
140         ['seashell', '255,245,238'],
141         ['sienna', '160,82,45'],
142         ['silver', '192,192,192'],
143         ['skyblue', '135,206,235'],
144         ['slateblue', '106,90,205'],
145         ['slategray', '112,128,144'],
146         ['slategrey', '112,128,144'],
147         ['snow', '255,250,250'],
148         ['springgreen', '0,255,127'],
149         ['steelblue', '70,130,180'],
150         ['tan', '210,180,140'],
151         ['teal', '0,128,128'],
152         ['thistle', '216,191,216'],
153         ['tomato', '255,99,71'],
154         ['turquoise', '64,224,208'],
155         ['violet', '238,130,238'],
156         ['wheat', '245,222,179'],
157         ['white', '255,255,255'],
158         ['whitesmoke', '245,245,245'],
159         ['yellow', '255,255,0'],
160         ['yellowgreen', '154,205,50']
161     ];
162
163     function testColor(colorName, expected)
164     {
165         var element = document.createElement("div");
166         var statusSpan = document.createElement("span");
167         element.appendChild(statusSpan);
168         var colorSpan = document.createElement("span");
169         colorSpan.appendChild(document.createTextNode(colorName));
170         colorSpan.style.backgroundColor = colorName;
171         element.appendChild(colorSpan);
172         document.body.appendChild(element);
173         
174         var value = document.defaultView.getComputedStyle(colorSpan, "").getPropertyValue("background-color");
175         var actual = value.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/).splice(1).join(',');
176         if (actual == expected) {
177             statusSpan.appendChild(document.createTextNode('PASS '));
178             element.appendChild(document.createTextNode(' is ' + actual));
179         } else {
180             statusSpan.appendChild(document.createTextNode('FAIL '));
181             element.appendChild(document.createTextNode(' was ' + actual + ', expected ' + expected));
182         }
183     }
184
185     function test()
186     {
187         for (var color, i = 0; color = colors[i]; i++) {
188             testColor(color[0], color[1]);
189         }
190     }
191
192 </script>
193 </head>
194 <body onload="test()">
195 </body>
196 </html>