diff --git a/lib/vtt.js b/lib/vtt.js index 2be9864..caf7bed 100644 --- a/lib/vtt.js +++ b/lib/vtt.js @@ -820,9 +820,10 @@ function moveBoxToLinePosition(window, styleBox, containerBox, boxPositions) { percentage = 1; // Highest possible so the first thing we get is better. for (var i = 0; i < axis.length; i++) { + var step = b.lineHeight > 0 ? b.lineHeight : 1; while (b.overlapsOppositeAxis(containerBox, axis[i]) || (b.within(containerBox) && b.overlapsAny(boxPositions))) { - b.move(axis[i]); + b.move(axis[i], step); } // We found a spot where we aren't overlapping anything. This is our // best position.