|
1181 | 1181 | } |
1182 | 1182 | } |
1183 | 1183 |
|
1184 | | - function HTMLStylingMapDefintion(qName, mapFunc) { |
| 1184 | + function HTMLStylingMapDefinition(qName, mapFunc) { |
1185 | 1185 | this.qname = qName; |
1186 | 1186 | this.map = mapFunc; |
1187 | 1187 | } |
1188 | 1188 |
|
1189 | 1189 | var STYLING_MAP_DEFS = [ |
1190 | 1190 |
|
1191 | | - new HTMLStylingMapDefintion( |
| 1191 | + new HTMLStylingMapDefinition( |
1192 | 1192 | "http://www.w3.org/ns/ttml#styling backgroundColor", |
1193 | 1193 | function (context, dom_element, isd_element, attr) { |
1194 | 1194 |
|
|
1204 | 1204 | ")"; |
1205 | 1205 | } |
1206 | 1206 | ), |
1207 | | - new HTMLStylingMapDefintion( |
| 1207 | + new HTMLStylingMapDefinition( |
1208 | 1208 | "http://www.w3.org/ns/ttml#styling color", |
1209 | 1209 | function (context, dom_element, isd_element, attr) { |
1210 | 1210 | dom_element.style.color = "rgba(" + |
|
1215 | 1215 | ")"; |
1216 | 1216 | } |
1217 | 1217 | ), |
1218 | | - new HTMLStylingMapDefintion( |
| 1218 | + new HTMLStylingMapDefinition( |
1219 | 1219 | "http://www.w3.org/ns/ttml#styling direction", |
1220 | 1220 | function (context, dom_element, isd_element, attr) { |
1221 | 1221 |
|
1222 | 1222 | dom_element.style.direction = attr; |
1223 | 1223 |
|
1224 | 1224 | } |
1225 | 1225 | ), |
1226 | | - new HTMLStylingMapDefintion( |
| 1226 | + new HTMLStylingMapDefinition( |
1227 | 1227 | "http://www.w3.org/ns/ttml#styling display", |
1228 | 1228 | function (context, dom_element, isd_element, attr) {} |
1229 | 1229 | ), |
1230 | | - new HTMLStylingMapDefintion( |
| 1230 | + new HTMLStylingMapDefinition( |
1231 | 1231 | "http://www.w3.org/ns/ttml#styling displayAlign", |
1232 | 1232 | function (context, dom_element, isd_element, attr) { |
1233 | 1233 |
|
|
1254 | 1254 |
|
1255 | 1255 | } |
1256 | 1256 | ), |
1257 | | - new HTMLStylingMapDefintion( |
| 1257 | + new HTMLStylingMapDefinition( |
1258 | 1258 | "http://www.w3.org/ns/ttml#styling extent", |
1259 | 1259 | function (context, dom_element, isd_element, attr) { |
1260 | 1260 | /* TODO: this is super ugly */ |
|
1288 | 1288 |
|
1289 | 1289 | } |
1290 | 1290 | ), |
1291 | | - new HTMLStylingMapDefintion( |
| 1291 | + new HTMLStylingMapDefinition( |
1292 | 1292 | "http://www.w3.org/ns/ttml#styling fontFamily", |
1293 | 1293 | function (context, dom_element, isd_element, attr) { |
1294 | 1294 |
|
|
1345 | 1345 | } |
1346 | 1346 | ), |
1347 | 1347 |
|
1348 | | - new HTMLStylingMapDefintion( |
| 1348 | + new HTMLStylingMapDefinition( |
1349 | 1349 | "http://www.w3.org/ns/ttml#styling shear", |
1350 | 1350 | function (context, dom_element, isd_element, attr) { |
1351 | 1351 |
|
|
1371 | 1371 | } |
1372 | 1372 | ), |
1373 | 1373 |
|
1374 | | - new HTMLStylingMapDefintion( |
| 1374 | + new HTMLStylingMapDefinition( |
1375 | 1375 | "http://www.w3.org/ns/ttml#styling fontSize", |
1376 | 1376 | function (context, dom_element, isd_element, attr) { |
1377 | 1377 | dom_element.style.fontSize = attr.toUsedLength(context.w, context.h) + "px"; |
1378 | 1378 | } |
1379 | 1379 | ), |
1380 | 1380 |
|
1381 | | - new HTMLStylingMapDefintion( |
| 1381 | + new HTMLStylingMapDefinition( |
1382 | 1382 | "http://www.w3.org/ns/ttml#styling fontStyle", |
1383 | 1383 | function (context, dom_element, isd_element, attr) { |
1384 | 1384 | dom_element.style.fontStyle = attr; |
1385 | 1385 | } |
1386 | 1386 | ), |
1387 | | - new HTMLStylingMapDefintion( |
| 1387 | + new HTMLStylingMapDefinition( |
1388 | 1388 | "http://www.w3.org/ns/ttml#styling fontWeight", |
1389 | 1389 | function (context, dom_element, isd_element, attr) { |
1390 | 1390 | dom_element.style.fontWeight = attr; |
1391 | 1391 | } |
1392 | 1392 | ), |
1393 | | - new HTMLStylingMapDefintion( |
| 1393 | + new HTMLStylingMapDefinition( |
1394 | 1394 | "http://www.w3.org/ns/ttml#styling lineHeight", |
1395 | 1395 | function (context, dom_element, isd_element, attr) { |
1396 | 1396 | if (attr === "normal") { |
|
1403 | 1403 | } |
1404 | 1404 | } |
1405 | 1405 | ), |
1406 | | - new HTMLStylingMapDefintion( |
| 1406 | + new HTMLStylingMapDefinition( |
1407 | 1407 | "http://www.w3.org/ns/ttml#styling opacity", |
1408 | 1408 | function (context, dom_element, isd_element, attr) { |
1409 | 1409 | dom_element.style.opacity = attr; |
1410 | 1410 | } |
1411 | 1411 | ), |
1412 | | - new HTMLStylingMapDefintion( |
| 1412 | + new HTMLStylingMapDefinition( |
1413 | 1413 | "http://www.w3.org/ns/ttml#styling origin", |
1414 | 1414 | function (context, dom_element, isd_element, attr) { |
1415 | 1415 | dom_element.style.top = attr.h.toUsedLength(context.w, context.h) + "px"; |
1416 | 1416 | dom_element.style.left = attr.w.toUsedLength(context.w, context.h) + "px"; |
1417 | 1417 | } |
1418 | 1418 | ), |
1419 | | - new HTMLStylingMapDefintion( |
| 1419 | + new HTMLStylingMapDefinition( |
1420 | 1420 | "http://www.w3.org/ns/ttml#styling overflow", |
1421 | 1421 | function (context, dom_element, isd_element, attr) { |
1422 | 1422 | dom_element.style.overflow = attr; |
1423 | 1423 | } |
1424 | 1424 | ), |
1425 | | - new HTMLStylingMapDefintion( |
| 1425 | + new HTMLStylingMapDefinition( |
1426 | 1426 | "http://www.w3.org/ns/ttml#styling padding", |
1427 | 1427 | function (context, dom_element, isd_element, attr) { |
1428 | 1428 |
|
|
1440 | 1440 | dom_element.style.padding = rslt.join(" "); |
1441 | 1441 | } |
1442 | 1442 | ), |
1443 | | - new HTMLStylingMapDefintion( |
| 1443 | + new HTMLStylingMapDefinition( |
1444 | 1444 | "http://www.w3.org/ns/ttml#styling position", |
1445 | 1445 | function (context, dom_element, isd_element, attr) { |
1446 | 1446 | dom_element.style.top = attr.h.toUsedLength(context.w, context.h) + "px"; |
1447 | 1447 | dom_element.style.left = attr.w.toUsedLength(context.w, context.h) + "px"; |
1448 | 1448 | } |
1449 | 1449 | ), |
1450 | | - new HTMLStylingMapDefintion( |
| 1450 | + new HTMLStylingMapDefinition( |
1451 | 1451 | "http://www.w3.org/ns/ttml#styling rubyAlign", |
1452 | 1452 | function (context, dom_element, isd_element, attr) { |
1453 | 1453 | dom_element.style.rubyAlign = attr === "spaceAround" ? "space-around" : "center"; |
1454 | 1454 | } |
1455 | 1455 | ), |
1456 | | - new HTMLStylingMapDefintion( |
| 1456 | + new HTMLStylingMapDefinition( |
1457 | 1457 | "http://www.w3.org/ns/ttml#styling rubyPosition", |
1458 | 1458 | function (context, dom_element, isd_element, attr) { |
1459 | 1459 |
|
|
1494 | 1494 | } |
1495 | 1495 | } |
1496 | 1496 | ), |
1497 | | - new HTMLStylingMapDefintion( |
| 1497 | + new HTMLStylingMapDefinition( |
1498 | 1498 | "http://www.w3.org/ns/ttml#styling showBackground", |
1499 | 1499 | null |
1500 | 1500 | ), |
1501 | | - new HTMLStylingMapDefintion( |
| 1501 | + new HTMLStylingMapDefinition( |
1502 | 1502 | "http://www.w3.org/ns/ttml#styling textAlign", |
1503 | 1503 | function (context, dom_element, isd_element, attr) { |
1504 | 1504 |
|
|
1524 | 1524 |
|
1525 | 1525 | } |
1526 | 1526 | ), |
1527 | | - new HTMLStylingMapDefintion( |
| 1527 | + new HTMLStylingMapDefinition( |
1528 | 1528 | "http://www.w3.org/ns/ttml#styling textDecoration", |
1529 | 1529 | function (context, dom_element, isd_element, attr) { |
1530 | 1530 | dom_element.style.textDecoration = attr.join(" ").replace("lineThrough", "line-through"); |
1531 | 1531 | } |
1532 | 1532 | ), |
1533 | | - new HTMLStylingMapDefintion( |
| 1533 | + new HTMLStylingMapDefinition( |
1534 | 1534 | "http://www.w3.org/ns/ttml#styling textOutline", |
1535 | 1535 | function (context, dom_element, isd_element, attr) { |
1536 | 1536 |
|
1537 | 1537 | /* defer to tts:textShadow */ |
1538 | 1538 | } |
1539 | 1539 | ), |
1540 | | - new HTMLStylingMapDefintion( |
| 1540 | + new HTMLStylingMapDefinition( |
1541 | 1541 | "http://www.w3.org/ns/ttml#styling textShadow", |
1542 | 1542 | function (context, dom_element, isd_element, attr) { |
1543 | 1543 |
|
|
1596 | 1596 | } |
1597 | 1597 | } |
1598 | 1598 | ), |
1599 | | - new HTMLStylingMapDefintion( |
| 1599 | + new HTMLStylingMapDefinition( |
1600 | 1600 | "http://www.w3.org/ns/ttml#styling textCombine", |
1601 | 1601 | function (context, dom_element, isd_element, attr) { |
1602 | 1602 |
|
1603 | 1603 | dom_element.style.textCombineUpright = attr.join(" "); |
1604 | 1604 |
|
1605 | 1605 | } |
1606 | 1606 | ), |
1607 | | - new HTMLStylingMapDefintion( |
| 1607 | + new HTMLStylingMapDefinition( |
1608 | 1608 | "http://www.w3.org/ns/ttml#styling textEmphasis", |
1609 | 1609 | function (context, dom_element, isd_element, attr) { |
1610 | 1610 |
|
1611 | 1611 | /* applied as part of HTML document construction */ |
1612 | 1612 |
|
1613 | 1613 | } |
1614 | 1614 | ), |
1615 | | - new HTMLStylingMapDefintion( |
| 1615 | + new HTMLStylingMapDefinition( |
1616 | 1616 | "http://www.w3.org/ns/ttml#styling unicodeBidi", |
1617 | 1617 | function (context, dom_element, isd_element, attr) { |
1618 | 1618 |
|
|
1627 | 1627 | dom_element.style.unicodeBidi = ub; |
1628 | 1628 | } |
1629 | 1629 | ), |
1630 | | - new HTMLStylingMapDefintion( |
| 1630 | + new HTMLStylingMapDefinition( |
1631 | 1631 | "http://www.w3.org/ns/ttml#styling visibility", |
1632 | 1632 | function (context, dom_element, isd_element, attr) { |
1633 | 1633 | dom_element.style.visibility = attr; |
1634 | 1634 | } |
1635 | 1635 | ), |
1636 | | - new HTMLStylingMapDefintion( |
| 1636 | + new HTMLStylingMapDefinition( |
1637 | 1637 | "http://www.w3.org/ns/ttml#styling wrapOption", |
1638 | 1638 | function (context, dom_element, isd_element, attr) { |
1639 | 1639 |
|
|
1659 | 1659 |
|
1660 | 1660 | } |
1661 | 1661 | ), |
1662 | | - new HTMLStylingMapDefintion( |
| 1662 | + new HTMLStylingMapDefinition( |
1663 | 1663 | "http://www.w3.org/ns/ttml#styling writingMode", |
1664 | 1664 | function (context, dom_element, isd_element, attr) { |
1665 | 1665 |
|
|
1685 | 1685 |
|
1686 | 1686 | } |
1687 | 1687 | ), |
1688 | | - new HTMLStylingMapDefintion( |
| 1688 | + new HTMLStylingMapDefinition( |
1689 | 1689 | "http://www.w3.org/ns/ttml#styling zIndex", |
1690 | 1690 | function (context, dom_element, isd_element, attr) { |
1691 | 1691 | dom_element.style.zIndex = attr; |
1692 | 1692 | } |
1693 | 1693 | ), |
1694 | | - new HTMLStylingMapDefintion( |
| 1694 | + new HTMLStylingMapDefinition( |
1695 | 1695 | "http://www.w3.org/ns/ttml/profile/imsc1#styling forcedDisplay", |
1696 | 1696 | function (context, dom_element, isd_element, attr) { |
1697 | 1697 |
|
|
0 commit comments