OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
pdr
2011/12/14 21:02:36
Could you test this on FF and IE as well? Several
shauvik
2011/12/16 07:19:27
I will test and fix on FF. For IE, I don't have ac
| |
4 | |
5 /** Dynamic stylesheet injector with inline resources */ | |
6 class DARTestCss { | |
7 | |
8 /** This fuction injects the stylesheet text in the document */ | |
9 static void inject(Document doc, bool inAppMode){ | |
10 HTMLStyleElement style = doc.createElement('style'); | |
11 style.type = 'text/css'; | |
12 if(inAppMode) { | |
13 style.textContent = _getInAppStyleSheet(); | |
14 } else { | |
15 style.textContent = _getFullAppStyleSheet(); | |
16 } | |
17 doc.head.appendChild(style); | |
18 } | |
19 | |
20 static String commonStyles = ''' | |
21 | |
22 /* Dartest Common Styles */ | |
23 | |
24 .dt-hide{ | |
Kelly Norton
2011/12/15 18:35:31
space before {
shauvik
2011/12/16 07:19:27
Done.
| |
25 display:none; | |
26 } | |
27 | |
28 .dt-show{ | |
Kelly Norton
2011/12/15 18:35:31
space before {
shauvik
2011/12/16 07:19:27
Done.
| |
29 display:block; | |
30 } | |
31 | |
32 .dt-tab ul{ | |
Kelly Norton
2011/12/15 18:35:31
space before {
shauvik
2011/12/16 07:19:27
Done.
| |
33 list-style:none; | |
34 padding:5px 0; | |
35 margin:0; | |
36 background-color:#EEE; | |
37 } | |
38 | |
39 .dt-tab li{ | |
Kelly Norton
2011/12/15 18:35:31
space before {
shauvik
2011/12/16 07:19:27
Done.
| |
40 display: inline; | |
41 border: solid #BBB; | |
42 border-width: 1px 1px 0 1px; | |
43 margin: 0 -1px 0 0; | |
44 padding: 5px 10px; | |
45 cursor:pointer; | |
46 } | |
47 | |
48 .dt-tab li:hover{ | |
Kelly Norton
2011/12/15 18:35:31
space before {
shauvik
2011/12/16 07:19:27
Done.
| |
49 background-color:#BBB; | |
50 } | |
51 | |
52 .dt-tab-selected{ | |
Kelly Norton
2011/12/15 18:35:31
space before {
shauvik
2011/12/16 07:19:27
Done.
| |
53 background-color:#FFF; | |
54 } | |
55 | |
56 .dt-results{ | |
Kelly Norton
2011/12/15 18:35:31
space before {
(lots more below)
shauvik
2011/12/16 07:19:27
Done.
| |
57 width:100%; | |
58 border-collapse:collapse; | |
59 border: solid 1px #777; | |
60 margin: 25px 0px 0px 0px; | |
61 } | |
62 | |
63 .dt-results th,td{ | |
64 border: solid 1px #777; | |
65 padding: 2px; | |
66 font-size: 12px; | |
67 } | |
68 | |
69 .dt-results thead{ | |
70 background-color:#DDD; | |
71 } | |
72 | |
73 .dt-result-row{ | |
74 background-color:#EEE; | |
75 cursor:pointer; | |
76 } | |
77 | |
78 .dt-result-row:hover{ | |
79 text-decoration:underline; | |
80 font-weight:bold; | |
81 } | |
82 | |
83 .dt-main::-webkit-scrollbar{ | |
84 width:8px; | |
85 height:8px; | |
86 } | |
87 | |
88 .dt-main::-webkit-scrollbar-track { | |
89 -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); | |
90 -webkit-border-radius: 10px; | |
91 border-radius: 10px; | |
92 } | |
93 | |
94 .dt-main::-webkit-scrollbar-thumb { | |
95 -webkit-border-radius: 10px; | |
96 border-radius: 10px; | |
97 background: #888; | |
98 -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); | |
99 } | |
100 | |
101 .dt-toolbar{ | |
102 width: 150px; | |
103 padding:5px; | |
104 float:left; | |
105 } | |
106 | |
107 .dt-button{ | |
108 width: 24px; | |
109 height: 24px; | |
110 border-radius: 12px; | |
111 -moz-border-radius: 12px; | |
112 -webkit-border-radius: 12px; | |
113 -o-border-radius: 12px; | |
114 background-color: #777; | |
115 border: 1px solid #ABB; | |
116 cursor:pointer; | |
117 margin-right: 5px; | |
118 color:white; | |
119 font-weight:bold; | |
120 } | |
121 | |
122 .dt-button-disabled{ | |
123 width: 24px; | |
124 height: 24px; | |
125 border-radius: 12px; | |
126 -moz-border-radius: 12px; | |
127 -webkit-border-radius: 12px; | |
128 -o-border-radius: 12px; | |
129 background-color: #AAA; | |
130 border: 1px solid #ABB; | |
131 cursor:pointer; | |
132 margin-right: 5px; | |
133 color:white; | |
134 } | |
135 | |
136 .dt-button:hover{ | |
137 background-color: #555; | |
138 } | |
139 | |
140 .dt-load{ | |
141 text-indent: -2px; | |
142 padding-bottom: 2px; | |
143 vertical-align: 2px; | |
144 } | |
145 | |
146 .dt-progressbar { | |
147 position: relative; | |
148 margin: 0px; | |
149 clear: both; | |
150 } | |
151 | |
152 .dt-progressbar span { | |
153 display: block; | |
154 height: 20px; | |
155 position: absolute; | |
156 overflow: hidden; | |
157 background-color: #eee; | |
158 -moz-border-radius: 4px; | |
159 -webkit-border-radius: 4px; | |
160 border-radius: 4px; | |
161 -webkit-box-shadow: | |
162 inset 0 2px 9px rgba(255,255,255,0.3), | |
163 inset 0 -2px 6px rgba(0,0,0,0.4); | |
164 -moz-box-shadow: | |
165 inset 0 2px 9px rgba(255,255,255,0.3), | |
166 inset 0 -2px 6px rgba(0,0,0,0.4); | |
167 box-shadow: | |
168 inset 0 2px 9px rgba(255,255,255,0.3), | |
169 inset 0 -2px 6px rgba(0,0,0,0.4); | |
170 } | |
171 | |
172 .dt-progressbar span.green { | |
173 background-color: #2bc253; | |
174 } | |
175 | |
176 .dt-progressbar span.orange { | |
177 background-color: #f1a165; | |
178 } | |
179 | |
180 .dt-progressbar span.red { | |
181 background-color: #ff5555; | |
182 } | |
183 | |
184 .dt-status{ | |
185 margin: 10px 0; | |
186 padding: 0; | |
187 font-weight: bold; | |
188 } | |
189 .dt-status dt{ | |
190 float:left; | |
191 } | |
192 | |
193 .dt-status dd{ | |
194 float:left; | |
195 width:20px; | |
196 margin-left: 2px; | |
197 } | |
198 | |
199 .dt-pass{ | |
200 background-color:green; | |
201 } | |
202 | |
203 .dt-fail{ | |
204 background-color:red; | |
205 } | |
206 | |
207 .dt-error{ | |
208 background-color:orange; | |
209 } | |
210 | |
211 '''; | |
212 | |
213 static String inAppStyles = ''' | |
214 /* Dartest InApp Styles */ | |
215 .dt-container{ | |
216 font-family:Sans-serif,Verdana; | |
217 background:#111; | |
218 position:fixed; | |
219 bottom:0px; | |
220 right:0px; | |
221 border:1px solid black; | |
222 z-index:999; | |
223 } | |
224 | |
225 .dt-main{ | |
226 background:#FCFCFC; | |
227 width:355px; | |
228 height:350px; | |
229 overflow-y: auto; | |
230 padding: 0 5px; | |
231 font-size:12px; | |
232 } | |
233 | |
234 .dt-header{ | |
235 background:#777; | |
236 height:20px; | |
237 width:361px; | |
238 padding:2px; | |
239 color:white; | |
240 } | |
241 | |
242 .dt-header img{ | |
243 float:right; | |
244 padding:2px; | |
245 cursor:pointer; | |
246 height:16px; | |
247 width:16px; | |
248 } | |
249 | |
250 .dt-header img:hover | |
251 { | |
252 background-color:#555; | |
253 } | |
254 | |
255 .dt-header-close{ | |
256 background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAA ABWdVznAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA Ad0SU1FB9sKBhQGEmU63FMAAABrSURBVCjPnZGxEcAgDAN9uZSUKdgxA1BmAMZiCMb5FKEAnziSqLMl2 SCb/QGwAxmIgotA8s3Mg9qbmrg27rQJUVvd9woQ1OreNBdPTFK8LfI4zOzV9OL/tBIHFYSKdXizMyV/u EulIQ/3BTexxvELK3jXZwAAAABJRU5ErkJggg==) center no-repeat; | |
257 } | |
258 | |
259 .dt-header-pop{ | |
260 background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAA ABWdVznAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA Ad0SU1FB9sKBhQFLmF48xcAAABkSURBVCjPY2CgFPz//1/j////z/9jASRrImSTP21sQFN8/f///w4wP jGKJZDF0RWbICk+/P//fx50w5A5Nv////+MSzG6ycQrZmBgYEJiH2FgYPBkZGT8Qkzsmvz//5+DmJQAA Ek50CjzCaicAAAAAElFTkSuQmCC) center no-repeat; | |
261 } | |
262 | |
263 .dt-header-min{ | |
264 background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAA ABWdVznAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA Ad0SU1FB9sKBhQ6F2ajUSMAAAAgSURBVCjPY2AYBYMBMDIwMDD8////P1GKGRkZmQafHwD5tAQE/3Dfb wAAAABJRU5ErkJggg==) center no-repeat; | |
265 } | |
266 | |
267 .dt-header-max{ | |
268 background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAA ABWdVznAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA Ad0SU1FB9sKBhQ7EOHc9cEAAAAgSURBVCjPY2AgETAyMDAw/P///z9RihkZGZkYRsHIAABaEwQEd0uv8 QAAAABJRU5ErkJggg==) center no-repeat; | |
269 } | |
270 '''; | |
271 | |
272 static String fullAppStyles = ''' | |
273 body{ | |
274 margin:0; | |
275 } | |
276 | |
277 .dt-container{ | |
278 font-family:Sans-serif,Verdana; | |
279 background:#111; | |
280 border:1px solid black; | |
281 z-index:999; | |
282 } | |
283 | |
284 .dt-main{ | |
285 background:#FCFCFC; | |
Kelly Norton
2011/12/15 18:35:31
space between property and value.
shauvik
2011/12/16 07:19:27
Done.
| |
286 overflow-y: auto; | |
287 padding: 0 5px; | |
288 font-size:12px; | |
289 position:absolute; | |
290 top:29px; | |
291 bottom:0; | |
292 left:0; | |
293 right:0; | |
294 } | |
295 | |
296 .dt-minimize{ | |
297 position:absolute; | |
298 top: 5px; | |
299 right: 5px; | |
300 cursor:pointer; | |
301 } | |
302 '''; | |
303 | |
304 /** Provides the in-app stylesheet for Dartest */ | |
305 static String _getInAppStyleSheet(){ | |
Kelly Norton
2011/12/15 18:35:31
You can use => form here ... and this could just b
shauvik
2011/12/16 07:19:27
Removed this function and accessed directly from t
| |
306 return commonStyles+inAppStyles; | |
307 } | |
308 | |
309 /** Provides the full app stylesheet for Dartest */ | |
310 static String _getFullAppStyleSheet(){ | |
311 return commonStyles+fullAppStyles; | |
312 } | |
313 } | |
OLD | NEW |