summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/textattrs/test_general.html
blob: 7b29f409a2745846d4cfc65a2d171f6f08e876ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
<html>

<head>
  <title>Text attributes tests</title>
  <meta charset="utf-8">
  <link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css" />

  <style>
    .gencontent:before { content: "*"; }
    .gencontent:after  { content: "*"; }
  </style>

  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>

  <script src="../common.js"></script>
  <script src="../attributes.js"></script>
  <script src="../events.js"></script>

  <script>
    var gComputedStyle = null;

    function doTest() {
      // ////////////////////////////////////////////////////////////////////////
      // area1
      var ID = "area1";
      var defAttrs = buildDefaultTextAttrs(ID, "10pt");
      testDefaultTextAttrs(ID, defAttrs);

      var attrs = {};
      testTextAttrs(ID, 0, attrs, defAttrs, 0, 7);

      attrs = { "font-weight": kBoldFontWeight };
      testTextAttrs(ID, 7, attrs, defAttrs, 7, 11);

      attrs = {};
      testTextAttrs(ID, 12, attrs, defAttrs, 11, 18);

      // ////////////////////////////////////////////////////////////////////////
      // area2
      ID = "area2";
      defAttrs = buildDefaultTextAttrs(ID, "14pt");
      testDefaultTextAttrs(ID, defAttrs);

      attrs = {};
      testTextAttrs(ID, 0, attrs, defAttrs, 0, 7);

      attrs = { "font-weight": kBoldFontWeight };
      testTextAttrs(ID, 7, attrs, defAttrs, 7, 12);

      var tempElem = getNode(ID).firstChild.nextSibling.firstChild.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = {"font-style": gComputedStyle.fontStyle,
               "font-weight": kBoldFontWeight };
      testTextAttrs(ID, 13, attrs, defAttrs, 12, 19);

      attrs = { "font-weight": kBoldFontWeight };
      testTextAttrs(ID, 20, attrs, defAttrs, 19, 23);

      attrs = {};
      testTextAttrs(ID, 24, attrs, defAttrs, 23, 30);

      // ////////////////////////////////////////////////////////////////////////
      // area3
      ID = "area3";
      defAttrs = buildDefaultTextAttrs(ID, "12pt");
      testDefaultTextAttrs(ID, defAttrs);

      tempElem = getNode(ID).firstChild.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = {"color": gComputedStyle.color};
      testTextAttrs(ID, 0, attrs, defAttrs, 0, 6);

      tempElem = tempElem.firstChild.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = {"color": gComputedStyle.color};
      testTextAttrs(ID, 6, attrs, defAttrs, 6, 26);

      tempElem = tempElem.parentNode;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = {"color": gComputedStyle.color};
      testTextAttrs(ID, 26, attrs, defAttrs, 26, 27);

      tempElem = tempElem.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = {"color": gComputedStyle.color,
               "background-color": gComputedStyle.backgroundColor};
      testTextAttrs(ID, 27, attrs, defAttrs, 27, 50);

      // ////////////////////////////////////////////////////////////////////////
      // area4
      ID = "area4";
      defAttrs = buildDefaultTextAttrs(ID, "12pt");
      testDefaultTextAttrs(ID, defAttrs);

      tempElem = getNode(ID).firstChild.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = {"color": gComputedStyle.color};
      testTextAttrs(ID, 0, attrs, defAttrs, 0, 16);

      tempElem = tempElem.nextSibling.firstChild.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = {"color": gComputedStyle.color};
      testTextAttrs(ID, 16, attrs, defAttrs, 16, 33);

      tempElem = tempElem.parentNode;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = {"color": gComputedStyle.color};
      testTextAttrs(ID, 34, attrs, defAttrs, 33, 46);

      // ////////////////////////////////////////////////////////////////////////
      // area5: "Green!*!RedNormal"
      ID = "area5";
      defAttrs = buildDefaultTextAttrs(ID, "12pt");
      testDefaultTextAttrs(ID, defAttrs);

      // Green
      tempElem = getNode(ID).firstChild.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = {"color": gComputedStyle.color};
      testTextAttrs(ID, 0, attrs, defAttrs, 0, 5);

      // br
      attrs = {};
      testTextAttrs(ID, 5, attrs, defAttrs, 5, 6);

      // img, embedded accessible, no attributes
      attrs = {};
      testTextAttrs(ID, 6, attrs, {}, 6, 7);

      // br
      attrs = {};
      testTextAttrs(ID, 7, attrs, defAttrs, 7, 8);

      // Red
      tempElem = tempElem.nextSibling.nextSibling.nextSibling.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = {"color": gComputedStyle.color};
      testTextAttrs(ID, 9, attrs, defAttrs, 8, 11);

      // Normal
      attrs = {};
      testTextAttrs(ID, 11, attrs, defAttrs, 11, 18);

      // ////////////////////////////////////////////////////////////////////////
      // area6 (CSS vertical-align property, refer to bug 445938 for details
      // and sup and sub elements, refer to bug 735645 for details)
      ID = "area6";
      defAttrs = buildDefaultTextAttrs(ID, "12pt");
      testDefaultTextAttrs(ID, defAttrs);

      attrs = {};
      testTextAttrs(ID, 0, attrs, defAttrs, 0, 5);

      // Embedded object (sup) has no attributes but takes up one character.
      testTextAttrs(ID, 5, {}, {}, 5, 6);

      attrs = {};
      testTextAttrs(ID, 6, attrs, defAttrs, 6, 20);

      attrs = { "text-position": "super" };
      testTextAttrs(ID, 20, attrs, defAttrs, 20, 28);

      attrs = {};
      testTextAttrs(ID, 28, attrs, defAttrs, 28, 32);

      // Embedded object (sub) has no attributes but takes up one character.
      testTextAttrs(ID, 32, {}, {}, 32, 33);

      attrs = {};
      testTextAttrs(ID, 33, attrs, defAttrs, 33, 38);

      attrs = { "text-position": "sub" };
      testTextAttrs(ID, 38, attrs, defAttrs, 38, 47);

      attrs = {};
      testTextAttrs(ID, 47, attrs, defAttrs, 47, 52);

      attrs = { "text-position": "super" };
      testTextAttrs(ID, 52, attrs, defAttrs, 52, 67);

      attrs = {};
      testTextAttrs(ID, 67, attrs, defAttrs, 67, 72);

      attrs = { "text-position": "sub" };
      testTextAttrs(ID, 72, attrs, defAttrs, 72, 85);

      attrs = {};
      testTextAttrs(ID, 85, attrs, defAttrs, 85, 90);

      attrs = { "text-position": "super" };
      testTextAttrs(ID, 90, attrs, defAttrs, 90, 106);

      attrs = {};
      testTextAttrs(ID, 106, attrs, defAttrs, 106, 111);

      attrs = { "text-position": "sub" };
      testTextAttrs(ID, 111, attrs, defAttrs, 111, 125);

      // ////////////////////////////////////////////////////////////////////////
      // area7
      ID = "area7";
      defAttrs = buildDefaultTextAttrs(ID, "12pt");
      defAttrs.language = "en";
      testDefaultTextAttrs(ID, defAttrs);

      attrs = {"language": "ru"};
      testTextAttrs(ID, 0, attrs, defAttrs, 0, 6);

      attrs = {};
      testTextAttrs(ID, 6, attrs, defAttrs, 6, 7);

      tempElem = getNode(ID).firstChild.nextSibling.nextSibling.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = { "background-color": gComputedStyle.backgroundColor};
      testTextAttrs(ID, 13, attrs, defAttrs, 7, 20);

      attrs = {};
      testTextAttrs(ID, 20, attrs, defAttrs, 20, 21);

      attrs = {"language": "de"};
      testTextAttrs(ID, 21, attrs, defAttrs, 21, 36);

      attrs = {};
      testTextAttrs(ID, 36, attrs, defAttrs, 36, 44);

      attrs = {};
      testTextAttrs(ID, 37, attrs, defAttrs, 36, 44);

      tempElem = tempElem.nextSibling.nextSibling.nextSibling.nextSibling.firstChild.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = {"color": gComputedStyle.color};
      testTextAttrs(ID, 44, attrs, defAttrs, 44, 51);

      tempElem = tempElem.firstChild.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = {"font-weight": kBoldFontWeight,
               "color": gComputedStyle.color};
      testTextAttrs(ID, 51, attrs, defAttrs, 51, 55);

      tempElem = tempElem.parentNode;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = {"color": gComputedStyle.color};
      testTextAttrs(ID, 55, attrs, defAttrs, 55, 62);

      // ////////////////////////////////////////////////////////////////////////
      // area9, different single style spans in styled paragraph
      ID = "area9";
      defAttrs = buildDefaultTextAttrs(ID, "10pt");
      testDefaultTextAttrs(ID, defAttrs);

      attrs = {};
      testTextAttrs(ID, 0, attrs, defAttrs, 0, 6);

      attrs = { "font-size": "12pt" };
      testTextAttrs(ID, 7, attrs, defAttrs, 6, 12);

      attrs = {};
      testTextAttrs(ID, 13, attrs, defAttrs, 12, 21);

      // Walk to the span with the different background color
      tempElem = getNode(ID).firstChild.nextSibling.nextSibling.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = { "background-color": gComputedStyle.backgroundColor };
      testTextAttrs(ID, 22, attrs, defAttrs, 21, 36);

      attrs = {};
      testTextAttrs(ID, 37, attrs, defAttrs, 36, 44);

      // Walk from the background color span to the one with font-style
      tempElem = tempElem.nextSibling.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = { "font-style": gComputedStyle.fontStyle };
      testTextAttrs(ID, 45, attrs, defAttrs, 44, 61);

      attrs = {};
      testTextAttrs(ID, 62, attrs, defAttrs, 61, 69);

      // Walk from span with font-style to the one with font-family.
      tempElem = tempElem.nextSibling.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = { "font-family": kMonospaceFontFamily };
      testTextAttrs(ID, 70, attrs, defAttrs, 69, 83);

      attrs = {};
      testTextAttrs(ID, 84, attrs, defAttrs, 83, 91);

      attrs = {
        "text-underline-style": "solid",
        "text-underline-color": gComputedStyle.color,
      };
      testTextAttrs(ID, 92, attrs, defAttrs, 91, 101);

      attrs = {};
      testTextAttrs(ID, 102, attrs, defAttrs, 101, 109);

      attrs = {
        "text-line-through-style": "solid",
        "text-line-through-color": gComputedStyle.color,
      };
      testTextAttrs(ID, 110, attrs, defAttrs, 109, 122);

      attrs = {};
      testTextAttrs(ID, 123, attrs, defAttrs, 122, 130);

      attrs = {
        "text-line-through-style": "solid",
        "text-line-through-color": gComputedStyle.color,
      };
      testTextAttrs(ID, 131, attrs, defAttrs, 130, 143);

      attrs = {};
      testTextAttrs(ID, 144, attrs, defAttrs, 143, 151);

      // ////////////////////////////////////////////////////////////////////////
      // area10, different single style spans in non-styled paragraph
      ID = "area10";
      defAttrs = buildDefaultTextAttrs(ID, "12pt");
      testDefaultTextAttrs(ID, defAttrs);

      attrs = {};
      testTextAttrs(ID, 0, attrs, defAttrs, 0, 7);

      attrs = { "font-size": "14pt" };
      testTextAttrs(ID, 7, attrs, defAttrs, 7, 13);

      attrs = {};
      testTextAttrs(ID, 13, attrs, defAttrs, 13, 22);

      // Walk to the span with the different background color
      tempElem = getNode(ID).firstChild.nextSibling.nextSibling.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = { "background-color": gComputedStyle.backgroundColor };
      testTextAttrs(ID, 23, attrs, defAttrs, 22, 37);

      attrs = {};
      testTextAttrs(ID, 38, attrs, defAttrs, 37, 45);

      // Walk from the background color span to the one with font-style
      tempElem = tempElem.nextSibling.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = {"font-style": gComputedStyle.fontStyle};
      testTextAttrs(ID, 46, attrs, defAttrs, 45, 62);

      attrs = {};
      testTextAttrs(ID, 63, attrs, defAttrs, 62, 70);

      // Walk from span with font-style to the one with font-family.
      tempElem = tempElem.nextSibling.nextSibling;
      gComputedStyle = document.defaultView.getComputedStyle(tempElem);
      attrs = { "font-family": kMonospaceFontFamily };
      testTextAttrs(ID, 71, attrs, defAttrs, 70, 84);

      attrs = {};
      testTextAttrs(ID, 85, attrs, defAttrs, 84, 92);

      attrs = {
        "text-underline-style": "solid",
        "text-underline-color": gComputedStyle.color,
      };
      testTextAttrs(ID, 93, attrs, defAttrs, 92, 102);

      attrs = {};
      testTextAttrs(ID, 103, attrs, defAttrs, 102, 110);

      attrs = {
        "text-line-through-style": "solid",
        "text-line-through-color": gComputedStyle.color,
      };
      testTextAttrs(ID, 111, attrs, defAttrs, 110, 123);

      attrs = {};
      testTextAttrs(ID, 124, attrs, defAttrs, 123, 131);

      // ////////////////////////////////////////////////////////////////////////
      // area11, "font-weight" tests
      ID = "area11";
      defAttrs = buildDefaultTextAttrs(ID, "12pt", kBoldFontWeight);
      testDefaultTextAttrs(ID, defAttrs);

      attrs = { };
      testTextAttrs(ID, 0, attrs, defAttrs, 0, 13);

      attrs = { "font-weight": kNormalFontWeight };
      testTextAttrs(ID, 13, attrs, defAttrs, 13, 20);

      attrs = { };
      testTextAttrs(ID, 20, attrs, defAttrs, 20, 27);

      attrs = { "font-weight": kNormalFontWeight };
      testTextAttrs(ID, 27, attrs, defAttrs, 27, 33);

      attrs = { };
      testTextAttrs(ID, 33, attrs, defAttrs, 33, 51);

      attrs = { "font-weight": kNormalFontWeight };
      testTextAttrs(ID, 51, attrs, defAttrs, 51, 57);

      attrs = { };
      testTextAttrs(ID, 57, attrs, defAttrs, 57, 97);

      // ////////////////////////////////////////////////////////////////////////
      // test out of range offset
      testTextAttrsWrongOffset("area12", -1);
      testTextAttrsWrongOffset("area12", 500);

      // ////////////////////////////////////////////////////////////////////////
      // test zero offset on empty hypertext accessibles
      ID = "area13";
      defAttrs = buildDefaultTextAttrs(ID, "12pt");
      attrs = { };
      testTextAttrs(ID, 0, attrs, defAttrs, 0, 0);

      ID = "area14";
      defAttrs = buildDefaultTextAttrs(ID, kInputFontSize,
                                       kNormalFontWeight, kInputFontFamily);

      attrs = { };
      testTextAttrs(ID, 0, attrs, defAttrs, 0, 0);

      // ////////////////////////////////////////////////////////////////////////
      // area15, embed char tests, "*plain*plain**bold*bold*"
      ID = "area15";
      defAttrs = buildDefaultTextAttrs(ID, "12pt");

      // p
      testTextAttrs(ID, 0, { }, { }, 0, 1);
      // plain
      testTextAttrs(ID, 1, { }, defAttrs, 1, 6);
      // p
      testTextAttrs(ID, 6, { }, { }, 6, 7);
      // plain
      testTextAttrs(ID, 7, { }, defAttrs, 7, 12);
      // p and img
      testTextAttrs(ID, 12, { }, { }, 12, 14);
      // bold
      attrs = { "font-weight": kBoldFontWeight };
      testTextAttrs(ID, 14, attrs, defAttrs, 14, 18);
      // p
      testTextAttrs(ID, 18, { }, { }, 18, 19);
      // bold
      attrs = { "font-weight": kBoldFontWeight };
      testTextAttrs(ID, 19, attrs, defAttrs, 19, 23);
      // p
      testTextAttrs(ID, 23, { }, { }, 23, 24);

      // ////////////////////////////////////////////////////////////////////////
      // area16, "font-family" tests
      ID = "area16";
      defAttrs = buildDefaultTextAttrs(ID, "12pt");
      testDefaultTextAttrs(ID, defAttrs);

      attrs = { "font-family": kMonospaceFontFamily };
      testTextAttrs(ID, 0, attrs, defAttrs, 0, 4);

      attrs = { };
      testTextAttrs(ID, 4, attrs, defAttrs, 4, 9);

      attrs = { "font-family": kSerifFontFamily };
      testTextAttrs(ID, 9, attrs, defAttrs, 9, 13);

      attrs = { };
      testTextAttrs(ID, 13, attrs, defAttrs, 13, 18);

      attrs = { "font-family": kAbsentFontFamily };
      testTextAttrs(ID, 18, attrs, defAttrs, 18, 22);

      // bug 1224498 - this fails with 'cursive' fontconfig lookup
      if (!LINUX) {
        attrs = { };
        testTextAttrs(ID, 22, attrs, defAttrs, 22, 27);

        attrs = { "font-family": kCursiveFontFamily };
        testTextAttrs(ID, 27, attrs, defAttrs, 27, 31);

        attrs = { };
        testTextAttrs(ID, 31, attrs, defAttrs, 31, 45);
      }

      // ////////////////////////////////////////////////////////////////////////
      // area17, "text-decoration" tests
      ID = "area17";
      defAttrs = buildDefaultTextAttrs(ID, "12pt");
      testDefaultTextAttrs(ID, defAttrs);

      attrs = {
        "text-underline-style": "solid",
        "text-underline-color": getSystemColor("CanvasText"),
      };
      testTextAttrs(ID, 0, attrs, defAttrs, 0, 10);

      attrs = {
        "text-underline-style": "solid",
        "text-underline-color": "rgb(0, 0, 255)",
      };
      testTextAttrs(ID, 10, attrs, defAttrs, 10, 15);

      attrs = {
        "text-underline-style": "dotted",
        "text-underline-color": getSystemColor("CanvasText"),
      };
      testTextAttrs(ID, 15, attrs, defAttrs, 15, 22);

      attrs = {
        "text-line-through-style": "solid",
        "text-line-through-color": getSystemColor("CanvasText"),
      };
      testTextAttrs(ID, 22, attrs, defAttrs, 22, 34);

      attrs = {
        "text-line-through-style": "solid",
        "text-line-through-color": "rgb(0, 0, 255)",
      };
      testTextAttrs(ID, 34, attrs, defAttrs, 34, 39);

      attrs = {
        "text-line-through-style": "wavy",
        "text-line-through-color": getSystemColor("CanvasText"),
      };
      testTextAttrs(ID, 39, attrs, defAttrs, 39, 44);

      // ////////////////////////////////////////////////////////////////////////
      // area18, "auto-generation text" tests
      ID = "area18";
      defAttrs = buildDefaultTextAttrs(ID, "12pt");
      testDefaultTextAttrs(ID, defAttrs);

      attrs = {
        "auto-generated": "true",
        "font-family": "-moz-bullet-font",
      };
      testTextAttrs(ID, 0, attrs, defAttrs, 0, 2);
      testTextAttrs(ID, 3, { }, defAttrs, 3, 7);
      attrs = {
        "auto-generated": "true",
      };
      testTextAttrs(ID, 7, attrs, defAttrs, 7, 8);

       // ////////////////////////////////////////////////////////////////////////
      // area19, "HTML5 mark tag" test
      // text enclosed in mark tag will have a different background color
      // However, since bug 982125, it is its own accessible.
      // Therefore, anything other than the default background color is
      // unexpected.
      ID = "area19";
      defAttrs = buildDefaultTextAttrs(ID, "12pt");

      attrs = {};
      testTextAttrs(ID, 0, attrs, defAttrs, 0, 10);

      ID = "area19mark";
      let defMarkAttrs = buildDefaultTextAttrs(ID, "12pt");
      attrs = {};
      testTextAttrs(ID, 0, attrs, defMarkAttrs, 0, 7);

      ID = "area19";
      attrs = {};
      testTextAttrs(ID, 11, attrs, defAttrs, 11, 22);

       // ////////////////////////////////////////////////////////////////////////
      // area20, "aOffset as -1 (Mozilla Bug 789621)" test

      ID = "area20";
      defAttrs = buildDefaultTextAttrs(ID, "15pt");
      testDefaultTextAttrs(ID, defAttrs);

      testTextAttrs(ID, -1, {}, defAttrs, 0, 11);

      // ////////////////////////////////////////////////////////////////////////
      // HTML sub tag offset test - verify attributes
      ID = "sub_tag";
      defAttrs = buildDefaultTextAttrs(ID, "10pt");
      defAttrs["text-position"] = "sub";
      testDefaultTextAttrs(ID, defAttrs);
      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);

      // ////////////////////////////////////////////////////////////////////////
      // HTML sup tag offset test - verify attributes
      ID = "sup_tag";
      defAttrs = buildDefaultTextAttrs(ID, "10pt");
      defAttrs["text-position"] = "super";
      testDefaultTextAttrs(ID, defAttrs);
      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);

      // ////////////////////////////////////////////////////////////////////////
      // ARIA subscript role - verify text-position attribute
      ID = "subscript_role";
      defAttrs = { "text-position": "sub" };
      testDefaultTextAttrs(ID, defAttrs, true);
      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);

      // ////////////////////////////////////////////////////////////////////////
      // ARIA superscript role - verify text-position attribute
      ID = "superscript_role";
      defAttrs = { "text-position": "super" };
      testDefaultTextAttrs(ID, defAttrs, true);
      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);

      // ////////////////////////////////////////////////////////////////////////
      // test text-position attributes in various situations
      ID = "superscript_role_in_div";
      defAttrs = { "text-position": "super" };
      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);

      ID = "sub_within_superscript_role";
      defAttrs = { "text-position": "sub" };
      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);

      ID = "sup_within_subscript_role";
      defAttrs = { "text-position": "super" };
      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);

      ID = "sub_within_sup";
      defAttrs = { "text-position": "sub" };
      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);

      ID = "sup_within_sub";
      defAttrs = { "text-position": "super" };
      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);

      ID = "css_sub_within_superscript_role";
      attrs = { "text-position": "sub" };
      testTextAttrs(ID, 0, attrs, {}, 0, 11, true);

      ID = "css_super_within_subscript_role";
      attrs = { "text-position": "super" };
      testTextAttrs(ID, 0, attrs, {}, 0, 11, true);

      ID = "sub_with_superscript_role";
      defAttrs = { "text-position": "super" };
      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);

      ID = "sup_with_subscript_role";
      defAttrs = { "text-position": "sub" };
      testTextAttrs(ID, 0, {}, defAttrs, 0, 11, true);

      SimpleTest.finish();
    }

    SimpleTest.waitForExplicitFinish();
    addA11yLoadEvent(doTest);
  </script>
