tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_general.html (29303B)


      1 <html>
      2 
      3 <head>
      4  <title>Text attributes tests</title>
      5  <meta charset="utf-8">
      6  <link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
      7 
      8  <style>
      9    .gencontent:before { content: "*"; }
     10    .gencontent:after  { content: "*"; }
     11  </style>
     12 
     13  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
     14 
     15  <script src="../common.js"></script>
     16  <script src="../attributes.js"></script>
     17  <script src="../events.js"></script>
     18 
     19  <script>
     20    var gComputedStyle = null;
     21 
     22    function doTest() {
     23      // ////////////////////////////////////////////////////////////////////////
     24      // area1
     25      var ID = "area1";
     26      var defAttrs = buildDefaultTextAttrs(ID, "10pt");
     27      testDefaultTextAttrs(ID, defAttrs);
     28 
     29      var attrs = {};
     30      testTextAttrs(ID, 0, attrs, defAttrs, 0, 7);
     31 
     32      attrs = { "font-weight": kBoldFontWeight };
     33      testTextAttrs(ID, 7, attrs, defAttrs, 7, 11);
     34 
     35      attrs = {};
     36      testTextAttrs(ID, 12, attrs, defAttrs, 11, 18);
     37 
     38      // ////////////////////////////////////////////////////////////////////////
     39      // area2
     40      ID = "area2";
     41      defAttrs = buildDefaultTextAttrs(ID, "14pt");
     42      testDefaultTextAttrs(ID, defAttrs);
     43 
     44      attrs = {};
     45      testTextAttrs(ID, 0, attrs, defAttrs, 0, 7);
     46 
     47      attrs = { "font-weight": kBoldFontWeight };
     48      testTextAttrs(ID, 7, attrs, defAttrs, 7, 12);
     49 
     50      var tempElem = getNode(ID).firstChild.nextSibling.firstChild.nextSibling;
     51      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
     52      attrs = {"font-style": gComputedStyle.fontStyle,
     53               "font-weight": kBoldFontWeight };
     54      testTextAttrs(ID, 13, attrs, defAttrs, 12, 19);
     55 
     56      attrs = { "font-weight": kBoldFontWeight };
     57      testTextAttrs(ID, 20, attrs, defAttrs, 19, 23);
     58 
     59      attrs = {};
     60      testTextAttrs(ID, 24, attrs, defAttrs, 23, 30);
     61 
     62      // ////////////////////////////////////////////////////////////////////////
     63      // area3
     64      ID = "area3";
     65      defAttrs = buildDefaultTextAttrs(ID, "12pt");
     66      testDefaultTextAttrs(ID, defAttrs);
     67 
     68      tempElem = getNode(ID).firstChild.nextSibling;
     69      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
     70      attrs = {"color": gComputedStyle.color};
     71      testTextAttrs(ID, 0, attrs, defAttrs, 0, 6);
     72 
     73      tempElem = tempElem.firstChild.nextSibling;
     74      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
     75      attrs = {"color": gComputedStyle.color};
     76      testTextAttrs(ID, 6, attrs, defAttrs, 6, 26);
     77 
     78      tempElem = tempElem.parentNode;
     79      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
     80      attrs = {"color": gComputedStyle.color};
     81      testTextAttrs(ID, 26, attrs, defAttrs, 26, 27);
     82 
     83      tempElem = tempElem.nextSibling;
     84      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
     85      attrs = {"color": gComputedStyle.color,
     86               "background-color": gComputedStyle.backgroundColor};
     87      testTextAttrs(ID, 27, attrs, defAttrs, 27, 50);
     88 
     89      // ////////////////////////////////////////////////////////////////////////
     90      // area4
     91      ID = "area4";
     92      defAttrs = buildDefaultTextAttrs(ID, "12pt");
     93      testDefaultTextAttrs(ID, defAttrs);
     94 
     95      tempElem = getNode(ID).firstChild.nextSibling;
     96      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
     97      attrs = {"color": gComputedStyle.color};
     98      testTextAttrs(ID, 0, attrs, defAttrs, 0, 16);
     99 
    100      tempElem = tempElem.nextSibling.firstChild.nextSibling;
    101      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
    102      attrs = {"color": gComputedStyle.color};
    103      testTextAttrs(ID, 16, attrs, defAttrs, 16, 33);
    104 
    105      tempElem = tempElem.parentNode;
    106      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
    107      attrs = {"color": gComputedStyle.color};
    108      testTextAttrs(ID, 34, attrs, defAttrs, 33, 46);
    109 
    110      // ////////////////////////////////////////////////////////////////////////
    111      // area5: "Green!*!RedNormal"
    112      ID = "area5";
    113      defAttrs = buildDefaultTextAttrs(ID, "12pt");
    114      testDefaultTextAttrs(ID, defAttrs);
    115 
    116      // Green
    117      tempElem = getNode(ID).firstChild.nextSibling;
    118      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
    119      attrs = {"color": gComputedStyle.color};
    120      testTextAttrs(ID, 0, attrs, defAttrs, 0, 5);
    121 
    122      // br
    123      attrs = {};
    124      testTextAttrs(ID, 5, attrs, defAttrs, 5, 6);
    125 
    126      // img, embedded accessible, no attributes
    127      attrs = {};
    128      testTextAttrs(ID, 6, attrs, {}, 6, 7);
    129 
    130      // br
    131      attrs = {};
    132      testTextAttrs(ID, 7, attrs, defAttrs, 7, 8);
    133 
    134      // Red
    135      tempElem = tempElem.nextSibling.nextSibling.nextSibling.nextSibling;
    136      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
    137      attrs = {"color": gComputedStyle.color};
    138      testTextAttrs(ID, 9, attrs, defAttrs, 8, 11);
    139 
    140      // Normal
    141      attrs = {};
    142      testTextAttrs(ID, 11, attrs, defAttrs, 11, 18);
    143 
    144      // ////////////////////////////////////////////////////////////////////////
    145      // area6 (CSS vertical-align property, refer to bug 445938 for details
    146      // and sup and sub elements, refer to bug 735645 for details)
    147      ID = "area6";
    148      defAttrs = buildDefaultTextAttrs(ID, "12pt");
    149      testDefaultTextAttrs(ID, defAttrs);
    150 
    151      attrs = {};
    152      testTextAttrs(ID, 0, attrs, defAttrs, 0, 5);
    153 
    154      // Embedded object (sup) has no attributes but takes up one character.
    155      testTextAttrs(ID, 5, {}, {}, 5, 6);
    156 
    157      attrs = {};
    158      testTextAttrs(ID, 6, attrs, defAttrs, 6, 20);
    159 
    160      attrs = { "text-position": "super" };
    161      testTextAttrs(ID, 20, attrs, defAttrs, 20, 28);
    162 
    163      attrs = {};
    164      testTextAttrs(ID, 28, attrs, defAttrs, 28, 32);
    165 
    166      // Embedded object (sub) has no attributes but takes up one character.
    167      testTextAttrs(ID, 32, {}, {}, 32, 33);
    168 
    169      attrs = {};
    170      testTextAttrs(ID, 33, attrs, defAttrs, 33, 38);
    171 
    172      attrs = { "text-position": "sub" };
    173      testTextAttrs(ID, 38, attrs, defAttrs, 38, 47);
    174 
    175      attrs = {};
    176      testTextAttrs(ID, 47, attrs, defAttrs, 47, 52);
    177 
    178      attrs = { "text-position": "super" };
    179      testTextAttrs(ID, 52, attrs, defAttrs, 52, 67);
    180 
    181      attrs = {};
    182      testTextAttrs(ID, 67, attrs, defAttrs, 67, 72);
    183 
    184      attrs = { "text-position": "sub" };
    185      testTextAttrs(ID, 72, attrs, defAttrs, 72, 85);
    186 
    187      attrs = {};
    188      testTextAttrs(ID, 85, attrs, defAttrs, 85, 90);
    189 
    190      attrs = { "text-position": "super" };
    191      testTextAttrs(ID, 90, attrs, defAttrs, 90, 106);
    192 
    193      attrs = {};
    194      testTextAttrs(ID, 106, attrs, defAttrs, 106, 111);
    195 
    196      attrs = { "text-position": "sub" };
    197      testTextAttrs(ID, 111, attrs, defAttrs, 111, 125);
    198 
    199      // ////////////////////////////////////////////////////////////////////////
    200      // area7
    201      ID = "area7";
    202      defAttrs = buildDefaultTextAttrs(ID, "12pt");
    203      defAttrs.language = "en";
    204      testDefaultTextAttrs(ID, defAttrs);
    205 
    206      attrs = {"language": "ru"};
    207      testTextAttrs(ID, 0, attrs, defAttrs, 0, 6);
    208 
    209      attrs = {};
    210      testTextAttrs(ID, 6, attrs, defAttrs, 6, 7);
    211 
    212      tempElem = getNode(ID).firstChild.nextSibling.nextSibling.nextSibling;
    213      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
    214      attrs = { "background-color": gComputedStyle.backgroundColor};
    215      testTextAttrs(ID, 13, attrs, defAttrs, 7, 20);
    216 
    217      attrs = {};
    218      testTextAttrs(ID, 20, attrs, defAttrs, 20, 21);
    219 
    220      attrs = {"language": "de"};
    221      testTextAttrs(ID, 21, attrs, defAttrs, 21, 36);
    222 
    223      attrs = {};
    224      testTextAttrs(ID, 36, attrs, defAttrs, 36, 44);
    225 
    226      attrs = {};
    227      testTextAttrs(ID, 37, attrs, defAttrs, 36, 44);
    228 
    229      tempElem = tempElem.nextSibling.nextSibling.nextSibling.nextSibling.firstChild.nextSibling;
    230      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
    231      attrs = {"color": gComputedStyle.color};
    232      testTextAttrs(ID, 44, attrs, defAttrs, 44, 51);
    233 
    234      tempElem = tempElem.firstChild.nextSibling;
    235      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
    236      attrs = {"font-weight": kBoldFontWeight,
    237               "color": gComputedStyle.color};
    238      testTextAttrs(ID, 51, attrs, defAttrs, 51, 55);
    239 
    240      tempElem = tempElem.parentNode;
    241      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
    242      attrs = {"color": gComputedStyle.color};
    243      testTextAttrs(ID, 55, attrs, defAttrs, 55, 62);
    244 
    245      // ////////////////////////////////////////////////////////////////////////
    246      // area9, different single style spans in styled paragraph
    247      ID = "area9";
    248      defAttrs = buildDefaultTextAttrs(ID, "10pt");
    249      testDefaultTextAttrs(ID, defAttrs);
    250 
    251      attrs = {};
    252      testTextAttrs(ID, 0, attrs, defAttrs, 0, 6);
    253 
    254      attrs = { "font-size": "12pt" };
    255      testTextAttrs(ID, 7, attrs, defAttrs, 6, 12);
    256 
    257      attrs = {};
    258      testTextAttrs(ID, 13, attrs, defAttrs, 12, 21);
    259 
    260      // Walk to the span with the different background color
    261      tempElem = getNode(ID).firstChild.nextSibling.nextSibling.nextSibling;
    262      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
    263      attrs = { "background-color": gComputedStyle.backgroundColor };
    264      testTextAttrs(ID, 22, attrs, defAttrs, 21, 36);
    265 
    266      attrs = {};
    267      testTextAttrs(ID, 37, attrs, defAttrs, 36, 44);
    268 
    269      // Walk from the background color span to the one with font-style
    270      tempElem = tempElem.nextSibling.nextSibling;
    271      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
    272      attrs = { "font-style": gComputedStyle.fontStyle };
    273      testTextAttrs(ID, 45, attrs, defAttrs, 44, 61);
    274 
    275      attrs = {};
    276      testTextAttrs(ID, 62, attrs, defAttrs, 61, 69);
    277 
    278      // Walk from span with font-style to the one with font-family.
    279      tempElem = tempElem.nextSibling.nextSibling;
    280      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
    281      attrs = { "font-family": kMonospaceFontFamily };
    282      testTextAttrs(ID, 70, attrs, defAttrs, 69, 83);
    283 
    284      attrs = {};
    285      testTextAttrs(ID, 84, attrs, defAttrs, 83, 91);
    286 
    287      attrs = {
    288        "text-underline-style": "solid",
    289        "text-underline-color": gComputedStyle.color,
    290      };
    291      testTextAttrs(ID, 92, attrs, defAttrs, 91, 101);
    292 
    293      attrs = {};
    294      testTextAttrs(ID, 102, attrs, defAttrs, 101, 109);
    295 
    296      attrs = {
    297        "text-line-through-style": "solid",
    298        "text-line-through-color": gComputedStyle.color,
    299      };
    300      testTextAttrs(ID, 110, attrs, defAttrs, 109, 122);
    301 
    302      attrs = {};
    303      testTextAttrs(ID, 123, attrs, defAttrs, 122, 130);
    304 
    305      attrs = {
    306        "text-line-through-style": "solid",
    307        "text-line-through-color": gComputedStyle.color,
    308      };
    309      testTextAttrs(ID, 131, attrs, defAttrs, 130, 143);
    310 
    311      attrs = {};
    312      testTextAttrs(ID, 144, attrs, defAttrs, 143, 151);
    313 
    314      // ////////////////////////////////////////////////////////////////////////
    315      // area10, different single style spans in non-styled paragraph
    316      ID = "area10";
    317      defAttrs = buildDefaultTextAttrs(ID, "12pt");
    318      testDefaultTextAttrs(ID, defAttrs);
    319 
    320      attrs = {};
    321      testTextAttrs(ID, 0, attrs, defAttrs, 0, 7);
    322 
    323      attrs = { "font-size": "14pt" };
    324      testTextAttrs(ID, 7, attrs, defAttrs, 7, 13);
    325 
    326      attrs = {};
    327      testTextAttrs(ID, 13, attrs, defAttrs, 13, 22);
    328 
    329      // Walk to the span with the different background color
    330      tempElem = getNode(ID).firstChild.nextSibling.nextSibling.nextSibling;
    331      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
    332      attrs = { "background-color": gComputedStyle.backgroundColor };
    333      testTextAttrs(ID, 23, attrs, defAttrs, 22, 37);
    334 
    335      attrs = {};
    336      testTextAttrs(ID, 38, attrs, defAttrs, 37, 45);
    337 
    338      // Walk from the background color span to the one with font-style
    339      tempElem = tempElem.nextSibling.nextSibling;
    340      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
    341      attrs = {"font-style": gComputedStyle.fontStyle};
    342      testTextAttrs(ID, 46, attrs, defAttrs, 45, 62);
    343 
    344      attrs = {};
    345      testTextAttrs(ID, 63, attrs, defAttrs, 62, 70);
    346 
    347      // Walk from span with font-style to the one with font-family.
    348      tempElem = tempElem.nextSibling.nextSibling;
    349      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
    350      attrs = { "font-family": kMonospaceFontFamily };
    351      testTextAttrs(ID, 71, attrs, defAttrs, 70, 84);
    352 
    353      attrs = {};
    354      testTextAttrs(ID, 85, attrs, defAttrs, 84, 92);
    355 
    356      attrs = {
    357        "text-underline-style": "solid",
    358        "text-underline-color": gComputedStyle.color,
    359      };
    360      testTextAttrs(ID, 93, attrs, defAttrs, 92, 102);
    361 
    362      attrs = {};
    363      testTextAttrs(ID, 103, attrs, defAttrs, 102, 110);
    364 
    365      attrs = {
    366        "text-line-through-style": "solid",
    367        "text-line-through-color": gComputedStyle.color,
    368      };
    369      testTextAttrs(ID, 111, attrs, defAttrs, 110, 123);
    370 
    371      attrs = {};
    372      testTextAttrs(ID, 124, attrs, defAttrs, 123, 131);
    373 
    374      // ////////////////////////////////////////////////////////////////////////
    375      // area11, "font-weight" tests
    376      ID = "area11";
    377      defAttrs = buildDefaultTextAttrs(ID, "12pt", kBoldFontWeight);
    378      testDefaultTextAttrs(ID, defAttrs);
    379 
    380      attrs = { };
    381      testTextAttrs(ID, 0, attrs, defAttrs, 0, 13);
    382 
    383      attrs = { "font-weight": kNormalFontWeight };
    384      testTextAttrs(ID, 13, attrs, defAttrs, 13, 20);
    385 
    386      attrs = { };
    387      testTextAttrs(ID, 20, attrs, defAttrs, 20, 27);
    388 
    389      attrs = { "font-weight": kNormalFontWeight };
    390      testTextAttrs(ID, 27, attrs, defAttrs, 27, 33);
    391 
    392      attrs = { };
    393      testTextAttrs(ID, 33, attrs, defAttrs, 33, 51);
    394 
    395      attrs = { "font-weight": kNormalFontWeight };
    396      testTextAttrs(ID, 51, attrs, defAttrs, 51, 57);
    397 
    398      attrs = { };
    399      testTextAttrs(ID, 57, attrs, defAttrs, 57, 97);
    400 
    401      // ////////////////////////////////////////////////////////////////////////
    402      // test out of range offset
    403      testTextAttrsWrongOffset("area12", -1);
    404      testTextAttrsWrongOffset("area12", 500);
    405 
    406      // ////////////////////////////////////////////////////////////////////////
    407      // test zero offset on empty hypertext accessibles
    408      ID = "area13";
    409      defAttrs = buildDefaultTextAttrs(ID, "12pt");
    410      attrs = { };
    411      testTextAttrs(ID, 0, attrs, defAttrs, 0, 0);
    412 
    413      ID = "area14";
    414      defAttrs = buildDefaultTextAttrs(ID, kInputFontSize,
    415                                       kNormalFontWeight, kInputFontFamily);
    416 
    417      attrs = { };
    418      testTextAttrs(ID, 0, attrs, defAttrs, 0, 0);
    419 
    420      // ////////////////////////////////////////////////////////////////////////
    421      // area15, embed char tests, "*plain*plain**bold*bold*"
    422      ID = "area15";
    423      defAttrs = buildDefaultTextAttrs(ID, "12pt");
    424 
    425      // p
    426      testTextAttrs(ID, 0, { }, { }, 0, 1);
    427      // plain
    428      testTextAttrs(ID, 1, { }, defAttrs, 1, 6);
    429      // p
    430      testTextAttrs(ID, 6, { }, { }, 6, 7);
    431      // plain
    432      testTextAttrs(ID, 7, { }, defAttrs, 7, 12);
    433      // p and img
    434      testTextAttrs(ID, 12, { }, { }, 12, 14);
    435      // bold
    436      attrs = { "font-weight": kBoldFontWeight };
    437      testTextAttrs(ID, 14, attrs, defAttrs, 14, 18);
    438      // p
    439      testTextAttrs(ID, 18, { }, { }, 18, 19);
    440      // bold
    441      attrs = { "font-weight": kBoldFontWeight };
    442      testTextAttrs(ID, 19, attrs, defAttrs, 19, 23);
    443      // p
    444      testTextAttrs(ID, 23, { }, { }, 23, 24);
    445 
    446      // ////////////////////////////////////////////////////////////////////////
    447      // area16, "font-family" tests
    448      ID = "area16";
    449      defAttrs = buildDefaultTextAttrs(ID, "12pt");
    450      testDefaultTextAttrs(ID, defAttrs);
    451 
    452      attrs = { "font-family": kMonospaceFontFamily };
    453      testTextAttrs(ID, 0, attrs, defAttrs, 0, 4);
    454 
    455      attrs = { };
    456      testTextAttrs(ID, 4, attrs, defAttrs, 4, 9);
    457 
    458      attrs = { "font-family": kSerifFontFamily };
    459      testTextAttrs(ID, 9, attrs, defAttrs, 9, 13);
    460 
    461      attrs = { };
    462      testTextAttrs(ID, 13, attrs, defAttrs, 13, 18);
    463 
    464      attrs = { "font-family": kAbsentFontFamily };
    465      testTextAttrs(ID, 18, attrs, defAttrs, 18, 22);
    466 
    467      // bug 1224498 - this fails with 'cursive' fontconfig lookup
    468      if (!LINUX) {
    469        attrs = { };
    470        testTextAttrs(ID, 22, attrs, defAttrs, 22, 27);
    471 
    472        attrs = { "font-family": kCursiveFontFamily };
    473        testTextAttrs(ID, 27, attrs, defAttrs, 27, 31);
    474 
    475        attrs = { };
    476        testTextAttrs(ID, 31, attrs, defAttrs, 31, 45);
    477      }
    478 
    479      // ////////////////////////////////////////////////////////////////////////
    480      // area17, "text-decoration" tests
    481      ID = "area17";
    482      defAttrs = buildDefaultTextAttrs(ID, "12pt");
    483      testDefaultTextAttrs(ID, defAttrs);
    484 
    485      attrs = {
    486        "text-underline-style": "solid",
    487        "text-underline-color": getSystemColor("CanvasText"),
    488      };
    489      testTextAttrs(ID, 0, attrs, defAttrs, 0, 10);
    490 
    491      attrs = {
    492        "text-underline-style": "solid",
    493        "text-underline-color": "rgb(0, 0, 255)",
    494      };
    495      testTextAttrs(ID, 10, attrs, defAttrs, 10, 15);
    496 
    497      attrs = {
    498        "text-underline-style": "dotted",
    499        "text-underline-color": getSystemColor("CanvasText"),
    500      };
    501      testTextAttrs(ID, 15, attrs, defAttrs, 15, 22);
    502 
    503      attrs = {
    504        "text-line-through-style": "solid",
    505        "text-line-through-color": getSystemColor("CanvasText"),
    506      };
    507      testTextAttrs(ID, 22, attrs, defAttrs, 22, 34);
    508 
    509      attrs = {
    510        "text-line-through-style": "solid",
    511        "text-line-through-color": "rgb(0, 0, 255)",
    512      };
    513      testTextAttrs(ID, 34, attrs, defAttrs, 34, 39);
    514 
    515      attrs = {
    516        "text-line-through-style": "wavy",
    517        "text-line-through-color": getSystemColor("CanvasText"),
    518      };
    519      testTextAttrs(ID, 39, attrs, defAttrs, 39, 44);
    520 
    521      // ////////////////////////////////////////////////////////////////////////
    522      // area18, "auto-generation text" tests
    523      ID = "area18";
    524      defAttrs = buildDefaultTextAttrs(ID, "12pt");
    525      testDefaultTextAttrs(ID, defAttrs);
    526 
    527      attrs = {
    528        "auto-generated": "true",
    529        "font-family": "-moz-bullet-font",
    530      };
    531      testTextAttrs(ID, 0, attrs, defAttrs, 0, 2);
    532      testTextAttrs(ID, 3, { }, defAttrs, 3, 7);
    533      attrs = {
    534        "auto-generated": "true",
    535      };
    536      testTextAttrs(ID, 7, attrs, defAttrs, 7, 8);
    537 
    538       // ////////////////////////////////////////////////////////////////////////
    539      // area19, "HTML5 mark tag" test
    540      // text enclosed in mark tag will have a different background color
    541      // However, since bug 982125, it is its own accessible.
    542      // Therefore, anything other than the default background color is
    543      // unexpected.
    544      ID = "area19";
    545      defAttrs = buildDefaultTextAttrs(ID, "12pt");
    546 
    547      attrs = {};
    548      testTextAttrs(ID, 0, attrs, defAttrs, 0, 10);
    549 
    550      ID = "area19mark";
    551      let defMarkAttrs = buildDefaultTextAttrs(ID, "12pt");
    552      attrs = {};
    553      testTextAttrs(ID, 0, attrs, defMarkAttrs, 0, 7);
    554 
    555      ID = "area19";
    556      attrs = {};
    557      testTextAttrs(ID, 11, attrs, defAttrs, 11, 22);
    558 
    559       // ////////////////////////////////////////////////////////////////////////
    560      // area20, "aOffset as -1 (Mozilla Bug 789621)" test
    561 
    562      ID = "area20";
    563      defAttrs = buildDefaultTextAttrs(ID, "15pt");
    564      testDefaultTextAttrs(ID, defAttrs);
    565 
    566      testTextAttrs(ID, -1, {}, defAttrs, 0, 11);
    567 
    568      // ////////////////////////////////////////////////////////////////////////
    569      // HTML sub tag offset test - verify attributes
    570      ID = "sub_tag";
    571      defAttrs = buildDefaultTextAttrs(ID, "10pt");
    572      defAttrs["text-position"] = "sub";
    573      testDefaultTextAttrs(ID, defAttrs);
    574      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);
    575 
    576      // ////////////////////////////////////////////////////////////////////////
    577      // HTML sup tag offset test - verify attributes
    578      ID = "sup_tag";
    579      defAttrs = buildDefaultTextAttrs(ID, "10pt");
    580      defAttrs["text-position"] = "super";
    581      testDefaultTextAttrs(ID, defAttrs);
    582      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);
    583 
    584      // ////////////////////////////////////////////////////////////////////////
    585      // ARIA subscript role - verify text-position attribute
    586      ID = "subscript_role";
    587      defAttrs = { "text-position": "sub" };
    588      testDefaultTextAttrs(ID, defAttrs, true);
    589      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);
    590 
    591      // ////////////////////////////////////////////////////////////////////////
    592      // ARIA superscript role - verify text-position attribute
    593      ID = "superscript_role";
    594      defAttrs = { "text-position": "super" };
    595      testDefaultTextAttrs(ID, defAttrs, true);
    596      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);
    597 
    598      // ////////////////////////////////////////////////////////////////////////
    599      // test text-position attributes in various situations
    600      ID = "superscript_role_in_div";
    601      defAttrs = { "text-position": "super" };
    602      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);
    603 
    604      ID = "sub_within_superscript_role";
    605      defAttrs = { "text-position": "sub" };
    606      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);
    607 
    608      ID = "sup_within_subscript_role";
    609      defAttrs = { "text-position": "super" };
    610      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);
    611 
    612      ID = "sub_within_sup";
    613      defAttrs = { "text-position": "sub" };
    614      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);
    615 
    616      ID = "sup_within_sub";
    617      defAttrs = { "text-position": "super" };
    618      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);
    619 
    620      ID = "css_sub_within_superscript_role";
    621      attrs = { "text-position": "sub" };
    622      testTextAttrs(ID, 0, attrs, {}, 0, 11, true);
    623 
    624      ID = "css_super_within_subscript_role";
    625      attrs = { "text-position": "super" };
    626      testTextAttrs(ID, 0, attrs, {}, 0, 11, true);
    627 
    628      ID = "sub_with_superscript_role";
    629      defAttrs = { "text-position": "super" };
    630      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);
    631 
    632      ID = "sup_with_subscript_role";
    633      defAttrs = { "text-position": "sub" };
    634      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);
    635 
    636      SimpleTest.finish();
    637    }
    638 
    639    SimpleTest.waitForExplicitFinish();
    640    addA11yLoadEvent(doTest);
    641  </script>
    642 </head>
    643 <body style="font-size: 12pt">
    644 
    645  <a target="_blank"
    646     href="https://bugzilla.mozilla.org/show_bug.cgi?id=345759"
    647     title="Implement text attributes">
    648    Mozilla Bug 345759
    649  </a>
    650  <a target="_blank"
    651     href="https://bugzilla.mozilla.org/show_bug.cgi?id=473569"
    652     title="Restrict text-position to allowed values">
    653    Mozilla Bug 473569
    654  </a>
    655  <a target="_blank"
    656     href="https://bugzilla.mozilla.org/show_bug.cgi?id=473576"
    657     title="font-family text attribute should expose actual font used">
    658    Mozilla Bug 473576
    659  </a>
    660  <a target="_blank"
    661     href="https://bugzilla.mozilla.org/show_bug.cgi?id=523304"
    662     title="expose text-underline-color and text-line-through-color text attributes">
    663    Mozilla Bug 523304
    664  </a>
    665  <a target="_blank"
    666     href="https://bugzilla.mozilla.org/show_bug.cgi?id=735645"
    667     title="expose sub and sup elements in text attributes">
    668    Mozilla Bug 735645
    669  </a>
    670  <a target="_blank"
    671     href="https://bugzilla.mozilla.org/show_bug.cgi?id=445516"
    672     title="Support auto-generated text attribute on bullet lists">
    673    Mozilla Bug 445516
    674  </a>
    675  <a target="_blank"
    676     href="https://bugzilla.mozilla.org/show_bug.cgi?id=789621"
    677     title="getTextAttributes doesn't work with magic offsets">
    678    Mozilla Bug 789621
    679  </a>
    680  <p id="display"></p>
    681  <div id="content" style="display: none"></div>
    682  <pre id="test">
    683  </pre>
    684 
    685  <p id="area1" style="font-size: smaller">Normal <b>Bold</b> Normal</p>
    686  <p id="area2" style="font-size: 120%">Normal <b>Bold <i>Italic </i>Bold</b> Normal</p>
    687  <p id="area3" style="background-color: blue;">
    688    <span style="color: green; background-color: rgb(0, 0, 255)">
    689      Green
    690      <span style="color: red">but children are red</span>
    691    </span><span style="color: green; background-color: rgb(255, 255, 0);">
    692      Another green section.
    693    </span>
    694  </p>
    695  <p id="area4">
    696    <span style="color: green">
    697      Green
    698    </span><span style="color: green">
    699      Green too
    700      <span style="color: red">with red children</span>
    701      Green again
    702    </span>
    703  </p>
    704  <!-- Green!*!RedNormal-->
    705  <p id="area5">
    706    <span style="color: green">Green</span>
    707    <img src="../moz.png" alt="image"/>
    708    <span style="color: red">Red</span>Normal
    709  </p>
    710  <p id="area6">
    711    This <sup>sentence</sup> has the word
    712    <span style="vertical-align:super;">sentence</span> in
    713    <sub>superscript</sub> and
    714    <span style="vertical-align:sub;">subscript</span> and
    715    <span style="vertical-align:20%;">superscript 20%</span> and
    716    <span style="vertical-align:-20%;">subscript 20%</span> and
    717    <span style="vertical-align:20px;">superscript 20px</span> and
    718    <span style="vertical-align:-20px;">subscript 20px</span>
    719  </p>
    720 
    721  <p lang="en" id="area7">
    722    <span lang="ru">Привет</span>
    723    <span style="background-color: blue">Blue BG color</span>
    724    <span lang="de">Ich bin/Du bist</span>
    725    <span lang="en">
    726      Normal
    727      <span style="color: magenta">Magenta<b>Bold</b>Magenta</span>
    728    </span>
    729  </p>
    730 
    731  <p id="area9" style="font-size: smaller">Small
    732    <span style="font-size: 120%">bigger</span> smaller
    733    <span style="background-color: blue;">background blue</span> normal
    734    <span style="font-style: italic;">Different styling</span> normal
    735    <span style="font-family: monospace;">Different font</span> normal
    736    <span style="text-decoration: underline;">underlined</span> normal
    737    <span style="text-decoration: line-through;">strikethrough</span> normal
    738    <strike>strikethrough</strike> normal
    739  </p>
    740 
    741  <p id="area10">Normal
    742    <span style="font-size: 120%">bigger</span> smaller
    743    <span style="background-color: blue;">background blue</span> normal
    744    <span style="font-style: italic;">Different styling</span> normal
    745    <span style="font-family: monospace;">Different font</span> normal
    746    <span style="text-decoration: underline;">underlined</span> normal
    747    <span style="text-decoration: line-through;">strikethrough</span> normal
    748  </p>
    749 
    750  <p id="area11" style="font-weight: bolder;">
    751    <span style="font-weight: bolder;">bolder</span>bolder
    752    <span style="font-weight: lighter;">lighter</span>bolder
    753    <span style="font-weight: normal;">normal</span>bolder
    754    <b>bold</b>bolder
    755    <span style="font-weight: 400;">normal</span>bolder
    756    <span style="font-weight: 700;">bold</span>bolder
    757    <span style="font-weight: bold;">bold</span>bolder
    758    <span style="font-weight: 900;">bold</span>bolder
    759  </p>
    760 
    761  <p id="area12">hello</p>
    762  <p id="area13"></p>
    763  <input id="area14">
    764 
    765  <!-- *plain*plain**bold*bold*-->
    766  <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>
    767 
    768  <p id="area16" style="font-family: sans-serif;">
    769    <span style="font-family: monospace;">text</span>text
    770    <span style="font-family: serif;">text</span>text
    771    <span style="font-family: BodoniThatDoesntExist;">text</span>text
    772    <span style="font-family: Comic Sans MS, cursive;">text</span>text
    773    <span style="font-family: sans-serif, fantasy;">text</span>text
    774  </p>
    775 
    776  <p id="area17">
    777    <span style="text-decoration-line: underline;">underline
    778    </span><span style="text-decoration: underline; text-decoration-color: blue;">blue
    779    </span><span style="text-decoration: underline; text-decoration-style: dotted;">dotted
    780    </span><span style="text-decoration-line: line-through;">linethrough
    781    </span><span style="text-decoration: line-through; text-decoration-color: blue;">blue
    782    </span><span style="text-decoration: line-through; text-decoration-style: wavy;">wavy
    783    </span>
    784  </p>
    785 
    786  <ul>
    787    <li id="area18" class="gencontent">item</li>
    788  </ul>
    789 
    790  <p id="area19">uncolored
    791    <mark id="area19mark">colored</mark> uncolored
    792  </p>
    793 
    794  <p id="area20" style="font-size: 15pt;">offset test</p>
    795 
    796  <!-- subscript, superscript tests -->
    797  <sub id="sub_tag">offset test</sub>
    798  <sup id="sup_tag">offset test</sup>
    799  <p id="subscript_role" role="subscript">offset test</p>
    800  <p id="superscript_role" role="superscript">offset test</p>
    801 
    802  <div><span id="superscript_role_in_div" role="superscript">offset test</span></div>
    803  <p role="superscript"><sub id="sub_within_superscript_role">offset test</sub></p>
    804  <p role="subscript"><sup id="sup_within_subscript_role">offset test</sup></p>
    805  <sup><sub id="sub_within_sup">offset test</sub></sup>
    806  <sub><sup id="sup_within_sub">offset test</sup></sub>
    807  <p id="css_sub_within_superscript_role" role="superscript"><span style="vertical-align: sub">offset test</span></p>
    808  <p id="css_super_within_subscript_role" role="subscript"><span style="vertical-align: super">offset test</span></p>
    809  <sub id="sub_with_superscript_role" role="superscript">offset test</sub>
    810  <sup id="sup_with_subscript_role" role="subscript">offset test</sup>
    811 
    812 </body>
    813 </html>