1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/textattrs/test_general.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,732 @@ 1.4 +<html> 1.5 + 1.6 +<head> 1.7 + <title>Text attributes tests</title> 1.8 + <meta charset="utf-8" /> 1.9 + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 1.10 + 1.11 + <style type="text/css"> 1.12 + .gencontent:before { content: "*"; } 1.13 + .gencontent:after { content: "*"; } 1.14 + </style> 1.15 + 1.16 + <script type="application/javascript" 1.17 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.18 + 1.19 + <script type="application/javascript" 1.20 + src="../common.js"></script> 1.21 + <script type="application/javascript" 1.22 + src="../attributes.js"></script> 1.23 + <script type="application/javascript" 1.24 + src="../events.js"></script> 1.25 + 1.26 + <script type="application/javascript"> 1.27 + var gComputedStyle = null; 1.28 + 1.29 + function doTest() 1.30 + { 1.31 + ////////////////////////////////////////////////////////////////////////// 1.32 + // area1 1.33 + var ID = "area1"; 1.34 + var defAttrs = buildDefaultTextAttrs(ID, "10pt"); 1.35 + testDefaultTextAttrs(ID, defAttrs); 1.36 + 1.37 + var attrs = {}; 1.38 + testTextAttrs(ID, 0, attrs, defAttrs, 0, 7); 1.39 + 1.40 + attrs = { "font-weight": kBoldFontWeight }; 1.41 + testTextAttrs(ID, 7, attrs, defAttrs, 7, 11); 1.42 + 1.43 + attrs = {}; 1.44 + testTextAttrs(ID, 12, attrs, defAttrs, 11, 18); 1.45 + 1.46 + ////////////////////////////////////////////////////////////////////////// 1.47 + // area2 1.48 + ID = "area2"; 1.49 + defAttrs = buildDefaultTextAttrs(ID, "14pt"); 1.50 + testDefaultTextAttrs(ID, defAttrs); 1.51 + 1.52 + attrs = {}; 1.53 + testTextAttrs(ID, 0, attrs, defAttrs, 0, 7); 1.54 + 1.55 + attrs = { "font-weight": kBoldFontWeight }; 1.56 + testTextAttrs(ID, 7, attrs, defAttrs, 7, 12); 1.57 + 1.58 + var tempElem = getNode(ID).firstChild.nextSibling.firstChild.nextSibling; 1.59 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.60 + attrs = {"font-style": gComputedStyle.fontStyle, 1.61 + "font-weight": kBoldFontWeight }; 1.62 + testTextAttrs(ID, 13, attrs, defAttrs, 12, 19); 1.63 + 1.64 + attrs = { "font-weight": kBoldFontWeight }; 1.65 + testTextAttrs(ID, 20, attrs, defAttrs, 19, 23); 1.66 + 1.67 + attrs = {}; 1.68 + testTextAttrs(ID, 24, attrs, defAttrs, 23, 30); 1.69 + 1.70 + ////////////////////////////////////////////////////////////////////////// 1.71 + // area3 1.72 + ID = "area3"; 1.73 + defAttrs = buildDefaultTextAttrs(ID, "12pt"); 1.74 + testDefaultTextAttrs(ID, defAttrs); 1.75 + 1.76 + tempElem = getNode(ID).firstChild.nextSibling; 1.77 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.78 + attrs = {"color": gComputedStyle.color}; 1.79 + testTextAttrs(ID, 0, attrs, defAttrs, 0, 6); 1.80 + 1.81 + tempElem = tempElem.firstChild.nextSibling; 1.82 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.83 + attrs = {"color": gComputedStyle.color}; 1.84 + testTextAttrs(ID, 6, attrs, defAttrs, 6, 26); 1.85 + 1.86 + tempElem = tempElem.parentNode; 1.87 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.88 + attrs = {"color": gComputedStyle.color}; 1.89 + testTextAttrs(ID, 26, attrs, defAttrs, 26, 27); 1.90 + 1.91 + tempElem = tempElem.nextSibling; 1.92 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.93 + attrs = {"color": gComputedStyle.color, 1.94 + "background-color": gComputedStyle.backgroundColor}; 1.95 + testTextAttrs(ID, 27, attrs, defAttrs, 27, 50); 1.96 + 1.97 + ////////////////////////////////////////////////////////////////////////// 1.98 + // area4 1.99 + ID = "area4"; 1.100 + defAttrs = buildDefaultTextAttrs(ID, "12pt"); 1.101 + testDefaultTextAttrs(ID, defAttrs); 1.102 + 1.103 + tempElem = getNode(ID).firstChild.nextSibling; 1.104 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.105 + attrs = {"color": gComputedStyle.color}; 1.106 + testTextAttrs(ID, 0, attrs, defAttrs, 0, 16); 1.107 + 1.108 + tempElem = tempElem.nextSibling.firstChild.nextSibling; 1.109 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.110 + attrs = {"color": gComputedStyle.color}; 1.111 + testTextAttrs(ID, 16, attrs, defAttrs, 16, 33); 1.112 + 1.113 + tempElem = tempElem.parentNode; 1.114 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.115 + attrs = {"color": gComputedStyle.color}; 1.116 + testTextAttrs(ID, 34, attrs, defAttrs, 33, 46); 1.117 + 1.118 + ////////////////////////////////////////////////////////////////////////// 1.119 + // area5: "Green!*!RedNormal" 1.120 + ID = "area5"; 1.121 + defAttrs = buildDefaultTextAttrs(ID, "12pt"); 1.122 + testDefaultTextAttrs(ID, defAttrs); 1.123 + 1.124 + // Green 1.125 + tempElem = getNode(ID).firstChild.nextSibling; 1.126 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.127 + attrs = {"color": gComputedStyle.color}; 1.128 + testTextAttrs(ID, 0, attrs, defAttrs, 0, 5); 1.129 + 1.130 + // br 1.131 + attrs = {}; 1.132 + testTextAttrs(ID, 5, attrs, defAttrs, 5, 6); 1.133 + 1.134 + // img, embedded accessible, no attributes 1.135 + attrs = {}; 1.136 + testTextAttrs(ID, 6, attrs, {}, 6, 7); 1.137 + 1.138 + // br 1.139 + attrs = {}; 1.140 + testTextAttrs(ID, 7, attrs, defAttrs, 7, 8); 1.141 + 1.142 + // Red 1.143 + tempElem = tempElem.nextSibling.nextSibling.nextSibling.nextSibling; 1.144 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.145 + attrs = {"color": gComputedStyle.color}; 1.146 + testTextAttrs(ID, 9, attrs, defAttrs, 8, 11); 1.147 + 1.148 + // Normal 1.149 + attrs = {}; 1.150 + testTextAttrs(ID, 11, attrs, defAttrs, 11, 18); 1.151 + 1.152 + ////////////////////////////////////////////////////////////////////////// 1.153 + // area6 (CSS vertical-align property, refer to bug 445938 for details 1.154 + // and sup and sub elements, refer to bug 735645 for details) 1.155 + ID = "area6"; 1.156 + defAttrs = buildDefaultTextAttrs(ID, "12pt"); 1.157 + testDefaultTextAttrs(ID, defAttrs); 1.158 + 1.159 + attrs = {}; 1.160 + testTextAttrs(ID, 0, attrs, defAttrs, 0, 5); 1.161 + 1.162 + attrs = { "text-position": "super", "font-size": "10pt" }; 1.163 + testTextAttrs(ID, 5, attrs, defAttrs, 5, 13); 1.164 + 1.165 + attrs = {}; 1.166 + testTextAttrs(ID, 13, attrs, defAttrs, 13, 27); 1.167 + 1.168 + attrs = { "text-position": "super" }; 1.169 + testTextAttrs(ID, 27, attrs, defAttrs, 27, 35); 1.170 + 1.171 + attrs = {}; 1.172 + testTextAttrs(ID, 35, attrs, defAttrs, 35, 39); 1.173 + 1.174 + attrs = { "text-position": "sub", "font-size": "10pt" }; 1.175 + testTextAttrs(ID, 39, attrs, defAttrs, 39, 50); 1.176 + 1.177 + attrs = {}; 1.178 + testTextAttrs(ID, 50, attrs, defAttrs, 50, 55); 1.179 + 1.180 + attrs = { "text-position": "sub" }; 1.181 + testTextAttrs(ID, 55, attrs, defAttrs, 55, 64); 1.182 + 1.183 + attrs = {}; 1.184 + testTextAttrs(ID, 64, attrs, defAttrs, 64, 69); 1.185 + 1.186 + attrs = { "text-position": "super" }; 1.187 + testTextAttrs(ID, 69, attrs, defAttrs, 69, 84); 1.188 + 1.189 + attrs = {}; 1.190 + testTextAttrs(ID, 84, attrs, defAttrs, 84, 89); 1.191 + 1.192 + attrs = { "text-position": "sub" }; 1.193 + testTextAttrs(ID, 89, attrs, defAttrs, 89, 102); 1.194 + 1.195 + attrs = {}; 1.196 + testTextAttrs(ID, 102, attrs, defAttrs, 102, 107); 1.197 + 1.198 + attrs = { "text-position": "super" }; 1.199 + testTextAttrs(ID, 107, attrs, defAttrs, 107, 123); 1.200 + 1.201 + attrs = {}; 1.202 + testTextAttrs(ID, 123, attrs, defAttrs, 123, 128); 1.203 + 1.204 + attrs = { "text-position": "sub" }; 1.205 + testTextAttrs(ID, 128, attrs, defAttrs, 128, 142); 1.206 + 1.207 + ////////////////////////////////////////////////////////////////////////// 1.208 + // area7 1.209 + ID = "area7"; 1.210 + defAttrs = buildDefaultTextAttrs(ID, "12pt"); 1.211 + defAttrs["language"] = "en"; 1.212 + testDefaultTextAttrs(ID, defAttrs); 1.213 + 1.214 + attrs = {"language": "ru"}; 1.215 + testTextAttrs(ID, 0, attrs, defAttrs, 0, 6); 1.216 + 1.217 + attrs = {}; 1.218 + testTextAttrs(ID, 6, attrs, defAttrs, 6, 7); 1.219 + 1.220 + tempElem = getNode(ID).firstChild.nextSibling.nextSibling.nextSibling; 1.221 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.222 + attrs = { "background-color": gComputedStyle.backgroundColor}; 1.223 + testTextAttrs(ID, 13, attrs, defAttrs, 7, 20); 1.224 + 1.225 + attrs = {}; 1.226 + testTextAttrs(ID, 20, attrs, defAttrs, 20, 21); 1.227 + 1.228 + attrs = {"language": "de"}; 1.229 + testTextAttrs(ID, 21, attrs, defAttrs, 21, 36); 1.230 + 1.231 + attrs = {}; 1.232 + testTextAttrs(ID, 36, attrs, defAttrs, 36, 44); 1.233 + 1.234 + attrs = {}; 1.235 + testTextAttrs(ID, 37, attrs, defAttrs, 36, 44); 1.236 + 1.237 + tempElem = tempElem.nextSibling.nextSibling.nextSibling.nextSibling.firstChild.nextSibling; 1.238 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.239 + attrs = {"color": gComputedStyle.color}; 1.240 + testTextAttrs(ID, 44, attrs, defAttrs, 44, 51); 1.241 + 1.242 + tempElem = tempElem.firstChild.nextSibling; 1.243 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.244 + attrs = {"font-weight": kBoldFontWeight, 1.245 + "color": gComputedStyle.color}; 1.246 + testTextAttrs(ID, 51, attrs, defAttrs, 51, 55); 1.247 + 1.248 + tempElem = tempElem.parentNode; 1.249 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.250 + attrs = {"color": gComputedStyle.color}; 1.251 + testTextAttrs(ID, 55, attrs, defAttrs, 55, 62); 1.252 + 1.253 + ////////////////////////////////////////////////////////////////////////// 1.254 + // area9, different single style spans in styled paragraph 1.255 + ID = "area9"; 1.256 + defAttrs = buildDefaultTextAttrs(ID, "10pt"); 1.257 + testDefaultTextAttrs(ID, defAttrs); 1.258 + 1.259 + attrs = {}; 1.260 + testTextAttrs(ID, 0, attrs, defAttrs, 0, 6); 1.261 + 1.262 + attrs = { "font-size": "12pt" }; 1.263 + testTextAttrs(ID, 7, attrs, defAttrs, 6, 12); 1.264 + 1.265 + attrs = {}; 1.266 + testTextAttrs(ID, 13, attrs, defAttrs, 12, 21); 1.267 + 1.268 + // Walk to the span with the different background color 1.269 + tempElem = getNode(ID).firstChild.nextSibling.nextSibling.nextSibling; 1.270 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.271 + attrs = { "background-color": gComputedStyle.backgroundColor }; 1.272 + testTextAttrs(ID, 22, attrs, defAttrs, 21, 36); 1.273 + 1.274 + attrs = {}; 1.275 + testTextAttrs(ID, 37, attrs, defAttrs, 36, 44); 1.276 + 1.277 + // Walk from the background color span to the one with font-style 1.278 + tempElem = tempElem.nextSibling.nextSibling; 1.279 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.280 + attrs = { "font-style": gComputedStyle.fontStyle }; 1.281 + testTextAttrs(ID, 45, attrs, defAttrs, 44, 61); 1.282 + 1.283 + attrs = {}; 1.284 + testTextAttrs(ID, 62, attrs, defAttrs, 61, 69); 1.285 + 1.286 + // Walk from span with font-style to the one with font-family. 1.287 + tempElem = tempElem.nextSibling.nextSibling; 1.288 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.289 + attrs = { "font-family": kMonospaceFontFamily }; 1.290 + testTextAttrs(ID, 70, attrs, defAttrs, 69, 83); 1.291 + 1.292 + attrs = {}; 1.293 + testTextAttrs(ID, 84, attrs, defAttrs, 83, 91); 1.294 + 1.295 + attrs = { 1.296 + "text-underline-style": "solid", 1.297 + "text-underline-color": gComputedStyle.color 1.298 + }; 1.299 + testTextAttrs(ID, 92, attrs, defAttrs, 91, 101); 1.300 + 1.301 + attrs = {}; 1.302 + testTextAttrs(ID, 102, attrs, defAttrs, 101, 109); 1.303 + 1.304 + attrs = { 1.305 + "text-line-through-style": "solid", 1.306 + "text-line-through-color": gComputedStyle.color 1.307 + }; 1.308 + testTextAttrs(ID, 110, attrs, defAttrs, 109, 122); 1.309 + 1.310 + attrs = {}; 1.311 + testTextAttrs(ID, 123, attrs, defAttrs, 122, 130); 1.312 + 1.313 + attrs = { 1.314 + "text-line-through-style": "solid", 1.315 + "text-line-through-color": gComputedStyle.color 1.316 + }; 1.317 + testTextAttrs(ID, 131, attrs, defAttrs, 130, 143); 1.318 + 1.319 + attrs = {}; 1.320 + testTextAttrs(ID, 144, attrs, defAttrs, 143, 151); 1.321 + 1.322 + attrs = { 1.323 + "text-line-through-style": "solid", 1.324 + "text-line-through-color": gComputedStyle.color 1.325 + }; 1.326 + testTextAttrs(ID, 152, attrs, defAttrs, 151, 164); 1.327 + 1.328 + attrs = {}; 1.329 + testTextAttrs(ID, 165, attrs, defAttrs, 164, 172); 1.330 + 1.331 + ////////////////////////////////////////////////////////////////////////// 1.332 + // area10, different single style spans in non-styled paragraph 1.333 + ID = "area10"; 1.334 + defAttrs = buildDefaultTextAttrs(ID, "12pt"); 1.335 + testDefaultTextAttrs(ID, defAttrs); 1.336 + 1.337 + attrs = {}; 1.338 + testTextAttrs(ID, 0, attrs, defAttrs, 0, 7); 1.339 + 1.340 + attrs = { "font-size": "14pt" }; 1.341 + testTextAttrs(ID, 7, attrs, defAttrs, 7, 13); 1.342 + 1.343 + attrs = {}; 1.344 + testTextAttrs(ID, 13, attrs, defAttrs, 13, 22); 1.345 + 1.346 + // Walk to the span with the different background color 1.347 + tempElem = getNode(ID).firstChild.nextSibling.nextSibling.nextSibling; 1.348 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.349 + attrs = { "background-color": gComputedStyle.backgroundColor }; 1.350 + testTextAttrs(ID, 23, attrs, defAttrs, 22, 37); 1.351 + 1.352 + attrs = {}; 1.353 + testTextAttrs(ID, 38, attrs, defAttrs, 37, 45); 1.354 + 1.355 + // Walk from the background color span to the one with font-style 1.356 + tempElem = tempElem.nextSibling.nextSibling; 1.357 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.358 + attrs = {"font-style": gComputedStyle.fontStyle}; 1.359 + testTextAttrs(ID, 46, attrs, defAttrs, 45, 62); 1.360 + 1.361 + attrs = {}; 1.362 + testTextAttrs(ID, 63, attrs, defAttrs, 62, 70); 1.363 + 1.364 + // Walk from span with font-style to the one with font-family. 1.365 + tempElem = tempElem.nextSibling.nextSibling; 1.366 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.367 + attrs = { "font-family": kMonospaceFontFamily }; 1.368 + testTextAttrs(ID, 71, attrs, defAttrs, 70, 84); 1.369 + 1.370 + attrs = {}; 1.371 + testTextAttrs(ID, 85, attrs, defAttrs, 84, 92); 1.372 + 1.373 + attrs = { 1.374 + "text-underline-style": "solid", 1.375 + "text-underline-color": gComputedStyle.color 1.376 + }; 1.377 + testTextAttrs(ID, 93, attrs, defAttrs, 92, 102); 1.378 + 1.379 + attrs = {}; 1.380 + testTextAttrs(ID, 103, attrs, defAttrs, 102, 110); 1.381 + 1.382 + attrs = { 1.383 + "text-line-through-style": "solid", 1.384 + "text-line-through-color": gComputedStyle.color 1.385 + }; 1.386 + testTextAttrs(ID, 111, attrs, defAttrs, 110, 123); 1.387 + 1.388 + attrs = {}; 1.389 + testTextAttrs(ID, 124, attrs, defAttrs, 123, 131); 1.390 + 1.391 + ////////////////////////////////////////////////////////////////////////// 1.392 + // area11, "font-weight" tests 1.393 + ID = "area11"; 1.394 + defAttrs = buildDefaultTextAttrs(ID, "12pt", kBoldFontWeight); 1.395 + testDefaultTextAttrs(ID, defAttrs); 1.396 + 1.397 + attrs = { }; 1.398 + testTextAttrs(ID, 0, attrs, defAttrs, 0, 13); 1.399 + 1.400 + attrs = { "font-weight": kNormalFontWeight }; 1.401 + testTextAttrs(ID, 13, attrs, defAttrs, 13, 20); 1.402 + 1.403 + attrs = { }; 1.404 + testTextAttrs(ID, 20, attrs, defAttrs, 20, 27); 1.405 + 1.406 + attrs = { "font-weight": kNormalFontWeight }; 1.407 + testTextAttrs(ID, 27, attrs, defAttrs, 27, 33); 1.408 + 1.409 + attrs = { }; 1.410 + testTextAttrs(ID, 33, attrs, defAttrs, 33, 51); 1.411 + 1.412 + attrs = { "font-weight": kNormalFontWeight }; 1.413 + testTextAttrs(ID, 51, attrs, defAttrs, 51, 57); 1.414 + 1.415 + attrs = { }; 1.416 + testTextAttrs(ID, 57, attrs, defAttrs, 57, 97); 1.417 + 1.418 + ////////////////////////////////////////////////////////////////////////// 1.419 + // test out of range offset 1.420 + testTextAttrsWrongOffset("area12", -1); 1.421 + testTextAttrsWrongOffset("area12", 500); 1.422 + 1.423 + ////////////////////////////////////////////////////////////////////////// 1.424 + // test zero offset on empty hypertext accessibles 1.425 + ID = "area13"; 1.426 + defAttrs = buildDefaultTextAttrs(ID, "12pt"); 1.427 + attrs = { }; 1.428 + testTextAttrs(ID, 0, attrs, defAttrs, 0, 0); 1.429 + 1.430 + ID = "area14"; 1.431 + defAttrs = buildDefaultTextAttrs(ID, kInputFontSize, 1.432 + kNormalFontWeight, kInputFontFamily); 1.433 + 1.434 + attrs = { }; 1.435 + testTextAttrs(ID, 0, attrs, defAttrs, 0, 0); 1.436 + 1.437 + ////////////////////////////////////////////////////////////////////////// 1.438 + // area15, embed char tests, "*plain*plain**bold*bold*" 1.439 + ID = "area15"; 1.440 + defAttrs = buildDefaultTextAttrs(ID, "12pt"); 1.441 + 1.442 + // p 1.443 + testTextAttrs(ID, 0, { }, { }, 0, 1); 1.444 + // plain 1.445 + testTextAttrs(ID, 1, { }, defAttrs, 1, 6); 1.446 + // p 1.447 + testTextAttrs(ID, 6, { }, { }, 6, 7); 1.448 + // plain 1.449 + testTextAttrs(ID, 7, { }, defAttrs, 7, 12); 1.450 + // p and img 1.451 + testTextAttrs(ID, 12, { }, { }, 12, 14); 1.452 + // bold 1.453 + attrs = { "font-weight": kBoldFontWeight }; 1.454 + testTextAttrs(ID, 14, attrs, defAttrs, 14, 18); 1.455 + // p 1.456 + testTextAttrs(ID, 18, { }, { }, 18, 19); 1.457 + // bold 1.458 + attrs = { "font-weight": kBoldFontWeight }; 1.459 + testTextAttrs(ID, 19, attrs, defAttrs, 19, 23); 1.460 + // p 1.461 + testTextAttrs(ID, 23, { }, { }, 23, 24); 1.462 + 1.463 + ////////////////////////////////////////////////////////////////////////// 1.464 + // area16, "font-family" tests 1.465 + ID = "area16"; 1.466 + defAttrs = buildDefaultTextAttrs(ID, "12pt"); 1.467 + testDefaultTextAttrs(ID, defAttrs); 1.468 + 1.469 + attrs = { "font-family": kMonospaceFontFamily }; 1.470 + testTextAttrs(ID, 0, attrs, defAttrs, 0, 4); 1.471 + 1.472 + attrs = { }; 1.473 + testTextAttrs(ID, 4, attrs, defAttrs, 4, 9); 1.474 + 1.475 + attrs = { "font-family": kSerifFontFamily }; 1.476 + testTextAttrs(ID, 9, attrs, defAttrs, 9, 13); 1.477 + 1.478 + attrs = { }; 1.479 + testTextAttrs(ID, 13, attrs, defAttrs, 13, 18); 1.480 + 1.481 + attrs = { "font-family": kAbsentFontFamily }; 1.482 + testTextAttrs(ID, 18, attrs, defAttrs, 18, 22); 1.483 + 1.484 + attrs = { }; 1.485 + testTextAttrs(ID, 22, attrs, defAttrs, 22, 27); 1.486 + 1.487 + attrs = { "font-family": kCursiveFontFamily }; 1.488 + testTextAttrs(ID, 27, attrs, defAttrs, 27, 31); 1.489 + 1.490 + attrs = { }; 1.491 + testTextAttrs(ID, 31, attrs, defAttrs, 31, 45); 1.492 + 1.493 + ////////////////////////////////////////////////////////////////////////// 1.494 + // area17, "text-decoration" tests 1.495 + ID = "area17"; 1.496 + defAttrs = buildDefaultTextAttrs(ID, "12pt"); 1.497 + testDefaultTextAttrs(ID, defAttrs); 1.498 + 1.499 + attrs = { 1.500 + "text-underline-style": "solid", 1.501 + "text-underline-color": "rgb(0, 0, 0)", 1.502 + }; 1.503 + testTextAttrs(ID, 0, attrs, defAttrs, 0, 10); 1.504 + 1.505 + attrs = { 1.506 + "text-underline-style": "solid", 1.507 + "text-underline-color": "rgb(0, 0, 255)", 1.508 + }; 1.509 + testTextAttrs(ID, 10, attrs, defAttrs, 10, 15); 1.510 + 1.511 + attrs = { 1.512 + "text-underline-style": "dotted", 1.513 + "text-underline-color": "rgb(0, 0, 0)", 1.514 + }; 1.515 + testTextAttrs(ID, 15, attrs, defAttrs, 15, 22); 1.516 + 1.517 + attrs = { 1.518 + "text-line-through-style": "solid", 1.519 + "text-line-through-color": "rgb(0, 0, 0)", 1.520 + }; 1.521 + testTextAttrs(ID, 22, attrs, defAttrs, 22, 34); 1.522 + 1.523 + attrs = { 1.524 + "text-line-through-style": "solid", 1.525 + "text-line-through-color": "rgb(0, 0, 255)", 1.526 + }; 1.527 + testTextAttrs(ID, 34, attrs, defAttrs, 34, 39); 1.528 + 1.529 + attrs = { 1.530 + "text-line-through-style": "wavy", 1.531 + "text-line-through-color": "rgb(0, 0, 0)", 1.532 + }; 1.533 + testTextAttrs(ID, 39, attrs, defAttrs, 39, 44); 1.534 + 1.535 + ////////////////////////////////////////////////////////////////////////// 1.536 + // area18, "auto-generation text" tests 1.537 + ID = "area18"; 1.538 + defAttrs = buildDefaultTextAttrs(ID, "12pt"); 1.539 + testDefaultTextAttrs(ID, defAttrs); 1.540 + 1.541 + var attrs = { 1.542 + "auto-generated": "true" 1.543 + }; 1.544 + testTextAttrs(ID, 0, attrs, defAttrs, 0, 2); 1.545 + testTextAttrs(ID, 2, { }, defAttrs, 2, 6); 1.546 + testTextAttrs(ID, 6, attrs, defAttrs, 6, 7); 1.547 + 1.548 + ////////////////////////////////////////////////////////////////////////// 1.549 + // area19, "HTML5 mark tag" test 1.550 + // text enclosed in mark tag will have a different background color 1.551 + ID = "area19"; 1.552 + defAttrs = buildDefaultTextAttrs(ID, "12pt"); 1.553 + 1.554 + attrs = {}; 1.555 + testTextAttrs(ID, 0, attrs, defAttrs, 0, 10); 1.556 + 1.557 + tempElem = getNode(ID).firstChild.nextSibling; 1.558 + gComputedStyle = document.defaultView.getComputedStyle(tempElem, ""); 1.559 + attrs = { "background-color": gComputedStyle.backgroundColor }; 1.560 + testTextAttrs(ID, 11, attrs, defAttrs, 10, 17); 1.561 + 1.562 + attrs = {}; 1.563 + testTextAttrs(ID, 18, attrs, defAttrs, 17, 28); 1.564 + 1.565 + ////////////////////////////////////////////////////////////////////////// 1.566 + // area20, "aOffset as -1 (Mozilla Bug 789621)" test 1.567 + 1.568 + ID = "area20"; 1.569 + defAttrs = buildDefaultTextAttrs(ID, "15pt"); 1.570 + testDefaultTextAttrs(ID, defAttrs); 1.571 + 1.572 + testTextAttrs(ID, -1, {}, defAttrs, 0, 11); 1.573 + SimpleTest.finish(); 1.574 + } 1.575 + 1.576 + SimpleTest.waitForExplicitFinish(); 1.577 + addA11yLoadEvent(doTest); 1.578 + </script> 1.579 +</head> 1.580 +<body style="font-size: 12pt"> 1.581 + 1.582 + <a target="_blank" 1.583 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=345759" 1.584 + title="Implement text attributes"> 1.585 + Mozilla Bug 345759 1.586 + </a> 1.587 + <a target="_blank" 1.588 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=473569" 1.589 + title="Restrict text-position to allowed values"> 1.590 + Mozilla Bug 473569 1.591 + </a> 1.592 + <a target="_blank" 1.593 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=473576" 1.594 + title="font-family text attribute should expose actual font used"> 1.595 + Mozilla Bug 473576 1.596 + </a> 1.597 + <a target="_blank" 1.598 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=523304" 1.599 + title="expose text-underline-color and text-line-through-color text attributes"> 1.600 + Mozilla Bug 523304 1.601 + </a> 1.602 + <a target="_blank" 1.603 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=735645" 1.604 + title="expose sub and sup elements in text attributes"> 1.605 + Mozilla Bug 735645 1.606 + </a> 1.607 + <a target="_blank" 1.608 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=445516" 1.609 + title="Support auto-generated text attribute on bullet lists"> 1.610 + Mozilla Bug 445516 1.611 + </a> 1.612 + <a target="_blank" 1.613 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=789621" 1.614 + title="getTextAttributes doesn't work with magic offsets"> 1.615 + Mozilla Bug 789621 1.616 + </a> 1.617 + <p id="display"></p> 1.618 + <div id="content" style="display: none"></div> 1.619 + <pre id="test"> 1.620 + </pre> 1.621 + 1.622 + <p id="area1" style="font-size: smaller">Normal <b>Bold</b> Normal</p> 1.623 + <p id="area2" style="font-size: 120%">Normal <b>Bold <i>Italic </i>Bold</b> Normal</p> 1.624 + <p id="area3" style="background-color: blue;"> 1.625 + <span style="color: green; background-color: rgb(0, 0, 255)"> 1.626 + Green 1.627 + <span style="color: red">but children are red</span> 1.628 + </span><span style="color: green; background-color: rgb(255, 255, 0);"> 1.629 + Another green section. 1.630 + </span> 1.631 + </p> 1.632 + <p id="area4"> 1.633 + <span style="color: green"> 1.634 + Green 1.635 + </span><span style="color: green"> 1.636 + Green too 1.637 + <span style="color: red">with red children</span> 1.638 + Green again 1.639 + </span> 1.640 + </p> 1.641 + <!-- Green!*!RedNormal--> 1.642 + <p id="area5"> 1.643 + <span style="color: green">Green</span> 1.644 + <img src="../moz.png" alt="image"/> 1.645 + <span style="color: red">Red</span>Normal 1.646 + </p> 1.647 + <p id="area6"> 1.648 + This <sup>sentence</sup> has the word 1.649 + <span style="vertical-align:super;">sentence</span> in 1.650 + <sub>superscript</sub> and 1.651 + <span style="vertical-align:sub;">subscript</span> and 1.652 + <span style="vertical-align:20%;">superscript 20%</span> and 1.653 + <span style="vertical-align:-20%;">subscript 20%</span> and 1.654 + <span style="vertical-align:20px;">superscript 20px</span> and 1.655 + <span style="vertical-align:-20px;">subscript 20px</span> 1.656 + </p> 1.657 + 1.658 + <p lang="en" id="area7"> 1.659 + <span lang="ru">Привет</span> 1.660 + <span style="background-color: blue">Blue BG color</span> 1.661 + <span lang="de">Ich bin/Du bist</span> 1.662 + <span lang="en"> 1.663 + Normal 1.664 + <span style="color: magenta">Magenta<b>Bold</b>Magenta</span> 1.665 + </span> 1.666 + </p> 1.667 + 1.668 + <p id="area9" style="font-size: smaller">Small 1.669 + <span style="font-size: 120%">bigger</span> smaller 1.670 + <span style="background-color: blue;">background blue</span> normal 1.671 + <span style="font-style: italic;">Different styling</span> normal 1.672 + <span style="font-family: monospace;">Different font</span> normal 1.673 + <span style="text-decoration: underline;">underlined</span> normal 1.674 + <span style="text-decoration: line-through;">strikethrough</span> normal 1.675 + <s>strikethrough</s> normal 1.676 + <strike>strikethrough</strike> normal 1.677 + </p> 1.678 + 1.679 + <p id="area10">Normal 1.680 + <span style="font-size: 120%">bigger</span> smaller 1.681 + <span style="background-color: blue;">background blue</span> normal 1.682 + <span style="font-style: italic;">Different styling</span> normal 1.683 + <span style="font-family: monospace;">Different font</span> normal 1.684 + <span style="text-decoration: underline;">underlined</span> normal 1.685 + <span style="text-decoration: line-through;">strikethrough</span> normal 1.686 + </p> 1.687 + 1.688 + <p id="area11" style="font-weight: bolder;"> 1.689 + <span style="font-weight: bolder;">bolder</span>bolder 1.690 + <span style="font-weight: lighter;">lighter</span>bolder 1.691 + <span style="font-weight: normal;">normal</span>bolder 1.692 + <b>bold</b>bolder 1.693 + <span style="font-weight: 400;">normal</span>bolder 1.694 + <span style="font-weight: 700;">bold</span>bolder 1.695 + <span style="font-weight: bold;">bold</span>bolder 1.696 + <span style="font-weight: 900;">bold</span>bolder 1.697 + </p> 1.698 + 1.699 + <p id="area12">hello</p> 1.700 + <p id="area13"></p> 1.701 + <input id="area14"> 1.702 + 1.703 + <!-- *plain*plain**bold*bold*--> 1.704 + <div id="area15"><p>embed</p>plain<p>embed</p>plain<p>embed</p><img src="../moz.png" alt="image"/><b>bold</b><p>embed</p><b>bold</b><p>embed</p></div> 1.705 + 1.706 + <p id="area16" style="font-family: sans-serif;"> 1.707 + <span style="font-family: monospace;">text</span>text 1.708 + <span style="font-family: serif;">text</span>text 1.709 + <span style="font-family: BodoniThatDoesntExist;">text</span>text 1.710 + <span style="font-family: Comic Sans MS, cursive;">text</span>text 1.711 + <span style="font-family: sans-serif, fantasy;">text</span>text 1.712 + </p> 1.713 + 1.714 + <p id="area17"> 1.715 + <span style="-moz-text-decoration-line: underline;">underline 1.716 + </span><span style="text-decoration: underline; -moz-text-decoration-color: blue;">blue 1.717 + </span><span style="text-decoration: underline; -moz-text-decoration-style: dotted;">dotted 1.718 + </span><span style="-moz-text-decoration-line: line-through;">linethrough 1.719 + </span><span style="text-decoration: line-through; -moz-text-decoration-color: blue;">blue 1.720 + </span><span style="text-decoration: line-through; -moz-text-decoration-style: wavy;">wavy 1.721 + </span> 1.722 + </p> 1.723 + 1.724 + <ul> 1.725 + <li id="area18" class="gencontent">item</li> 1.726 + </ul> 1.727 + 1.728 + <p id="area19">uncolored 1.729 + <mark>colored</mark> uncolored 1.730 + </p> 1.731 + 1.732 + <p id="area20" style="font-size: 15pt;">offset test</p> 1.733 + 1.734 +</body> 1.735 +</html>