--- a/dom/media/webvtt/vtt.jsm
+++ b/dom/media/webvtt/vtt.jsm
@@ -206,17 +206,17 @@ this.EXPORTED_SYMBOLS = ["WebVTT"];
if (vals.length === 2) {
settings.alt("lineAlign", vals[1], ["start", "middle", "end"]);
}
break;
case "position":
vals = v.split(",");
settings.percent(k, vals[0]);
if (vals.length === 2) {
- settings.alt("positionAlign", vals[1], ["start", "middle", "end"]);
+ settings.alt("positionAlign", vals[1], ["line-left", "center", "line-right", "auto"]);
}
break;
case "size":
settings.percent(k, v);
break;
case "align":
settings.alt(k, v, ["start", "middle", "end", "left", "right"]);
break;
@@ -233,23 +233,17 @@ this.EXPORTED_SYMBOLS = ["WebVTT"];
cue.align = settings.get("align", "middle");
cue.position = settings.get("position", {
start: 0,
left: 0,
middle: 50,
end: 100,
right: 100
}, cue.align);
- cue.positionAlign = settings.get("positionAlign", {
- start: "start",
- left: "start",
- middle: "middle",
- end: "end",
- right: "end"
- }, cue.align);
+ cue.positionAlign = settings.get("positionAlign", "center");
}
function skipWhitespace() {
input = input.replace(/^\s+/, "");
}
// 4.1 WebVTT cue timings.
skipWhitespace();
@@ -783,26 +777,27 @@ this.EXPORTED_SYMBOLS = ["WebVTT"];
this.applyStyles(styles);
this.div.appendChild(this.cueDiv);
// Calculate the distance from the reference edge of the viewport to the text
// position of the cue box. The reference edge will be resolved later when
// the box orientation styles are applied.
var textPos = 0;
- switch (cue.positionAlign) {
- case "start":
- textPos = cue.position;
- break;
- case "middle":
- textPos = cue.position - (cue.size / 2);
- break;
- case "end":
- textPos = cue.position - cue.size;
- break;
+ switch (cue.computedPositionAlign) {
+ // TODO : modify these fomula to follow the spec, see bug 1277437.
+ case "line-left":
+ textPos = cue.position;
+ break;
+ case "center":
+ textPos = cue.position - (cue.size / 2);
+ break;
+ case "line-right":
+ textPos = cue.position - cue.size;
+ break;
}
// Horizontal box orientation; textPos is the distance from the left edge of the
// area to the left edge of the box and cue.size is the distance extending to
// the right from there.
if (cue.vertical === "") {
this.applyStyles({
left: this.formatStyle(textPos, "%"),