</head>
<body style="font-size: 12pt">

  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=345759"
     title="Implement text attributes">
    Mozilla Bug 345759
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=473569"
     title="Restrict text-position to allowed values">
    Mozilla Bug 473569
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=473576"
     title="font-family text attribute should expose actual font used">
    Mozilla Bug 473576
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=523304"
     title="expose text-underline-color and text-line-through-color text attributes">
    Mozilla Bug 523304
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=735645"
     title="expose sub and sup elements in text attributes">
    Mozilla Bug 735645
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=445516"
     title="Support auto-generated text attribute on bullet lists">
    Mozilla Bug 445516
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=789621"
     title="getTextAttributes doesn't work with magic offsets">
    Mozilla Bug 789621
  </a>
  <p id="display"></p>
  <div id="content" style="display: none"></div>
  <pre id="test">
  </pre>

  <p id="area1" style="font-size: smaller">Normal <b>Bold</b> Normal</p>
  <p id="area2" style="font-size: 120%">Normal <b>Bold <i>Italic </i>Bold</b> Normal</p>
  <p id="area3" style="background-color: blue;">
    <span style="color: green; background-color: rgb(0, 0, 255)">
      Green
      <span style="color: red">but children are red</span>
    </span><span style="color: green; background-color: rgb(255, 255, 0);">
      Another green section.
    </span>
  </p>
  <p id="area4">
    <span style="color: green">
      Green
    </span><span style="color: green">
      Green too
      <span style="color: red">with red children</span>
      Green again
    </span>
  </p>
  <!-- Green!*!RedNormal-->
  <p id="area5">
    <span style="color: green">Green</span>
    <img src="../moz.png" alt="image"/>
    <span style="color: red">Red</span>Normal
  </p>
  <p id="area6">
    This <sup>sentence</sup> has the word
    <span style="vertical-align:super;">sentence</span> in
    <sub>superscript</sub> and
    <span style="vertical-align:sub;">subscript</span> and
    <span style="vertical-align:20%;">superscript 20%</span> and
    <span style="vertical-align:-20%;">subscript 20%</span> and
    <span style="vertical-align:20px;">superscript 20px</span> and
    <span style="vertical-align:-20px;">subscript 20px</span>
  </p>

  <p lang="en" id="area7">
    <span lang="ru">Привет</span>
    <span style="background-color: blue">Blue BG color</span>
    <span lang="de">Ich bin/Du bist</span>
    <span lang="en">
      Normal
      <span style="color: magenta">Magenta<b>Bold</b>Magenta</span>
    </span>
  </p>

  <p id="area9" style="font-size: smaller">Small
    <span style="font-size: 120%">bigger</span> smaller
    <span style="background-color: blue;">background blue</span> normal
    <span style="font-style: italic;">Different styling</span> normal
    <span style="font-family: monospace;">Different font</span> normal
    <span style="text-decoration: underline;">underlined</span> normal
    <span style="text-decoration: line-through;">strikethrough</span> normal
    <strike>strikethrough</strike> normal
  </p>

  <p id="area10">Normal
    <span style="font-size: 120%">bigger</span> smaller
    <span style="background-color: blue;">background blue</span> normal
    <span style="font-style: italic;">Different styling</span> normal
    <span style="font-family: monospace;">Different font</span> normal
    <span style="text-decoration: underline;">underlined</span> normal
    <span style="text-decoration: line-through;">strikethrough</span> normal
  </p>

  <p id="area11" style="font-weight: bolder;">
    <span style="font-weight: bolder;">bolder</span>bolder
    <span style="font-weight: lighter;">lighter</span>bolder
    <span style="font-weight: normal;">normal</span>bolder
    <b>bold</b>bolder
    <span style="font-weight: 400;">normal</span>bolder
    <span style="font-weight: 700;">bold</span>bolder
    <span style="font-weight: bold;">bold</span>bolder
    <span style="font-weight: 900;">bold</span>bolder
  </p>

  <p id="area12">hello</p>
  <p id="area13"></p>
  <input id="area14">

  <!-- *plain*plain**bold*bold*-->
  <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>

  <p id="area16" style="font-family: sans-serif;">
    <span style="font-family: monospace;">text</span>text
    <span style="font-family: serif;">text</span>text
    <span style="font-family: BodoniThatDoesntExist;">text</span>text
    <span style="font-family: Comic Sans MS, cursive;">text</span>text
    <span style="font-family: sans-serif, fantasy;">text</span>text
  </p>

  <p id="area17">
    <span style="text-decoration-line: underline;">underline
    </span><span style="text-decoration: underline; text-decoration-color: blue;">blue
    </span><span style="text-decoration: underline; text-decoration-style: dotted;">dotted
    </span><span style="text-decoration-line: line-through;">linethrough
    </span><span style="text-decoration: line-through; text-decoration-color: blue;">blue
    </span><span style="text-decoration: line-through; text-decoration-style: wavy;">wavy
    </span>
  </p>

  <ul>
    <li id="area18" class="gencontent">item</li>
  </ul>

  <p id="area19">uncolored
    <mark id="area19mark">colored</mark> uncolored
  </p>

  <p id="area20" style="font-size: 15pt;">offset test</p>

  <!-- subscript, superscript tests -->
  <sub id="sub_tag">offset test</sub>
  <sup id="sup_tag">offset test</sup>
  <p id="subscript_role" role="subscript">offset test</p>
  <p id="superscript_role" role="superscript">offset test</p>

  <div><span id="superscript_role_in_div" role="superscript">offset test</span></div>
  <p role="superscript"><sub id="sub_within_superscript_role">offset test</sub></p>
  <p role="subscript"><sup id="sup_within_subscript_role">offset test</sup></p>
  <sup><sub id="sub_within_sup">offset test</sub></sup>
  <sub><sup id="sup_within_sub">offset test</sup></sub>
  <p id="css_sub_within_superscript_role" role="superscript"><span style="vertical-align: sub">offset test</span></p>
  <p id="css_super_within_subscript_role" role="subscript"><span style="vertical-align: super">offset test</span></p>
  <sub id="sub_with_superscript_role" role="superscript">offset test</sub>
  <sup id="sup_with_subscript_role" role="subscript">offset test</sup>

</body>
</html>