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. |
| 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 = _commonStyles + _inAppStyles; |
| 14 } else { |
| 15 style.textContent = _commonStyles + _fullAppStyles; |
| 16 } |
| 17 doc.head.appendChild(style); |
| 18 } |
| 19 |
| 20 static String _commonStyles = ''' |
| 21 |
| 22 /* Dartest Common Styles */ |
| 23 |
| 24 .dt-hide { |
| 25 display: none; |
| 26 } |
| 27 |
| 28 .dt-show { |
| 29 display: block; |
| 30 } |
| 31 |
| 32 .dt-tab ul { |
| 33 list-style: none; |
| 34 padding: 5px 0; |
| 35 margin: 0; |
| 36 background-color: #EEE; |
| 37 } |
| 38 |
| 39 .dt-tab li { |
| 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 { |
| 49 background-color: #BBB; |
| 50 } |
| 51 |
| 52 .dt-tab-selected { |
| 53 background-color: #FFF; |
| 54 } |
| 55 |
| 56 .dt-results { |
| 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 background-color: #555; |
| 252 } |
| 253 |
| 254 .dt-header-close { |
| 255 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYA
AABWdVznAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAA
AAd0SU1FB9sKBhQGEmU63FMAAABrSURBVCjPnZGxEcAgDAN9uZSUKdgxA1BmAMZiCMb5FKEAnziSqLMl
2SCb/QGwAxmIgotA8s3Mg9qbmrg27rQJUVvd9woQ1OreNBdPTFK8LfI4zOzV9OL/tBIHFYSKdXizMyV/
uEulIQ/3BTexxvELK3jXZwAAAABJRU5ErkJggg==) center no-repeat; |
| 256 } |
| 257 |
| 258 .dt-header-pop { |
| 259 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYA
AABWdVznAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAA
AAd0SU1FB9sKBhQFLmF48xcAAABkSURBVCjPY2CgFPz//1/j////z/9jASRrImSTP21sQFN8/f///w4w
PjGKJZDF0RWbICk+/P//fx50w5A5Nv////+MSzG6ycQrZmBgYEJiH2FgYPBkZGT8Qkzsmvz//5+DmJQA
AEk50CjzCaicAAAAAElFTkSuQmCC) center no-repeat; |
| 260 } |
| 261 |
| 262 .dt-header-min { |
| 263 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYA
AABWdVznAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAA
AAd0SU1FB9sKBhQ6F2ajUSMAAAAgSURBVCjPY2AYBYMBMDIwMDD8////P1GKGRkZmQafHwD5tAQE/3Df
bwAAAABJRU5ErkJggg==) center no-repeat; |
| 264 } |
| 265 |
| 266 .dt-header-max { |
| 267 background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAA
ABWdVznAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA
Ad0SU1FB9sKBhQ7EOHc9cEAAAAgSURBVCjPY2AgETAyMDAw/P///z9RihkZGZkYRsHIAABaEwQEd0uv8
QAAAABJRU5ErkJggg==) center no-repeat; |
| 268 } |
| 269 '''; |
| 270 |
| 271 static String _fullAppStyles = ''' |
| 272 body { |
| 273 margin: 0; |
| 274 } |
| 275 |
| 276 .dt-container { |
| 277 font-family: Sans-serif,Verdana; |
| 278 background: #111; |
| 279 border: 1px solid black; |
| 280 z-index: 999; |
| 281 } |
| 282 |
| 283 .dt-main { |
| 284 background: #FCFCFC; |
| 285 overflow-y: auto; |
| 286 padding: 0 5px; |
| 287 font-size: 12px; |
| 288 position: absolute; |
| 289 top: 29px; |
| 290 bottom: 0; |
| 291 left: 0; |
| 292 right: 0; |
| 293 } |
| 294 |
| 295 .dt-minimize { |
| 296 position: absolute; |
| 297 top: 5px; |
| 298 right: 5px; |
| 299 cursor: pointer; |
| 300 } |
| 301 '''; |
| 302 |
| 303 } |
OLD | NEW |