2008-07-17 05:36:00 -07:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>Text attributes tests</title>
|
|
|
|
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
|
|
|
|
2008-10-28 04:54:57 -07:00
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
|
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="../common.js"></script>
|
2008-10-28 04:54:57 -07:00
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="../attributes.js"></script>
|
2009-01-24 20:42:21 -08:00
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="../events.js"></script>
|
2008-07-17 05:36:00 -07:00
|
|
|
|
|
|
|
<script type="application/javascript">
|
2008-09-11 07:41:11 -07:00
|
|
|
var gComputedStyle = null;
|
2008-07-17 05:36:00 -07:00
|
|
|
|
|
|
|
function doTest()
|
|
|
|
{
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// area1
|
|
|
|
var ID = "area1";
|
2010-05-21 04:27:00 -07:00
|
|
|
var defAttrs = buildDefaultTextAttrs(ID, "10pt");
|
2008-08-28 01:31:01 -07:00
|
|
|
testDefaultTextAttrs(ID, defAttrs);
|
|
|
|
|
2008-07-17 05:36:00 -07:00
|
|
|
var attrs = {};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 0, attrs, defAttrs, 0, 7);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2010-05-21 04:27:00 -07:00
|
|
|
attrs = { "font-weight": kBoldFontWeight };
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 7, attrs, defAttrs, 7, 11);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
|
|
|
attrs = {};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 12, attrs, defAttrs, 11, 18);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// area2
|
|
|
|
ID = "area2";
|
2010-05-21 04:27:00 -07:00
|
|
|
defAttrs = buildDefaultTextAttrs(ID, "14pt");
|
2008-08-28 01:31:01 -07:00
|
|
|
testDefaultTextAttrs(ID, defAttrs);
|
|
|
|
|
2008-07-17 05:36:00 -07:00
|
|
|
attrs = {};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 0, attrs, defAttrs, 0, 7);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2010-05-21 04:27:00 -07:00
|
|
|
attrs = { "font-weight": kBoldFontWeight };
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 7, attrs, defAttrs, 7, 12);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2010-05-21 04:27:00 -07:00
|
|
|
var tempElem = getNode(ID).firstChild.nextSibling.firstChild.nextSibling;
|
2008-09-11 07:41:11 -07:00
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
|
|
|
attrs = {"font-style": gComputedStyle.fontStyle,
|
2010-05-21 04:27:00 -07:00
|
|
|
"font-weight": kBoldFontWeight };
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 13, attrs, defAttrs, 12, 19);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2010-05-21 04:27:00 -07:00
|
|
|
attrs = { "font-weight": kBoldFontWeight };
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 20, attrs, defAttrs, 19, 23);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
|
|
|
attrs = {};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 24, attrs, defAttrs, 23, 30);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// area3
|
|
|
|
ID = "area3";
|
2010-05-21 04:27:00 -07:00
|
|
|
defAttrs = buildDefaultTextAttrs(ID, "12pt");
|
2008-08-28 01:31:01 -07:00
|
|
|
testDefaultTextAttrs(ID, defAttrs);
|
|
|
|
|
2010-05-21 04:27:00 -07:00
|
|
|
tempElem = getNode(ID).firstChild.nextSibling;
|
2008-09-11 07:41:11 -07:00
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
|
|
|
attrs = {"color": gComputedStyle.color};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 0, attrs, defAttrs, 0, 6);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2008-09-11 07:41:11 -07:00
|
|
|
tempElem = tempElem.firstChild.nextSibling;
|
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
|
|
|
attrs = {"color": gComputedStyle.color};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 6, attrs, defAttrs, 6, 26);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2008-09-11 07:41:11 -07:00
|
|
|
tempElem = tempElem.parentNode;
|
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
|
|
|
attrs = {"color": gComputedStyle.color};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 26, attrs, defAttrs, 26, 27);
|
2008-08-28 01:31:01 -07:00
|
|
|
|
2008-09-11 07:41:11 -07:00
|
|
|
tempElem = tempElem.nextSibling;
|
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
|
|
|
attrs = {"color": gComputedStyle.color,
|
|
|
|
"background-color": gComputedStyle.backgroundColor};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 27, attrs, defAttrs, 27, 50);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// area4
|
|
|
|
ID = "area4";
|
2010-05-21 04:27:00 -07:00
|
|
|
defAttrs = buildDefaultTextAttrs(ID, "12pt");
|
2008-08-28 01:31:01 -07:00
|
|
|
testDefaultTextAttrs(ID, defAttrs);
|
|
|
|
|
2010-05-21 04:27:00 -07:00
|
|
|
tempElem = getNode(ID).firstChild.nextSibling;
|
2008-09-11 07:41:11 -07:00
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
|
|
|
attrs = {"color": gComputedStyle.color};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 0, attrs, defAttrs, 0, 16);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2008-09-11 07:41:11 -07:00
|
|
|
tempElem = tempElem.nextSibling.firstChild.nextSibling;
|
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
|
|
|
attrs = {"color": gComputedStyle.color};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 16, attrs, defAttrs, 16, 33);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2008-09-11 07:41:11 -07:00
|
|
|
tempElem = tempElem.parentNode;
|
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
|
|
|
attrs = {"color": gComputedStyle.color};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 34, attrs, defAttrs, 33, 46);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2010-05-25 01:40:26 -07:00
|
|
|
// area5: "Green!*!RedNormal"
|
2008-07-17 05:36:00 -07:00
|
|
|
ID = "area5";
|
2010-05-21 04:27:00 -07:00
|
|
|
defAttrs = buildDefaultTextAttrs(ID, "12pt");
|
2008-08-28 01:31:01 -07:00
|
|
|
testDefaultTextAttrs(ID, defAttrs);
|
|
|
|
|
2010-05-25 01:40:26 -07:00
|
|
|
// Green
|
2010-05-21 04:27:00 -07:00
|
|
|
tempElem = getNode(ID).firstChild.nextSibling;
|
2008-09-11 07:41:11 -07:00
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
|
|
|
attrs = {"color": gComputedStyle.color};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 0, attrs, defAttrs, 0, 5);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2010-05-25 01:40:26 -07:00
|
|
|
// br
|
2008-07-17 05:36:00 -07:00
|
|
|
attrs = {};
|
2010-05-25 01:40:26 -07:00
|
|
|
testTextAttrs(ID, 5, attrs, defAttrs, 5, 6);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2010-05-25 01:40:26 -07:00
|
|
|
// img, embedded accessible, no attributes
|
|
|
|
attrs = {};
|
|
|
|
testTextAttrs(ID, 6, attrs, {}, 6, 7);
|
|
|
|
|
|
|
|
// br
|
|
|
|
attrs = {};
|
|
|
|
testTextAttrs(ID, 7, attrs, defAttrs, 7, 8);
|
|
|
|
|
|
|
|
// Red
|
2008-09-11 07:41:11 -07:00
|
|
|
tempElem = tempElem.nextSibling.nextSibling.nextSibling.nextSibling;
|
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
|
|
|
attrs = {"color": gComputedStyle.color};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 9, attrs, defAttrs, 8, 11);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2010-05-25 01:40:26 -07:00
|
|
|
// Normal
|
2008-07-17 05:36:00 -07:00
|
|
|
attrs = {};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 11, attrs, defAttrs, 11, 18);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2008-07-23 08:09:11 -07:00
|
|
|
// area6 (CSS vertical-align property, bug 445938)
|
2008-07-17 05:36:00 -07:00
|
|
|
ID = "area6";
|
2010-05-21 04:27:00 -07:00
|
|
|
defAttrs = buildDefaultTextAttrs(ID, "12pt");
|
2008-08-28 01:31:01 -07:00
|
|
|
testDefaultTextAttrs(ID, defAttrs);
|
|
|
|
|
2008-07-23 08:09:11 -07:00
|
|
|
attrs = {};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 0, attrs, defAttrs, 0, 5);
|
2008-07-23 08:09:11 -07:00
|
|
|
|
2010-05-21 04:27:00 -07:00
|
|
|
tempElem = getNode(ID).firstChild.nextSibling;
|
2008-09-11 07:41:11 -07:00
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
|
|
|
attrs = {"text-position": gComputedStyle.verticalAlign,
|
2009-01-24 23:01:24 -08:00
|
|
|
"font-size": "10pt"};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 5, attrs, defAttrs, 5, 13);
|
2008-07-23 08:09:11 -07:00
|
|
|
|
|
|
|
attrs = {};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 13, attrs, defAttrs, 13, 27);
|
2008-07-23 08:09:11 -07:00
|
|
|
|
2008-09-11 07:41:11 -07:00
|
|
|
tempElem = tempElem.nextSibling.nextSibling;
|
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
|
|
|
attrs = {"text-position": gComputedStyle.verticalAlign};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 27, attrs, defAttrs, 27, 35);
|
2008-07-23 08:09:11 -07:00
|
|
|
|
|
|
|
attrs = {};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 35, attrs, defAttrs, 35, 39);
|
2008-07-23 08:09:11 -07:00
|
|
|
|
2008-09-11 07:41:11 -07:00
|
|
|
tempElem = tempElem.nextSibling.nextSibling;
|
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
|
|
|
attrs = {"text-position": gComputedStyle.verticalAlign,
|
2009-01-24 23:01:24 -08:00
|
|
|
"font-size": "10pt"};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 39, attrs, defAttrs, 39, 50);
|
2008-07-23 08:09:11 -07:00
|
|
|
|
|
|
|
attrs = {};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 50, attrs, defAttrs, 50, 55);
|
2008-07-23 08:09:11 -07:00
|
|
|
|
2008-09-11 07:41:11 -07:00
|
|
|
tempElem = tempElem.nextSibling.nextSibling;
|
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
|
|
|
attrs = {"text-position": gComputedStyle.verticalAlign};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 55, attrs, defAttrs, 55, 64);
|
2008-07-23 08:09:11 -07:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// area7
|
|
|
|
ID = "area7";
|
2010-05-21 04:27:00 -07:00
|
|
|
defAttrs = buildDefaultTextAttrs(ID, "12pt");
|
|
|
|
defAttrs["language"] = "en";
|
2008-08-28 01:31:01 -07:00
|
|
|
testDefaultTextAttrs(ID, defAttrs);
|
|
|
|
|
2008-07-17 05:36:00 -07:00
|
|
|
attrs = {"language": "ru"};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 0, attrs, defAttrs, 0, 12);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2009-02-15 00:35:10 -08:00
|
|
|
attrs = {};
|
|
|
|
testTextAttrs(ID, 12, attrs, defAttrs, 12, 13);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2010-05-21 04:27:00 -07:00
|
|
|
tempElem = getNode(ID).firstChild.nextSibling.nextSibling.nextSibling;
|
2008-09-11 07:41:11 -07:00
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
2009-02-15 00:35:10 -08:00
|
|
|
attrs = { "background-color": gComputedStyle.backgroundColor};
|
|
|
|
testTextAttrs(ID, 13, attrs, defAttrs, 13, 26);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2009-02-15 00:35:10 -08:00
|
|
|
attrs = {};
|
|
|
|
testTextAttrs(ID, 26, attrs, defAttrs, 26, 27);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
|
|
|
attrs = {"language": "de"};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 27, attrs, defAttrs, 27, 42);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2009-02-15 00:35:10 -08:00
|
|
|
attrs = {};
|
|
|
|
testTextAttrs(ID, 42, attrs, defAttrs, 42, 50);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
|
|
|
attrs = {};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 43, attrs, defAttrs, 42, 50);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2008-09-11 07:41:11 -07:00
|
|
|
tempElem = tempElem.nextSibling.nextSibling.nextSibling.nextSibling.firstChild.nextSibling;
|
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
|
|
|
attrs = {"color": gComputedStyle.color};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 50, attrs, defAttrs, 50, 57);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2008-09-11 07:41:11 -07:00
|
|
|
tempElem = tempElem.firstChild.nextSibling;
|
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
2010-05-21 04:27:00 -07:00
|
|
|
attrs = {"font-weight": kBoldFontWeight,
|
2008-09-11 07:41:11 -07:00
|
|
|
"color": gComputedStyle.color};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 57, attrs, defAttrs, 57, 61);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2008-09-11 07:41:11 -07:00
|
|
|
tempElem = tempElem.parentNode;
|
|
|
|
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
|
|
|
attrs = {"color": gComputedStyle.color};
|
2009-02-15 00:35:10 -08:00
|
|
|
testTextAttrs(ID, 61, attrs, defAttrs, 61, 68);
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// area9, different single style spans in styled paragraph
|
|
|
|
ID = "area9";
|
2010-05-21 04:27:00 -07:00
|
|
|
defAttrs = buildDefaultTextAttrs(ID, "10pt");
|
2009-02-15 00:35:10 -08:00
|
|
|
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
|
2010-05-21 04:27:00 -07:00
|
|
|
tempElem = getNode(ID).firstChild.nextSibling.nextSibling.nextSibling;
|
2009-02-15 00:35:10 -08:00
|
|
|
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": gComputedStyle.fontFamily };
|
|
|
|
testTextAttrs(ID, 70, attrs, defAttrs, 69, 83);
|
|
|
|
|
|
|
|
attrs = {};
|
|
|
|
testTextAttrs(ID, 84, attrs, defAttrs, 83, 91);
|
|
|
|
|
|
|
|
attrs = { "text-underline-style": "solid" };
|
|
|
|
testTextAttrs(ID, 92, attrs, defAttrs, 91, 101);
|
|
|
|
|
|
|
|
attrs = {};
|
|
|
|
testTextAttrs(ID, 102, attrs, defAttrs, 101, 109);
|
|
|
|
|
|
|
|
attrs = { "text-line-through-style": "solid" };
|
|
|
|
testTextAttrs(ID, 110, attrs, defAttrs, 109, 122);
|
|
|
|
|
|
|
|
attrs = {};
|
|
|
|
testTextAttrs(ID, 123, attrs, defAttrs, 122, 130);
|
|
|
|
|
|
|
|
// area10, different single style spans in non-styled paragraph
|
|
|
|
ID = "area10";
|
2010-05-21 04:27:00 -07:00
|
|
|
defAttrs = buildDefaultTextAttrs(ID, "12pt");
|
2009-02-15 00:35:10 -08:00
|
|
|
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
|
2010-05-21 04:27:00 -07:00
|
|
|
tempElem = getNode(ID).firstChild.nextSibling.nextSibling.nextSibling;
|
2009-02-15 00:35:10 -08:00
|
|
|
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": gComputedStyle.fontFamily};
|
|
|
|
testTextAttrs(ID, 71, attrs, defAttrs, 70, 84);
|
|
|
|
|
|
|
|
attrs = {};
|
|
|
|
testTextAttrs(ID, 85, attrs, defAttrs, 84, 92);
|
|
|
|
|
|
|
|
attrs = { "text-underline-style": "solid" };
|
|
|
|
testTextAttrs(ID, 93, attrs, defAttrs, 92, 102);
|
|
|
|
|
|
|
|
attrs = {};
|
|
|
|
testTextAttrs(ID, 103, attrs, defAttrs, 102, 110);
|
|
|
|
|
|
|
|
attrs = { "text-line-through-style": "solid" };
|
|
|
|
testTextAttrs(ID, 111, attrs, defAttrs, 110, 123);
|
|
|
|
|
|
|
|
attrs = {};
|
|
|
|
testTextAttrs(ID, 124, attrs, defAttrs, 123, 131);
|
2008-07-17 05:36:00 -07:00
|
|
|
|
2009-03-03 22:46:29 -08:00
|
|
|
// area11, "font-weight" tests
|
|
|
|
ID = "area11";
|
2010-05-21 04:27:00 -07:00
|
|
|
defAttrs = buildDefaultTextAttrs(ID, "12pt", kBoldFontWeight);
|
2009-03-03 22:46:29 -08:00
|
|
|
testDefaultTextAttrs(ID, defAttrs);
|
|
|
|
|
|
|
|
attrs = { };
|
|
|
|
testTextAttrs(ID, 0, attrs, defAttrs, 0, 13);
|
|
|
|
|
2010-05-21 04:27:00 -07:00
|
|
|
attrs = { "font-weight": kNormalFontWeight };
|
2009-03-03 22:46:29 -08:00
|
|
|
testTextAttrs(ID, 13, attrs, defAttrs, 13, 20);
|
|
|
|
|
|
|
|
attrs = { };
|
|
|
|
testTextAttrs(ID, 20, attrs, defAttrs, 20, 27);
|
|
|
|
|
2010-05-21 04:27:00 -07:00
|
|
|
attrs = { "font-weight": kNormalFontWeight };
|
2009-03-03 22:46:29 -08:00
|
|
|
testTextAttrs(ID, 27, attrs, defAttrs, 27, 33);
|
|
|
|
|
|
|
|
attrs = { };
|
|
|
|
testTextAttrs(ID, 33, attrs, defAttrs, 33, 51);
|
|
|
|
|
2010-05-21 04:27:00 -07:00
|
|
|
attrs = { "font-weight": kNormalFontWeight };
|
2009-03-03 22:46:29 -08:00
|
|
|
testTextAttrs(ID, 51, attrs, defAttrs, 51, 57);
|
|
|
|
|
|
|
|
attrs = { };
|
|
|
|
testTextAttrs(ID, 57, attrs, defAttrs, 57, 97);
|
|
|
|
|
2010-05-21 04:27:00 -07:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// 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);
|
2010-08-15 04:28:49 -07:00
|
|
|
|
2010-10-15 08:34:35 -07:00
|
|
|
attrs = { };
|
|
|
|
testTextAttrs(ID, 0, attrs, defAttrs, 0, 0);
|
2010-05-21 04:27:00 -07:00
|
|
|
|
2010-05-25 01:40:26 -07:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// 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);
|
|
|
|
|
2010-11-25 07:58:15 -08:00
|
|
|
SimpleTest.finish();
|
2008-07-17 05:36:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2008-12-16 23:10:41 -08:00
|
|
|
addA11yLoadEvent(doTest);
|
2008-07-17 05:36:00 -07:00
|
|
|
</script>
|
|
|
|
</head>
|
2009-01-24 23:01:24 -08:00
|
|
|
<body style="font-size: 12pt">
|
2008-07-17 05:36:00 -07:00
|
|
|
|
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=345759"
|
|
|
|
title="Implement text attributes">
|
|
|
|
Mozilla Bug 345759
|
|
|
|
</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none"></div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
|
2009-01-24 23:01:24 -08:00
|
|
|
<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>
|
2008-08-28 01:31:01 -07:00
|
|
|
<p id="area3" style="background-color: blue;">
|
|
|
|
<span style="color: green; background-color: rgb(0, 0, 255)">
|
2008-07-17 05:36:00 -07:00
|
|
|
Green
|
|
|
|
<span style="color: red">but children are red</span>
|
2008-08-28 01:31:01 -07:00
|
|
|
</span><span style="color: green; background-color: rgb(255, 255, 0);">
|
2008-07-17 05:36:00 -07:00
|
|
|
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>
|
2010-05-25 01:40:26 -07:00
|
|
|
<!-- Green!*!RedNormal-->
|
2008-07-17 05:36:00 -07:00
|
|
|
<p id="area5">
|
|
|
|
<span style="color: green">Green</span>
|
2010-05-25 01:40:26 -07:00
|
|
|
<img src="../moz.png" alt="image"/>
|
2008-07-17 05:36:00 -07:00
|
|
|
<span style="color: red">Red</span>Normal
|
|
|
|
</p>
|
2008-07-23 08:09:11 -07:00
|
|
|
<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>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p lang="en" id="area7">
|
2008-07-17 05:36:00 -07:00
|
|
|
<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>
|
|
|
|
|
2009-02-15 00:35:10 -08:00
|
|
|
<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: tahoma;">Different font</span> normal
|
|
|
|
<span style="text-decoration: underline;">underlined</span> normal
|
|
|
|
<span style="text-decoration: line-through;">strikethrough</span> 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: tahoma;">Different font</span> normal
|
|
|
|
<span style="text-decoration: underline;">underlined</span> normal
|
|
|
|
<span style="text-decoration: line-through;">strikethrough</span> normal
|
|
|
|
</p>
|
2009-03-03 22:46:29 -08:00
|
|
|
|
|
|
|
<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>
|
2010-05-21 04:27:00 -07:00
|
|
|
|
|
|
|
<p id="area12">hello</p>
|
|
|
|
<p id="area13"></p>
|
|
|
|
<input id="area14">
|
2010-05-25 01:40:26 -07:00
|
|
|
|
|
|
|
<!-- *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>
|
2008-07-17 05:36:00 -07:00
|
|
|
</body>
|
|
|
|
</html>
|